3 Replies Latest reply on Mar 26, 2018 10:27 AM by Mike Flanders

    controlling feature instances with a form

    Mike Flanders

      I have been trying to develop a form to build my part models. I cant seem to figure out how to add a value in a combobox and have it control the circular pattern instances count of a pre-built feature. Anyone able to help get me started? I can change the feature names and such. I have it doing a circular pattern around a pre-built axis called "Centerline Axis".

      the feature is called "Straight Flute Pattern"

      the txtbox is named "flutecountCMBBOX"

       

      instances.JPG

        • Re: controlling feature instances with a form
          Michael Spens

          Hey Mike,

          I'd recommend recording the actions you're trying to automate.  Record each as separate macros so there isn't as much code to sort through.  For example, recording editing a circular pattern dimension gives you something like this...

           

          boolstatus = Part.Extension.SelectByID2("Thru Hole Pattern@Thru Holes Pattern@#Hybrid Model.SLDPRT", "DIMENSION", -0.022398185459952, -2.42895699770917E-02, -3.45289039412515E-02, True, 0, Nothing, 0)

          Dim myDimension As Object

          Set myDimension = Part.Parameter("Thru Hole Pattern@Thru Holes Pattern")

          myDimension.SystemValue = 2

          boolstatus = Part.EditRebuild3()

           

          You can delete all of the SelectByID2 operations.  The important part is setting myDimension to a Parameter by name.  Then set it's SystemValue (in meters, so use some conversion in your code as needed), and then a rebuild.

           

          Get the pattern count from your form like you're doing with your other fields, use CDbl to convert the string value into a Double.

          Dim patternCount As Double

          patternCount = CDbl(flutecountCMBBOX.value)

           

          Then use that variable on your call to set the SystemValue.

           

          Mike