Jump to content
Developer Wiki and Function Reference Links ×

Focus and Zoom on each selected


Recommended Posts

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?

Link to comment

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.

Link to comment

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.

Guest
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.

×
×
  • Create New...