Hi Everyone,
I'm new here and trying to get started with Macros. It doesn't seem too bad, but I am stuck. I have tried numerous different things similar to this and am not getting the results I expect. Can someone take a look at this and see what I'm missing? I'm expecting two circles in 3D (kind of forming a sphere outline) but it will only draw one of the circles. skSegment comes back Nothing when the circle doesn't draw. But, when I am screwing with the code (shotgunning for a clue) every once in a while it will draw both circles. So then I don't touch it and run the code again... and now my second circle is gone again! I'm confused!
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
Part.SketchManager.Insert3DSketch True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.062093, -0.070302, 0#)
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0#, -0.044912, -0.089485)
Part.ClearSelection2 True
Part.SketchManager.InsertSketch True
End Sub
Any help is greatly appreciated!
JamesSolidworksApi macros

I'm new here and trying to get started with Macros. It doesn't seem too bad, but I am stuck. I have tried numerous different things similar to this and am not getting the results I expect. Can someone take a look at this and see what I'm missing? I'm expecting two circles in 3D (kind of forming a sphere outline) but it will only draw one of the circles. skSegment comes back Nothing when the circle doesn't draw. But, when I am screwing with the code (shotgunning for a clue) every once in a while it will draw both circles. So then I don't touch it and run the code again... and now my second circle is gone again! I'm confused!
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
Part.SketchManager.Insert3DSketch True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.062093, -0.070302, 0#)
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0#, -0.044912, -0.089485)
Part.ClearSelection2 True
Part.SketchManager.InsertSketch True
End Sub
Any help is greatly appreciated!
JamesSolidworksApi macros