Method to identify what context the user is in?
-
active_path = Sketchup.active_model.active_path
returns nil if they are not in a component. If they are inside a component, or drilled down a few levels, it will return each component they are within.
Chris
-
model.active_entities
will return the entities of the editing context. Contrast tomodel.entities
which will return all of the top-level entities.model.active_path
will return an Array containing the sequence of entities the user has double-clicked on for editing. Or nil if none.Maybe one of those is what you need?
-
Thank you both very much. I believe that's exactly what I need.
-
In order to accomplish what I need, I use the info given above to get out of the context of the group back into the overall context:
while !Sketchup.active_model.active_path.nil? Sketchup.active_model.close_active end
It would be nice if I could save the position somehow, go to the global context as shown in the code but then go back to the context when I'm done. That way the user doesn't have to re-double-click back to where they were.
I'm not seeing anything in the model class that would appear to do that. Anyone have any ideas?
-
Why do you need to go out and back in the nested entities ? You can always get the user to pick something within a group (say), do things to it within it's entity set without having to open that entities set for editing ?
-
You sure you have to exit the current context, can't you take the
model.edit_transform
into account when doing your operations?
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform -
@thomthom said:
You sure you have to exit the current context, can't you take the
model.edit_transform
into account when doing your operations?
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transformThat was super helpful. I used that transformation matrix to adjust my data and it worked perfectly. Much obliged!
-
@thomthom said:
You sure you have to exit the current context, can't you take the model.edit_transform into account when doing your operations?
Could this be used to calculate scaled face areas in a Component?
reference: http://forums.sketchucation.com/viewtopic.php?f=180&t=16075
-
@fizgig said:
It would be nice if I could save the position somehow, go to the global context as shown in the code but then go back to the context when I'm done. That way the user doesn't have to re-double-click back to where they were.
I'm not seeing anything in the model class that would appear to do that. Anyone have any ideas?
It was requested, but hasn't made an appearance yet. I reaffirmed the request.
-
[quote="fizgig"]
If the user does double-click into a group, the active context is that group and the local coordinate system associated with that group.
yes,I want this too.I ask the same qus here
http://forums.sketchucation.com/viewtopic.php?f=180&t=22915&p=193698#p193698
Advertisement