AnsweredAssumed Answered

Make Lines Endpoints Coincident

Question asked by Giuliano Iodice on Oct 7, 2020
Latest reply on Oct 8, 2020 by Giuliano Iodice

Hello everybody,

In my macro I draw a certain number of consequent lines inside a sketch - with "swSketchMgr.AddToDB = True" to speedup elaboration - so constraints are not placed automatically. Line entities are stored in a vba collection. I would like to make lines endpoints coincident programmatically. 

Here is an excerpt from the code


Dim swSkPt1 As SldWorks.SketchPoint
Dim swSkPt2 As SldWorks.SketchPoint
Set swSkPt1 = gLcoll(1).GetEndPoint2      'gLcoll is the collection of the lines
Set swSkPt2 = gLcoll(2).GetStartPoint2

boolstatus = swSkPt1.Select4 (False, Nothing)
boolstatus = swSkPt2.Select4 (True, Nothing)

swModel.SketchAddConstraints ("sgCOINCIDENT")


Unfortunately this method doesn't apply any constraint

Can anybody help me?

Thank you in advance