I am building an add in that will create a series of coordinate systems based on user input. After creation of the UCSs a 3D sketch is created. After the 3D sketch is created a 3D sketch line is placed from each UCS origin to the next. After the lines are drawn set coincident relations from the 3D sketch lines end points to the UCS origins. I cannot figure out how to get ahold of the UCS origins. Specifically, can someone give an example of how to set the coincident relations programmatically to these objects that are created at runtime?
Code posted below...
After further testing it seems the line "Model.Extension.SelectByID2("Coordinate System" & CT + 1 & "\\Point", "COORDSYS", BX, BY, BZ, True, 0, Nothing, 1)" is not actually selecting the coordinate system point. The syntax was based off a macro recording. The sketch point is selected correctly in the previous line. Can someone explain what I am missing?
For CT = 0 To KPList.Count - 1 'Iterate through the KPoints list.
Dim BX As Double = KPList(CT).X 'Declare a local to hold the X component .
Dim BY As Double = KPList(CT).Y 'Declare a local to hold the Y component .
Dim BZ As Double = KPList(CT).Z 'Declare a local to hold the Z component .
Model.ClearSelection2(True)
Model.Extension.SelectByID2("Point" & CT + 1, "SKETCHPOINT", BX, BY, BZ, False, 0, Nothing, 0)
Model.Extension.SelectByID2("Coordinate System" & CT + 1 & "\\Point", "COORDSYS", BX, BY, BZ, True, 0, Nothing, 1)
Model.SketchAddConstraints("sgCOINCIDENT")
Model.ClearSelection2(True)
Next
