Zoom on selected Dimension

Zoom on selected Dimension

tobias_wiesendanger
Advocate Advocate
529 Views
1 Reply
Message 1 of 2

Zoom on selected Dimension

tobias_wiesendanger
Advocate
Advocate

Anybody has an idea on how to zoom on a selected dimension. My plan is to search and find a dimension on a drawing and then zoom in on that dimension.

 

Open for any ideas.

 

regards

 

Tobias

Accepted solutions (1)
530 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Here's an iLogic rule I threw together that might do what you want.  It is designed to work with an 'active' drawing document (not a part or assembly sketch).  Right now it is just set-up to get the first dimension on the active sheet, but you can modify how it get the specific dimension you want another way if you want.

I had to set both the target and the eye to keep it from 'skewing' the view of the drawing sheet, even though I'm specifying 'ApplyWithoutTransition'.

Here's the code:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
'specify which dimension any way you want
Dim oDim As DrawingDimension = oSheet.DrawingDimensions.Item(1)
Dim oLine As LineSegment2d = oDim.DimensionLine
Dim oBox As Box2d = oLine.Evaluator.RangeBox
'Dim oBox As Box2d = oDim.Text.RangeBox
Dim oWidth As Double = oBox.MaxPoint.X - oBox.MinPoint.X
Dim oHeight As Double = oBox.MaxPoint.Y - oBox.MinPoint.Y
Dim oCam As Camera = ThisApplication.ActiveView.Camera
Dim oTarget As Point = ThisApplication.TransientGeometry.CreatePoint(oDim.Text.Origin.X, oDim.Text.Origin.Y, 0)
Dim oEye As Point = ThisApplication.TransientGeometry.CreatePoint(oDim.Text.Origin.X, oDim.Text.Origin.Y, 1)
oCam.Target = oTarget
oCam.Eye = oEye
oCam.SetExtents(oWidth + .25, oHeight + .25)
oCam.ApplyWithoutTransition

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)