Macro insert hole with position mate with a sketch ?

Programming and macros
Max Han
Posts: 3
Joined: Thu Mar 25, 2021 10:06 pm
Answers: 0
x 2

Macro insert hole with position mate with a sketch ?

Unread post by Max Han »

I'm try to build a model macro to do that, insert a center rectangle sketch, then inset hole by HoleWizard5, which hole center mate with the rectangle sketch, so I can change the rectangle size to update hole position. As if I draw the hole manually, In solidworks UI, it would set the coincident automatically, but when I record the macro, this mate would not be recorded.
Is there anyway to create hole and mate with sketch ?
Attachments
Snipaste_2021-05-28_09-46-47.jpg
colt
Posts: 56
Joined: Tue Mar 30, 2021 5:43 pm
Answers: 0
x 14
x 22

Re: Macro insert hole with position mate with a sketch ?

Unread post by colt »

Instead of hover snapping try selecting both using ctrl. Then select coincident. Macro recorder gave me this.

Code: Select all

boolstatus = Part.Extension.SelectByID2("Point3", "SKETCHPOINT", -4.79110246381096E-02, 1.79666342392911E-02, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Point1", "SKETCHPOINT", -3.81263787613125E-02, 2.67390753702125E-02, 0, True, 0, Nothing, 0)
Part.SketchAddConstraints "sgCOINCIDENT"
Post Reply