Jump to content

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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.

  • Create New...