AnsweredAssumed Answered

API How instert a keyway in the center of a selected cylindrical face.

Question asked by Dawid Kozakiewicz on Sep 21, 2020

Hello, I have problem with inster a keyway in my shaft. Description of the problem presented in the photo.
I tried to do this by adding a centerline and combining it with (line 1 or 2 or 3 or 4 or 5)  in the middle of this line, but the program sometimes found this midpoint and sometimes it didn't. So  i tried to try the way also to no avail. 
My piece of the program below.



If UstawRowek1.Value = True Then
swDoc.Extension.SelectByID2 "Point7", "SKETCHPOINT", 2.22297853542356E-02, 2.10853925102473E-03, 0, False, 0, Nothing, 0 'Point in middle of keyway
swDoc.Extension.SelectByID2 "Point38@Szkic2", "EXTSKETCHPOINT", -0.0245, 0.004, 0, True, 0, Nothing, 0 'Marked line 1
swDoc.SketchAddConstraints "sgVERTICALPOINTS2D"
swDoc.ClearSelection2 True
swDoc.Extension.SelectByID2 "Line2", "SKETCHSEGMENT", -2.30660598093664E-02, 3.09793387845048E-03, 2.53037658956146E-03, False, 0, Nothing, 0 'Keyway line in center
swDoc.Extension.SelectByID2 "Line48@Szkic1", "EXTSKETCHSEGMENT", -2.46209557158181E-02, 0, 0, True, 0, Nothing, 0 ' Axis shaft line
swDoc.SketchAddConstraints "sgCOLINEAR"
swDoc.ClearSelection2 True

End If

Sorry for my English.
Thanks for any help.