2 Replies Latest reply on May 31, 2016 9:25 AM by Adam Seremak

    Skeching - disable attracting?

    Adam Seremak


      I'm looking for option to "disable attracting in sketching". I don't know exactly how to say it in English so I prepared a sample macro to illustrate this issue.

      Few sentences of introduction:

      When you draw a line in sketch and want to pick line's end point near existing sketch segment, then the end point is attracted to existing sketch segment. So it is impossible to draw a new point very close to existing sketch segment. It is always placed on existing sketch segment.


      Below you can find a macro that should create 3 circles. Radius of each circle should be bigger by OFFSET value than previous one.

      Please run it with OFFSET = 0.005 and again with OFFSET = 0.0005 and compare results.

      For OFFSET = 0.005 it will create 3 circles. Radius of each circle is bigger by 0.005 than previous - and this is what I've expected.

      For OFFSET = 0.0005 it will create 3 equal circles. They are equal because of point attracting.


      Do you know how to disable point attracting in sketches?


      Const OFFSET = 0.005

      'Const OFFSET = 0.0005


      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

      Part.SketchManager.InsertSketch True

      Dim vSkLines As Variant

      vSkLines = Part.SketchManager.CreateCornerRectangle(0, 0, 0, 0.1, 0.1, 0)

      Dim myFeature As Object

      Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.005, 0.005, False, False, False, False, 1.74532925199433E-02, 1.74532925199433E-02, False, False, False, False, True, True, True, 0, 0, False)

      Part.ShowNamedView2 "*Trimetric", 8


      boolstatus = Part.Extension.SelectByID2("", "FACE", 3.26141878429098E-02, 4.43513142504912E-02, 4.99999999988177E-03, False, 0, Nothing, 0)

      Part.SketchManager.InsertSketch True

      Dim skSegment As Object

      Set skSegment = Part.SketchManager.CreateCircleByRadius(0.05, 0.05, 0#, 0.01)

      Set skSegment = Part.SketchManager.CreateCircleByRadius(0.05, 0.05, 0#, 0.01 + 1 * OFFSET)

      Set skSegment = Part.SketchManager.CreateCircleByRadius(0.05, 0.05, 0#, 0.01 + 2 * OFFSET)

      Part.SketchManager.InsertSketch True

      End Sub