2 Replies Latest reply on Dec 31, 2015 7:10 AM by Yong Ning

    FeatureCircularPattern2→Why don't change Pattern num?

    Yong Ning

      Why don't change Pattern num?   6  change 10 in Circular Pattern.

      0.jpg

       

       

      Option Explicit

       

      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Dim swModelDocExt As SldWorks.ModelDocExtension

      Dim swFeatureMgr As SldWorks.FeatureManager

      Dim swFeature As SldWorks.Feature

      Dim status As Boolean

      Dim warnings As Long

      Dim errors As Long

       

      Sub main()

       

         Set swApp = Application.SldWorks

         Set swModel = swApp.ActiveDoc

         Set swModelDocExt = swModel.Extension

         Set swFeatureMgr = swModel.FeatureManager

         ' Select boss feature to use for circular pattern; selection mark is 4

         status = swModelDocExt.SelectByID2("a-1@Assem1", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)

         Stop

         ' Select axis around which to create circular pattern; selection mark is 1

         status = swModelDocExt.SelectByID2("Axis1", "AXIS", 0, 0, 0, True, 1, Nothing, 0)

         Stop

         ' Create circular-pattern feature

       

         ''Set swFeature = swFeatureMgr.FeatureCircularPattern2(18, Atn(1) * 4 / 8, False, True, False)

         Dim intNumber As Integer

         intNumber = 10

         swFeatureMgr.FeatureCircularPattern2 intNumber, 2 * 4 * Atn(1) / intNumber, False, Empty, False

       

       

      End Sub

        • Re: FeatureCircularPattern2→Why don't change Pattern num?
          Michael Spens

          Hello Young,

          The component and axis mark values are incorrect.  Use 1 for the component mark and 2 for the axis mark when patterning components.  Here are the updated lines for you...

           

             ' Select boss feature to use for circular pattern; selection mark is 1

             status = swModelDocExt.SelectByID2("a-1@a", "COMPONENT", 0, 0, 0, False, 1, Nothing, 0)

             Stop

             ' Select axis around which to create circular pattern; selection mark is 2

             status = swModelDocExt.SelectByID2("Axis1", "AXIS", 0, 0, 0, True, 2, Nothing, 0)

            • Re: FeatureCircularPattern2→Why don't change Pattern num?
              Yong Ning

              Thanks your reply

               

              code is 

               

              Sub main()

                 Set swApp = Application.SldWorks

                 Set swModel = swApp.ActiveDoc

                 Set swModelDocExt = swModel.Extension

                 Set swFeatureMgr = swModel.FeatureManager

                 status = swModelDocExt.SelectByID2("a-1@Assem1", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)

                 status = swModelDocExt.SelectByID2("Axis1", "AXIS", 0, 0, 0, True, 1, Nothing, 0)

                 Dim intNumber As Integer

                 intNumber = 10

                 swFeatureMgr.FeatureCircularPattern2 intNumber, 2 * 4 * Atn(1) / intNumber, False, Empty, False

              End Sub