Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Limit iLogic rule for specific view on drawing

ganeshholkar18
Explorer

Limit iLogic rule for specific view on drawing

ganeshholkar18
Explorer
Explorer

Hi,

 

I have below iLogic rule to control dimension precision on Inventor drawing. It updates dimension precision in all drawing views.

 

Is it possible to modify this rule so that it will only update dimension precision of required drawing view ?? I have a view on drawing with name as "UNDER". I want to have precise dimensions only for this view.

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet

For Each oDim As DrawingDimension In oSheet.DrawingDimensions
If Round(oDim.ModelValue * 10, 1) -Round(oDim.ModelValue * 10, 0) = 0 Then
oDim.Precision = 0
Else
oDim.Precision = 1
End If
Next

 

BR, Ganesh

Reply
Accepted solutions (2)
413 Views
2 Replies
Replies (2)

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi, it's not as straight forward as it seems.

 

Here is one exemple : https://adndevblog.typepad.com/manufacturing/2012/08/how-to-determine-which-drawing-dimensions-belon...

 

Regards,

 

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Curtis_Waguespack
Consultant
Consultant
Accepted solution

to put this all together for iLogic, here is an example 

 

Sub Main

	Dim oDoc As DrawingDocument
	oDoc = ThisApplication.ActiveDocument
	
	Dim oDrawingDimCollec1 As ObjectCollection
	oDrawingDimCollec1 = GetDrawingDimForView(oDoc.ActiveSheet, "VIEW1")

	For Each oDim As DrawingDimension In oDrawingDimCollec1
		If Round(oDim.ModelValue * 10, 1) -Round(oDim.ModelValue * 10, 0) = 0 Then
			oDim.Precision = 0
		Else
			oDim.Precision = 1
		End If
	Next

End Sub


Public Function GetDrawingDimForView(oSheet As Sheet, ViewName As String) As ObjectCollection
	Dim oDrawDimsForView As ObjectCollection
	oDrawDimsForView = ThisApplication.TransientObjects.CreateObjectCollection

	Dim oDrawDims As DrawingDimensions
	oDrawDims = oSheet.DrawingDimensions

	Dim oDrawDimIterator As DrawingDimension
	For Each oDrawDimIterator In oDrawDims
		Select Case oDrawDimIterator.Type
			Case kLinearGeneralDimensionObject
				Dim oLinearDim As LinearGeneralDimension
				oLinearDim = oDrawDimIterator
				If oLinearDim.IntentOne.Geometry.Parent.Name = ViewName Then
					oDrawDimsForView.Add(oDrawDimIterator)
				End If
			Case kRadiusGeneralDimensionObject
				Dim oRadiusDim As RadiusGeneralDimension
				oRadiusDim = oDrawDimIterator
				If oRadiusDim.Intent.Geometry.Parent.Name = ViewName Then
					oDrawDimsForView.Add(oDrawDimIterator)
				End If
			Case kDiameterGeneralDimensionObject
				Dim oDiameterDim As DiameterGeneralDimension
				oDiameterDim = oDrawDimIterator
				If oDiameterDim.Intent.Geometry.Parent.Name = ViewName Then
					oDrawDimsForView.Add(oDrawDimIterator)
				End If
			Case kAngularGeneralDimensionObject
				Dim oAngularDim As AngularGeneralDimension
				oAngularDim = oDrawDimIterator
				If oAngularDim.IntentOne.Geometry.Parent.Name = ViewName Then
					oDrawDimsForView.Add(oDrawDimIterator)
				End If
			Case Else
				'Case is not handled...
		End Select
	Next
	GetDrawingDimForView = oDrawDimsForView
End Function