2 Replies Latest reply on Jan 30, 2013 6:56 PM by Yong Ning

    how to hide origin in assembly?

    Yong Ning

      0.jpg

       

      'Select Origin of Assembly Component Example (VB)

      'This example shows how to get the origin of an assembly component.

       

      '-------------------------------------------------

      '

      ' Preconditions:

      '       (1) Assembly document is open.

      '       (2) Assembly is fully resolved.

      '       (3) A component is selected.

      '

      ' Postconditions: Origin of the selected component is selected.

      '

      '--------------------------------------------------

      Option Explicit

      Sub main()

          Dim swApp                       As SldWorks.SldWorks

          Dim swModel                     As SldWorks.ModelDoc2

          Dim swSelMgr                    As SldWorks.SelectionMgr

          Dim swSelComp                   As SldWorks.Component2

          Dim swCompModel                 As SldWorks.ModelDoc2

          Dim swFeat                      As SldWorks.Feature

          Dim bRet                        As Boolean

          Dim SwPt As MathPoint

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swSelMgr = swModel.SelectionManager

          Set swSelComp = swSelMgr.GetSelectedObjectsComponent(1)

          Set swCompModel = swSelComp.GetModelDoc

         

          swModel.ClearSelection2 True

         

          Set swFeat = swSelComp.FirstFeature

          Do While Not swFeat Is Nothing

              If "OriginProfileFeature" = swFeat.GetTypeName Then

                  bRet = swFeat.Select2(False, 0): Debug.Assert bRet

                  Exit Do

              End If

             

              Set swFeat = swFeat.GetNextFeature

          Loop

      End Sub

       

      Help me

      How to hide origin →  Origin of the selected component is selected

        • Re: how to hide origin in assembly?
          Artem Taturevych

          ...

                  If "OriginProfileFeature" = swFeat.GetTypeName Then

                      bRet = swFeat.Select2(False, 0): Debug.Assert bRet

                      swModel.BlankSketch 'Hide origin

                      'swModel.UnblankSketch 'Show origin

                      Exit Do

                  End If

          ...

          _______

          ___________________

          Regards,

          Artem Taturevych

          Application Engineer at Intercad

          http://intercad.com.au/

          Tel: +61 2 9454 4444

            • Re: how to hide origin in assembly?
              Yong Ning

              Thank your tips

              the code is

               

              Option Explicit

              Sub main()

                  Dim swApp                       As SldWorks.SldWorks

                  Dim swModel                     As SldWorks.ModelDoc2

                  Dim swSelMgr                    As SldWorks.SelectionMgr

                  Dim swSelComp                   As SldWorks.Component2

                  Dim swCompModel                 As SldWorks.ModelDoc2

                  Dim swFeat                      As SldWorks.Feature

                  Dim bRet                        As Boolean

                  Dim SwPt As MathPoint

                  Set swApp = Application.SldWorks

                  Set swModel = swApp.ActiveDoc

                  Set swSelMgr = swModel.SelectionManager

                  Set swSelComp = swSelMgr.GetSelectedObjectsComponent(1)

                  Set swCompModel = swSelComp.GetModelDoc

                 

                  swModel.ClearSelection2 True

                 

                  Set swFeat = swSelComp.FirstFeature

                  Do While Not swFeat Is Nothing

                      If "OriginProfileFeature" = swFeat.GetTypeName Then

                          bRet = swFeat.Select2(False, 0): Debug.Assert bRet

                          swModel.BlankSketch

                          Exit Do

                      End If

                     

                      Set swFeat = swFeat.GetNextFeature

                  Loop

              End Sub

              '