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.definitionI 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.
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