Model.active_path uses global coordinates?
-
I want to manipulate the component definition for the component the user is currently editing (which is nested 2 layers deep). If I do this:
ci = model.active_path.last cd = ci.definition
I get a valid component definition of the type I am expecting, but if I examine the geometry in the cd, all of the locations returned are in the global coordinate system - I expected them to be in the local system: relative to the origin of the component I'm editing. This is strange. Can anyone explain what's going on here?
-
I think that as a component/group is opened for editing, all co-ordinates are made global.
Su7.0 introduced a method to help on this matter: http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform
-
the way I solve this problem is with entities.transform_entities(entities.to_a,model.edit_transform.inverse), which effectively reset the definition.
Then, when you are done editing, just do the same thing without the .inverse
-
@thomthom said:
I think that as a component/group is opened for editing, all co-ordinates are made global.
That explains much.
@thomthom said:
Su7.0 introduced a method to help on this matter: http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform
And I'll have to transform them all back myself, I guess. Thanks, Thomas.
Advertisement