4 Replies Latest reply on Oct 7, 2015 8:13 AM by Arvind Purushotaman

    Components Pattern

    Arvind Purushotaman

      Hello Guys,


      Can someone please help me with dissolving a pattern in an assembly. I am working on an internship and I need this feature to proceed ahead. Searched in the blog but could not find the right answer.


      My code is as follows:


      Sub main()

      Dim swApp                       As SldWorks.SldWorks

      Dim swModel                     As SldWorks.ModelDoc2

      Dim swfeat                      As SldWorks.Feature

      Dim swComp                      As SldWorks.Component2

      Dim swRootComp                  As SldWorks.Component2

      Dim swConfMgr                   As SldWorks.ConfigurationManager

      Dim swConf                      As SldWorks.Configuration

      Dim partname                    As SldWorks.Component2

      Dim swAssy                      As SldWorks.AssemblyDoc

      Dim swModelDoc                  As SldWorks.ModelDoc2



          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swAssy = swModel

          Set swfeat = swModel.FirstFeature

          Set swConfMgr = swModel.ConfigurationManager

          Set swConf = swConfMgr.ActiveConfiguration

          Set swRootComp = swConf.GetRootComponent3(True)

          While Not swfeat Is Nothing

              If swfeat.GetTypeName2 = "Reference" Then

                  Set swComp = swfeat.GetSpecificFeature2

                  If UCase(Right(swComp.GetPathName, 3)) = "ASM" Then

                     MsgBox "Assembly:" & swComp.Name2

                  ElseIf UCase(Right(swComp.GetPathName, 3)) = "PRT" Then

                     MsgBox "Part :" & swComp.Name2

                  End If

              End If

              If swfeat.GetTypeName2 = "ReferencePattern" Then

                  swfeat.Select (False)


              End If

              Set swfeat = swfeat.GetNextFeature



      End Sub


      Someone please guide me.


      Thank you