3 Replies Latest reply on Jan 13, 2015 4:24 PM by Arthur Loginow

    Help understanding simple Macro

    Arthur Loginow

      Hello, I am starting with macros, so far I recorded the extrusion of a circle, however there is some things that I don't understand, I would like to know: Where can I find the reasons of this? To make myself clear, why do I have to use all those arguments then I am selecting a Plane, I understand that "Front Plane" is the name, "Plane" is the property, 0,0,0 is the location but what are the False, 0, Nothing, 0 about? Where can I read about it? I guess I am not able to use the API help the way I am suppose. Here is the macro

       

      Dim swApp As Object

      Dim Part As Object
      Dim boolstatus As Boolean
      Dim longstatus As Long, longwarnings As Long

      Sub main()

      Set swApp = _
      Application.SldWorks

      Set Part = swApp.ActiveDoc
      boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      Part.SketchManager.InsertSketch True
      Part.ClearSelection2 True
      Dim skSegment As Object
      Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.046557, 0.062358, 0#)
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 6.01007071343555E-02, 5.10714929169876E-02, 0, False, 0, Nothing, 0)
      Dim myDisplayDim As Object
      Set myDisplayDim = Part.AddDimension2(0.117379784825784, -1.69297766575649E-03, 0)
      Part.ClearSelection2 True
      Dim myDimension As Object
      Set myDimension = Part.Parameter("D1@Sketch1")
      myDimension.SystemValue = 0.127
      Part.SetPickMode
      Part.ClearSelection2 True
      Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.01934, 0.032233, 0#)
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 1.24328929866614E-02, 0.034305575092825, 0, False, 0, Nothing, 0)
      Set myDisplayDim = Part.AddDimension2(7.96626106182378E-02, -1.15119379506123E-03, 0)
      Part.ClearSelection2 True
      Set myDimension = Part.Parameter("D2@Sketch1")
      myDimension.SystemValue = 0.0762
      Part.SetPickMode
      Part.ClearSelection2 True
      Part.SketchManager.InsertSketch True
      Part.ShowNamedView2 "*Trimetric", 8
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 4, Nothing, 0)
      Dim myFeature As Object
      Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 6, 0, 0.508, 0.00254, False, False, False, False, 1.74532925199433E-02, 1.74532925199433E-02, False, False, False, False, True, True, True, 0, 0, False)
      Part.SelectionManager.EnableContourSelection = False
      Part.ClearSelection2 True
      Part.SetPickMode
      End Sub