Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 516

Get Profile Path of Feature

$
0
0

By Xiaodong Liang

Typically, a feature is created from a profile. Assume we have got the feature, the Feature.Profile can return a set of connected curves (ProfilePath) used as input for a feature., ProfilePath.TextBoxPath tells if the profile is a TextBox, and ProfilePath.TextBox will return the TextBox object. The following is a code demo.

      PrivateSub Test()

        Try

            oApp =

                System.Runtime.InteropServices.Marshal.

                GetActiveObject("Inventor.Application")

 

            'assume a feature is selected

            Dim extFeature AsExtrudeFeature

            extFeature =

                oApp.ActiveDocument.SelectSet(1)

 

            Dim path AsProfilePath

            ForEach path In extFeature.Profile

                If path.TextBoxPath Then

                    ' if the profile is a textbox

                    'get the textbox object

                    Dim oTB AsTextBox = path.TextBox

                   

                Else

                    ' if it is from other sketch entities.

                    If path.Count > 0 Then

 

                        ForEach entity As

                        Inventor.ProfileEntityIn path

         'iterate each sketch entity in the path

                            If entity.CurveType =

            Curve2dTypeEnum.kLineSegmentCurve2d Then

 

                       'if it is a sketch line.

                      Dim oSkE AsSketchEntity =

                                    entity.SketchEntity

                      Dim oLine AsSketchLine =

                                    CType(oSkE, SketchLine)

                      Dim startpt As Inventor.Point2d =

                    oLine.StartSketchPoint.Geometry

                   Dim endpt As Inventor.Point2d =

                     oLine.EndSketchPoint.Geometry

 

                            EndIf

 

                            ''other sketch types

                            ''

 

                        Next

                    EndIf

                EndIf

            Next

        Catch ex AsException

 

        EndTry

 

    EndSub


Viewing all articles
Browse latest Browse all 516

Trending Articles