5 Replies Latest reply on Apr 2, 2018 1:38 AM by Prabaharan Pichaiyan

    insert circle on mid point of the line

    Prabaharan Pichaiyan

      I want to create a sketch over selected surface and offset line from selected edge. And I need to draw a circle in mid point of that line.

      I tried below codes,

      ' select Edge First
      ' Select Face second
      Option Explicit
      Sub main()
          Dim swApp As SldWorks.SldWorks
          Dim swModel As SldWorks.ModelDoc2
          Dim swSelMgr As SldWorks.SelectionMgr
          Dim swEdge As SldWorks.Edge
          Dim swFace As SldWorks.Face2
          Dim swSelData As SldWorks.SelectData
          Dim swSelData2 As SldWorks.SelectData
          Dim boolstatus As Boolean
          Dim swSketchManager As SldWorks.SketchManager
          Dim status  As Boolean
          Dim swEnt As SldWorks.Entity
          Set swApp = Application.SldWorks
          Set swModel = swApp.ActiveDoc
          Set swSelMgr = swModel.SelectionManager
          Set swEdge = swSelMgr.GetSelectedObject6(1, -1)
          Set swSelData = swSelMgr.CreateSelectData
          Set swEnt = swEdge
          swSelData.Mark = 1
          Set swFace = swSelMgr.GetSelectedObject6(2, -1)
          Set swSelData2 = swSelMgr.CreateSelectData
          swSelData2.Mark = 2
          Set swSketchManager = swModel.SketchManager
          swSketchManager.InsertSketch True
          swModel.ClearSelection2 True
          status = swEnt.Select4(True, swSelData)
          'boolstatus = swSketchManager.SketchUseEdge3(False, False)
          boolstatus = swModel.SketchOffsetEntities2(0.001, False, False)
          swModel.Extension.RunCommand swCommands_Edit_Select_All, ""
          swSketchManager.InsertSketch True
          swModel.ClearSelection2 True
         End Sub


      I have 2 problems,



      1. offset is not always same side. are we able to fix that?

      2. I found a way up to get a mid point, but I don't know how to create circle on that point.


      Could any one help with this?