Is there a way in iLogic to iterate through all curves on a drawing. We manually apply radii labels to each drawing view but would like to automate the process with iLogic. How could I reference and cycle through all the radii on my drawing view?
Steve
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
Drawing curves projected from the model geometry can be found in DrawingView.DrawingCurves collection. You may check DrawingCurve.CurveType property to filter circular arcs and circles that should be dimensioned.
The following iLogic rule works in the drawing document and calculates the quantity of arcs and circles.
'sheet with a drawing view Dim oSheet As Sheet = ActiveSheet.Sheet 'reference to the first drawing view Dim oView As DrawingView = oSheet.DrawingViews.Item(1) Dim oCurves As DrawingCurvesEnumerator = oView.DrawingCurves Dim n1 As Integer = 0 'counter for circles Dim n2 As Integer = 0 'counter for circular arcs For Each oC As DrawingCurve In oCurves If oC.CurveType = CurveTypeEnum.kCircleCurve Then n1 += 1 ElseIf oC.CurveType = CurveTypeEnum.kCircularArcCurve Then n2 += 1 End If Next MsgBox("Circles: " & n1 & vbNewLine & "Arcs: " & n2) Beep
Cheers,
Thanks for the code. I am trying to determine the radius of each curve on the drawing as I iterate through them with your code.
Using trigonometry I am able to determine the radius of each arc (kCircularArcCurve) from its end point and centerpoint locations. However, the circles (kCircleCurve) do not return an endpoint or centerpoint value. Is there another value that stores the radius of each curve or some point along it's surface that I could use to calculate the radius?
Thanks,
Steve
I have a very similar problem. For 'kCircleCurve', I can retrieve the CentrePoint data but not the Start or End point data.
I need my script to be able to work out if the orintation of the curves are horizontal or vertical.
I need something more than just one set of coordinates to do this!
DrawingCurve.ModelGeometry property returns the corresponding parent geometry from the model.
If DrawingCurve.CurveType = CurveTypeEnum.kCircleCurve, model geometry should be a circular edge.
Edge.Geometry.normal property returns the UnitVector that could help you to check the circle plane orientation.
Sub Test2() 'select a circular edge to check its orientation Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition Set oDef = oDoc.ComponentDefinition Dim sset As SelectSet Set sset = oDoc.SelectSet Dim oEdge As Edge Set oEdge = sset.Item(1) If oEdge.GeometryType = CurveTypeEnum.kCircleCurve Then Dim oVector As UnitVector Set oVector = oEdge.Geometry.normal Debug.Print "normal.x = " & oVector.x Debug.Print "normal.y = " & oVector.y Debug.Print "normal.z = " & oVector.z Else MsgBox "Select circle edge!" End If Beep End Sub
Hope this could help.