AnsweredAssumed Answered

How do I write the macro code to give the fillet in the sketch?

Question asked by Pranjal Jamsandekar on Oct 5, 2014
Latest reply on Oct 8, 2014 by Pranjal Jamsandekar

I have tried this code for giving fillet to  corners of the square, but it is not working.

Please tell me were I am going wrong.

 

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSketchMgr As SldWorks.SketchManager

Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSketchMgr = swModel.SketchManager
   
    swModel.Extension.SelectByID2 "FRONT PLANE", "PLANE", 0, 0, 0, False, 0, Nothing, 0
    swSketchMgr.InsertSketch True
   
    swSketchMgr.AddToDB = True
   
    swSketchMgr.CreateLine 0.1, 0.1, 0, -0.1, 0.1, 0
    swSketchMgr.CreateLine -0.1, 0.1, 0, -0.1, -0.1, 0
    swSketchMgr.CreateLine -0.1, -0.1, 0, 0.1, -0.1, 0
    swSketchMgr.CreateLine 0.1, -0.1, 0, 0.1, 0.1, 0
   
    swModel.Extension.SelectByID2 "", "EXTSKETCHPOINT", 0, 0, 0, False, 6, Nothing, 0
    swSketchMgr.FullyDefineSketch True, True, 1023, True, 1, Nothing, 1, Nothing, 0, 0
   
    swModel.Extension.SelectByID2 "Fillet<1>", "SKETCHPOINT", 0.1, 0.1, 0, True, 0, Nothing, 0
    swSketchMgr.CreateFillet 0.01, 1
   
    swSketchMgr.AddToDB = False
End Sub

Outcomes