Local Cut "Macro"

Hello everyone,

I'm looking to make a piece of code that will make a local cut with a circle where the center of the latter will be placed on the "origin" of the part (see plan)

Thank you in advance for all the answers


mise_en_plan38.pdf

Hello

Have you tried via the macro recorder???  

Yes but in fact my macro creates different axes each time (that's the goal) and the macro recording gives me coordinates and when I select the origin only it gives me this:

boolstatus = Part.Extension.SelectByID2("Point1@Origine@Pièce50-Drawing 1@Vue 1", "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)

And I'd like this point (the original piece) to be the center of my circle for the local cut

Hello

We need more information,

Is the part name in the drawing fixed?
Does your drawing always contain a single piece?
You want to go back to the original point of the play, and that's what seems the most complicated at first glance. Couldn't we have a fixed point in the drawing for the creation of the local section?
Would the depth of the cut be fixed? Indicated by the user? Resumption on a coast?

 

But in any case, after a few tries, it's doable.

The name of the piece changes each time according to the reference, then what is fixed is the center of my life 1 or 2 but it is useless to me.

Then the depth of the cut I don't have to worry about until I know how to  tell my macro this:

- Make a circle Ø14 in the center of the origin of the piece 

-Make a local cut 3.175 deep

 

That's all I need but if I'm looking for this point it's because as the customer length of the part can change each time I need a point that will be the same on each part and as I have a hole on this origin it becomes logical

I found the solution:

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.ClearSelection2 True
Dim SkCircle As Object

 

Set SkCircle = Part.SketchManager.CreateCircle(0.05089546697908, 0.1514160210352, 0, 0.05637302852263, 0.1469609376464, 0)
boolstatus = Part.Extension.SelectByID2("Point1@Origine@Pièce51-Drawing 1@Vue 1", "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Point5", "SKETCHPOINT", 0.05089546697908, 0.1514160210352, 0, True, 0, Nothing, 0)
Part.SketchAddConstraints "sgCOINCIDENT"
Part.SketchAddConstraints "sgCOINCIDENT"
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0.1060269148852, 0.2591576180298, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Arc2", "SKETCHSEGMENT", 0.09157040374567, 0.2475179348306, 0, False, 0, Nothing, 0)
Part.CreateBreakOutSection 0.003175
Part.ClearSelection2 True
End Sub


 Thank you all anyway