2 Replies Latest reply on May 2, 2016 11:54 AM by Alfred Jelinek

    InsertRefPlane help

    Alfred Jelinek

      Hello All, thank you for taking the time to possibly help with this...

       

      I am creating a macro that sets up an assembly with subassemblies for designing stamping dies.

       

      One plane I would like to create in a subassembly is a feed height plane that would help define the assembly.

       

      I have tried to fiddle around with setting in a macro I recorded to try and learn more about the settings, but I cannot seem to figure out where the user defined 10.5, 11.0, or 12...etc inch distance is in the command options.

       

      I have looked around on the forums and the API help for VBA code to aid in helping me figure out what each is...

       

      example:

       

      'add feed height plane

      boolstatus = Part.Extension.SelectByID2(JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)

      Part.EditAssembly

      Part.ClearSelection2 True

      boolstatus = Part.Extension.SelectByID2("Top Plane@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      Dim myRefPlane As Object

      Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.2286, 0, 0, 0, 0)

      Part.ClearSelection2 True

      boolstatus = Part.Extension.SelectByID2("PLANE1@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      boolstatus = Part.Extension.SelectByID2("PLANE1@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      boolstatus = Part.Extension.SelectByID2("PLANE1@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      boolstatus = Part.Extension.SelectByID2("PLANE1@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      Part.ActivateSelectedFeature

      boolstatus = Part.Extension.SelectByID2("PLANE1@" + JobNumber.Text + "-Lower_Die_Assy-1@" + JobNumber.Text + "-Main_Die_Assy", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "FEED HEIGHT")

      Part.EditAssembly

      Part.ClearSelection2 True

       

       

      It creates the plane and renames it to "@Feed Height"

       

      but I would like to create a user input box(textbox) where I...or a user can define the shut height plane distance in inches then once hitting a button it creates the plane at that distance...

       

      however.. I cannot find the info that tells me what all this "Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.2286, 0, 0, 0, 0)" defines as I assume that this is the line that defines and inserts the plane....the (8, 0.2286, 0, 0, 0, 0) can't find info anywhere.

       

      Would also like to create an additional macro to then be able to edit that plane distance with a user prompt....change feed height macro...

       

      Thanks for you help!

       

      Al Jelinek

        • Re: InsertRefPlane help
          Deepak Gupta

          Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.2286, 0, 0, 0, 0)

           

          The First constraint has been defined as distance (8). So second value i.e. .2286 (in meters) is the distance value. So putting any value in other units like Inches, MM, etc. you've have to convert them to Meters to be used in the macros.

           

          And in case of angles, convert degree to radians.