Cannot Dimension Multiple Holes with One Rule - Diameter and Center Marks - .idw

Cannot Dimension Multiple Holes with One Rule - Diameter and Center Marks - .idw

sbone94WTK
Explorer Explorer
450 Views
1 Reply
Message 1 of 2

Cannot Dimension Multiple Holes with One Rule - Diameter and Center Marks - .idw

sbone94WTK
Explorer
Explorer

I am trying to mark and dimension multiple holes on a drawing view. When I run my rule it only marks and dimensions that last item in the rule. If I comment out the last line it then marks and dimensions the new "last" line. It remove and existing center marks and diameter dimensions. I have included a snippet of what I am trying to achieve and the code I have created so far. If you could please review and explain to me what I am doing incorrect as I am a newer user of iLogic.

HOLES.png

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oDimStyle As Style = oDoc.StylesManager.DimensionStyles.Item("Dual")
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")

'FrontView
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim namedGeometry1 = VIEW1.GetIntent("OD")
Dim namedGeometry2 = VIEW1.GetIntent("TopPoint2")
Dim namedGeometry3 = VIEW1.GetIntent("Bottom")
Dim namedGeometry4 = VIEW1.GetIntent("LeftPoint")
Dim namedGeometry5 = VIEW1.GetIntent("RightPoint")
Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
'Side Height
Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(-0.07, -0.1), namedGeometry1)
'Overall Height
Dim linDim2 = genDims.AddLinear("Dimension 2", VIEW1.SheetPoint(1.1, 0), namedGeometry2, namedGeometry3)
'Inside Diameter
Dim linDim3 = genDims.AddLinear("Dimension 4", VIEW1.SheetPoint(0.25, -0.3), namedGeometry4, namedGeometry5)

'TopView
Dim VIEW2 = Sheet_1.DrawingViews.ItemByName("VIEW2")
'Add Centermark to View
Dim holeIntent = VIEW2.GetIntent("OD", PointIntentEnum.kCenterPointIntent)
Dim centermark = Sheet_1.Centermarks.Add("Hole Centermark", holeIntent)
'Add Centermark and Dimension to Left Hole
Dim hole2 = VIEW2.GetIntent("Hole2")
Dim holeDim = genDims.AddDiameter("Hole Diameter", VIEW2.SheetPoint(0, .25), hole2)
Dim centermark2 = Sheet_1.Centermarks.Add("Hole Centermark", hole2)
'Add Centermark and Dimension to Right Hole
Dim hole3 = VIEW2.GetIntent("Hole3")
Dim holeDim1 = genDims.AddDiameter("Hole Diameter", VIEW2.SheetPoint(1, .25), hole3)
Dim centermark3 = Sheet_1.Centermarks.Add("Hole Centermark", hole3)

Dim oUnitOfMeas As UnitsOfMeasure = ThisApplication.ActiveDocument.UnitsOfMeasure

linDim1.NativeEntity.Tolerance.SetToReference
linDim3.NativeEntity.Precision = 3
linDim3.NativeEntity.Text.FormattedText = ("Ø<DimensionValue/>")

 

 

0 Likes
Accepted solutions (1)
451 Views
1 Reply
Reply (1)
Message 2 of 2

dalton98
Collaborator
Collaborator
Accepted solution

The first value in the function has to be a unique name "Hole Centermark1", "Hole Centermark2", etc.

(or you might just be able to leave it blank "")

Dim centermark3 = Sheet_1.Centermarks.Add("Hole Centermark", hole3)

 I don't like using the recommended iLogic functions for creating dimensions for precisely the reason you are having trouble with it. If you are using the same part in drawings multiple times it can be useful, but its hard to use effectively otherwise.

 

For something as common as holes you could search the drawing view for circular lines and dimension the holes that way. Heres a snippet from a rule i use often for this:

Dim oDrawingDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDrawingDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oCurve As DrawingCurve

For Each oCurve In oView.DrawingCurves
	If oCurve.CurveType = CurveTypeEnum.kCircleCurve		
		oSheet.Centermarks.Add(oSheet.CreateGeometryIntent(oCurve))
	End If
Next
0 Likes