Zoom Selection
-
thanks Matt, i understand now (to be sure i also don't grasp N lindenthal idea - maybe with some screenshots..).
here is my alternate idea: the script centers the selection to screen (one can assign a shortcut key). however, if say CTRL is pressed then all other objects (not in the selection) get hidden. But there is no right click.
-
@matt666 said:
ā¦
But i don't understand what he relly wants... My poor english language !!
ā¦My poor english language, too.
What I want: Zoom selection with distance by preference. For example: I select a door and zoom it. The door comes to the middle of the screen and zooms to fill the screen. Now I measure the distance. Next selctions will be the door handle or the door hinge. If one of them is selected and zoomed, the model will only slide so that the door handle is in the middle of screen but is not zoomed. So the scale of door and the scale of door handle are the same. I see the door handle and the door in same scale (with same distance).
How can I measure the distance to selection? How can I set the distance to an object by name?
-
@cadfather said:
ok, this is what happens to the script: if i am inside of a group/component and 'hide rest of model' is on, zoom selection does not work. surely this must happen to everyone?
You are correct, it does not work. There are 2 ways to zoom to a selection using the API and they both fail when "hide rest of model" is enabled.
I'm not seeing a quick solution other than Matt's idea of temporarily switching 'hide rest' on, zooming, and then switching it off again.
I'm sure a better "Zoom to Selection" could be written, though - one that would work in all configurations.
-
Jim, you mean if a script was written from scratch it could be done?
-
@cadfather said:
Jim, you mean if a script was written from scratch it could be done?
Yes, a camera zoom is simply moving the camera closer to the target, and can be done using Ruby.
-
@jim said:
ā¦
a camera zoom is simply moving the camera closer to the target, and can be done using Ruby.Please, Jim, tell me how to move the camera to a selected item with distance of 2 meter by ruby script.
-
model = Sketchup.active_model view = model.active_view camera = view.camera eye = camera.eye target = camera.target up = camera.up vector = target - eye vector.length = 2.m eye = eye + vector camera.set eye, target, up
-
Unbelievably, Jims code moves my model. Thank you very much.
I have to play a lot, because I donāt understand, what the code makes. Repeating brings my model nearer and nearer. Change the unit from 2. to 2000. makes bigger steps. Change the unit from 2000. to -2000. turns the direction (the model goes remote).
So, how can I see one part of my model with distance of 2 meters?
-
I think if the last 4 lines are
vector = eye - target vector.length = 2.m eye = target + vector camera.set eye, target, up
then you will get the desired result
-
Sometimes RickWs code works pretty. But often it does not work. Then sometimes the error is:
@unknownuser said:Error: #<ArgumentError: (eval):197:in 'set': Eye and target points must be different>
My goal is to select one item by name and to show this item with camera with distance 2 meters.
-
@n lindenthal said:
ā¦
But often it does not work.
ā¦To make it work, I had to Ā»Start Animation ObserverĀ«.
@Rick
Your code works properly. Thank you very much. -
@pixero said:
@cadfather said:
if i select something inside of a group it does not work - but will fit the contents to screen if nothing is selected.
What do you mean with "It doesnt work" ? What do you want it to do?
If you are inside a group the group itself isn't selected.
My script zooms in to whats selected. Inside group or not.Thx a lot! Great plugin. Work fine, no problem with selection zoom.
Can you recommend me any other useful plug?
Advertisement