0 Replies Latest reply on Dec 18, 2016 7:52 PM by Yong Ning

    InsertCenterLine2 is nothing

    Yong Ning

      Follow code result is nothing.

       

      Curve1.jpg

       

      result don't insert centerline.

      Curve.jpg

       

      Private Sub ll()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            Set SwModel = SwApp.ActiveDoc

         Dim SwDraw As DrawingDoc

            Set SwDraw = SwModel

         Dim SwView As View

            Set SwView = SwDraw.GetFirstView

            Set SwView = SwView.GetNextView

            Debug.Print SwView.Name

         Dim vComps, vEdges

            vComps = SwView.GetVisibleComponents

            'vEdges = SwView.GetVisibleEntities(vComps(0), swViewEntityType_SilhouetteEdge)

            vEdges = SwView.GetVisibleEntities(vComps(0), swViewEntityType_Edge)

       

         Dim SwEnt As Entity, SwEdge As Edge

         Dim SwCurve As Curve, SwLine

            For ii = 0 To UBound(vEdges)

                Set SwEdge = vEdges(ii)

                Set SwCurve = SwEdge.GetCurve

                If SwCurve.IsLine Then

                    Set SwEnt = SwEdge

                    SwEnt.Select True

                End If

            Next ii

         Dim SwCenterLine As CenterLine

            Set SwCenterLine = SwDraw.InsertCenterLine2

      End Sub