Importing don't have to bring inherit of lenz
-
Hi again everyone.
I thought that had finished my import tool... but.. found a "bug". I have a situation, as follows:
*Note: Not sure about the name of the things yet.. When I say entity I mean a rack, shelf, desk, table or anything that is a full mounted object.
When create an entity with LenZ 700mm, put another entity on your side with LenZ 400mm, then export all, everything is save with correct attributes. But, when I import, the second entity assume LenZ = 700mm. The both assume the same height.
But if I change the order of put entities (400mm first, then 700mm after), when Import, everything occurs as it meant to be, with the respective LenZ.
Here's my import code:
loaded_module = Sketchup.active_model.definitions.load_from_url uri moduli['attributes'].each do |key, value| my_load_texture_method loaded_module.set_attribute 'dynamic_attributes', key, method_to_inches_mm_etc(value) end my_method_to_set pos_x, pos_y, pos_z and rot_z t_rotation = Geom;;Transformation.rotation(ORIGIN, Z_AXIS, rot_z.degrees) point = Geom;;Point3d.new pos_x, pos_y, pos_z t_position = Geom;;Transformation.new point entities = Sketchup.active_model.active_entities instance = entities.add_instance(loaded_module, t_rotation) instance.transform!(t_position) $dc_observers.get_latest_class.redraw_with_undo instanceWhat I could observe is that, SU execute a rotation in ORIGIN, then apply texture and high(at this point he puts the wrong LenZ attribute), then move to his position.
-
well.. that's embarrassing...
actually the "problem" is that i had overloaded "onElementAdded" method.. and put:
@service.recent_inherit! entitynow i send a new attribute, then it becomes:
if entity.definition.get_attribute 'dynamic_attributes', 'imported_entity' @service.recent_inherit! entity endsorry about that and thanks for your time.
cheers.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement