Retrieving Edge.Geometry for linear and circular edges

By Philippe Leefsma

If the Edge is linear, “Edge.CurveType” property returns kLineCurve, the Geometry is a LineSegment, if the Edge is a circle, “Edge.CurveType” returns kCircleCurve, the Geometry is a Circle, if the Edge is a 3D arc, “Edge.CurveType” is still kCircleCurve, but the Geometry is an Arc3d. So when CurveType is kCircleCurve, you may also need to check the object type as follows:

    Sub TestEdgeGeometry(ByVal app As Inventor.Application)

 

        ‘ assumes an edge is selected

        Dim oEdge As Edge

        oEdge = app.ActiveDocument.SelectSet.Item(1)

 

        If (oEdge.CurveType = CurveTypeEnum.kLineCurve) Then

 

            Dim oLine As Inventor.LineSegment

            oLine = oEdge.Geometry

 

        ElseIf (oEdge.CurveType = CurveTypeEnum.kCircleCurve) Then

 

            If TypeOf oEdge.Geometry Is Inventor.Circle Then

 

                Dim oCir As Inventor.Circle

                oCir = oEdge.Geometry

 

            ElseIf (TypeOf oEdge.Geometry Is Arc3d) Then

 

                Dim oArc As Inventor.Arc3d

                oArc = oEdge.Geometry

 

            End If

 

        End If

 

    End Sub

<

p style=”line-height: normal;margin: 0in 0in 0pt” class=”MsoNormal”> 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading