Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic: reference all curves on a Drawing

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ad64
1725 Views, 4 Replies

iLogic: reference all curves on a Drawing

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

4 REPLIES 4
Message 2 of 5
Vladimir.Ananyev
in reply to: ad64

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,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
ad64
in reply to: Vladimir.Ananyev

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

Message 4 of 5
waynehelley
in reply to: ad64

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!

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Message 5 of 5

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.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report