WhoCanDo Posted July 30, 2019 Share Posted July 30, 2019 Hi, 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; begin { SetName (hZ, 'Target'); ZoomX := XCenterN (N = 'Target'); ZoomY := YCenterN (N = 'Target'); } DoMenuTextByName ('Fit To Objects', 0); SetZoom (280); end; 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? Quote Link to comment
PatW Posted July 30, 2019 Share Posted July 30, 2019 (edited) ForEachObjectInList needs a callback function you can do the selection inside there instead off looping a list. Theres a good example on: http://developer.vectorworks.net/index.php/VS:ForEachObjectInList regards, Patrick Edited July 30, 2019 by PatW Quote Link to comment
Pat Stanford Posted July 30, 2019 Share Posted July 30, 2019 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. Quote Link to comment
Recommended Posts
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.