2 Replies Latest reply on Feb 3, 2016 10:34 PM by Andre Blanchard

    Macros to put some lines and arcs in a sketch but arcs may or may not get created.

    Andre Blanchard

      The code below is an example of what I am working on.

      If I am zoomed out too far when I run the code the small arc does not get created.

       

      What am I missing?

       

      Thanks

      Andre

       

      ***********************************************************************

      Dim swApp As Object

      Dim Part As Object

       

       

      Const IM = 0.0254

       

       

      Sub main()

      Set swApp = Application.SldWorks

      Set Part = swApp.ActiveDoc

      Dim skSegment As Object

       

       

      Part.SketchManager.AddToDB = True

       

       

      Set skSegment = Part.SketchManager.CreateLine(0 * IM, 1 * IM, 0#, (1 - 0.005) * IM, 1 * IM, 0#)

      Part.ClearSelection2 True

      Set skSegment = Part.SketchManager.CreateLine(1 * IM, 0 * IM, 0#, 1 * IM, (1 - 0.005) * IM, 0#)

      Part.ClearSelection2 True

      Set skSegment = Part.SketchManager.CreateTangentArc((1 - 0.005) * IM, 1 * IM, 0#, 1 * IM, (1 - 0.005) * IM, 0#, 1)

      Part.ClearSelection2 True

       

       

      Part.SketchManager.AddToDB = False

      End Sub

      ***********************************************************************