4 Replies Latest reply on Jan 31, 2017 5:38 AM by Lin Jinxue

    how to show the reference plane in the assembly

    Lin Jinxue

      I want to show the reference plane of component in the assembly

      the fellow is my code :

      Dim swComponent As SldWorks.Component2

      Dim asename As String

      Dim partname As String

      Dim fileerror As Long

      Dim filewarning As Long

      Dim boolstatus As Boolean

      Dim partmodel As SldWorks.IModelDocExtension

      Dim topname As String

       

       

       

       

      Sub main()

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          asename = swModel.GetTitle

          ' Get the selected entity (i.e., face, edge, vertex, or loop)

          ' and get the name of its component

          Set swSelectionMgr = swModel.SelectionManager

          Set swComponent = swSelectionMgr.GetSelectedObjectsComponent4(1, -1)

         Debug.Print swComponent.GetPathName

        If Not swComponent Is Nothing Then

       

              Set partmodel = swComponent.GetModelDoc2

       

                     End If

       

       

          boolstatus = partmodel.Extension.SelectByID2("上视基准面", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

          Debug.Print boolstatus

         

          partmodel.UnBlankRefGeom

       

      End Sub

      ==========================

      but it not work ,what's the problem is?