[HowTo?] Edit Components (or change "active level")
-
Now, on SU7, that one can get the full "genealogical instances path" from your current "active level" up to the model level ( with model.active_path ).
How can I re-position my "active level" in one particular instance of this path (kind of "edit level") ? Example:print model.active_path
#Sketchup::ComponentInstance:0x01Sketchup::ComponentInstance:0x02Sketchup::ComponentInstance:0x03That means my current "active level" is instance 0x03.
How can I move up one level using Ruby API to make my "active level" at instance 0x02 ?Thank you
PS1: It could be a pair of APIs like this:
model.get_active_path ( exactly the same as model.active_path)
model.set_active_path(n) where n is the number of "levels" to go up.In the example above, model.set_active_path(1) will move the "active level" to
#Sketchup::ComponentInstance:0x01Sketchup::ComponentInstance:0x02PS2: Today I'm using the OUTLINER to get positioned in a particular "active level". How can I do the same using Ruby API ?
Thank you
Marcio -
Hi!
I am also intersted by this request... How can you set active path to a defined componant instance? -
Don't think there is one...

-
Sounds like model.close_active is what you're looking for. You can "move up", but not dig deeper.
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#close_active
-
Yes I know this method... But not its opposite!

-
model.close_active ### will jump you up one 'level' out of the current edit session.
You can only go in the direction of the base model...
You can repeat x(model.active_path.length) to close the edit back to the base model 'level'.
Alternatively...
model.active_path[model.active_path.length-2] ### to get up 1 level, or use -3 for 2 levels etc...
All of these physically close any current edit sessions...
If you just want to do something with the entities found at a particular 'level' then just use...
parent=model.active_path[model.active_path.length-2]
i.e. the container of the current edit session's instance/group
parent_entities=parent.definition.entities if parent.typename=="ComponentInstance"
parent_entities=parent.entities if parent.typename=="Group"etc... there's no need to close edits etc, just specify the actual entities-set to work on...
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