Zooming to a location in a drawing

Zooming to a location in a drawing

nbonnett-murphy
Advocate Advocate
601 Views
4 Replies
Message 1 of 5

Zooming to a location in a drawing

nbonnett-murphy
Advocate
Advocate

Hello, I have an iLogic script that is used for checking balloons for overrides. It loops through each sheet, then each balloon on the sheet and if it finds an override it will pop up a message box to let the user know.

I'm trying to add some functionality so that it will zoom to the location of the overriden balloon so that the user can get a look to review without needing to exit and restart the script. Here's what I have right now:

 

					oBalloon.Parent.Activate 'goes to corresponding sheet
					ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomAllCmd").Execute
					ThisApplication.ActiveView.Update()
					
					oDoc.SelectSet.Clear
					oDoc.SelectSet.Select(oBalloon)
'					ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomSelectCmd").Execute
'					ThisApplication.ActiveView.Update()

 

This is mostly working, it takes you to the sheet and selects the balloon (or balloon set). What I'd really like though, is to zoom to the balloon itself. I've tried several variations of the last 2 lines, but I haven't gotten anything to work yet. I tried using execute2(true), all the various "AppZoom..." commands I could find, declaring a global command manager object etc.

 

Does anyone know how I can zoom to a selected object in a drawing? If I could even get windowzoom to work programmatically I could get the coords of the bubble and then set an offset for the selection, but I haven't been able to figure that out either.

Accepted solutions (2)
602 Views
4 Replies
Replies (4)
Message 2 of 5

dalton98
Collaborator
Collaborator
Accepted solution

The only way i can think of then is to zoom to the specific point of the balloon. ex

Dim oSheet As Sheet = ThisDoc.Document.ActiveSheet
Dim oBalloon As Balloon = oSheet.Balloons(1)
Dim oPoint As Point = ThisApplication.TransientGeometry.CreatePoint(oBalloon.Position.X, oBalloon.Position.Y, 0)

Dim oCam As Camera = ThisApplication.ActiveView.Camera
oCam.Target = oPoint
oCam.SetExtents(5, 5)
oCam.Apply

 

 

Message 3 of 5

nbonnett-murphy
Advocate
Advocate

Thanks for the help! I'm about to leave for the day but I'll give it a shot tomorrow. I didn't realize that you could also use the camera movement stuff in a drawing as well as a part/assembly, so I haven't dug into it at all yet. The "transientGeometry" thing looks useful as well.

0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @nbonnett-murphy 

 

See this link to a previous post on this topic:

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-find-baloon-and-zoom-contains...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 5 of 5

nbonnett-murphy
Advocate
Advocate

This is perfect, thanks very much. I had a really hard time finding the right search terms without getting flooded by answers that were almost what I needed.

 

I just needed to add a

oBalloon.Parent.Activate

to make sure that I got to the right sheet.

0 Likes