Zoom in on a Selected Object using iLogic

Zoom in on a Selected Object using iLogic

petestrycharske
Advisor Advisor
1,421 Views
1 Reply
Message 1 of 2

Zoom in on a Selected Object using iLogic

petestrycharske
Advisor
Advisor

All,

 

I'm working on some code that will help make sure that we have configured components correctly and have hit a snag.  Some of the layouts could get quite large and so to ensure that we're looking at the correct components, I would like to use some iLogic code to zoom in on the selected component.  I'm also trying to select each object via iLogic too, but that I'll leave for another post.  Anyway, I see that there is a line to Zoom to Home and Zoom Extents, but I don't see anything to zoom in on a selected component.  I can do so manually using the Navigation Bar, so I'm hoping there is a way to do this programmatically.  Please see the sample lines below and do not hesitate to reach out to me for questions.  Thanks in advance for any assistance and have a most blessed day!

 

ThisApplication.ActiveView.GoHome (In the current application, this will force the view to home)

 

ThisApplication.ActiveView.Fit (In the current application, this will force the view to show all the components with the current camera orientation)

 

What I mostly want to do is mimic the ActiveView.Fit functionality, but only with one part at a time.

 

Peace,

Pete

Just a guy on a couch...

Please give a kudos if helpful and mark as a solution if somehow I got it right.
0 Likes
1,422 Views
1 Reply
Reply (1)
Message 2 of 2

pball
Mentor
Mentor
ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomSelectCmd").Execute

Select a part and run that code, it'll zoom to the selected item.

I found that command name using the PrintCommandNames function you can find in the API or just search the forums. That function will print you a list of every command the API can use.
Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style