Jump to content
Developer Wiki and Function Reference Links Read more... ×

Focus and Zoom on each selected

Recommended Posts



I am adding data to multiple objects selected at various locations on my drawing. I would like to zoom in on each object when the user is asked for options.


procedure Zoom (hZ : handle);
var ZoomX, ZoomY : real;
SetName (hZ, 'Target');
ZoomX := XCenterN (N = 'Target');
ZoomY := YCenterN (N = 'Target');
DoMenuTextByName ('Fit To Objects', 0);
SetZoom (280);


This doesn't work because it Fit's to all objects before Zooming in on the center of the selection. Other ideas are within the brackets.


Maybe ForEachObjectInList, but I don't know how to generate a list. I would then SetSelect (hZ) to zoom in on it.


Can anyone expand on the above please?

Share this post

Link to post

Since Fit To Objects works on selection, not on handles, you need a way to select only a single object.


Use a loop to step through each selected object and store the handle in an Array of Handles.

Deselect everything.

Step through the array and select the first object and do Fit To Objects. Repeat for each object in the array.

If you need to still have everything selected at the end, do an additional loop through the array to select all the objects.


Ask again if you need a better description.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.