How to get selected sketch segment ID and points

I have what I think should be a simple question. I have an open sketch
and a line selected. I want to:
1) Get the ID of the line so I can get back to it later. I've found
code to loop through all of the sketch segments and get their IDs but
that doesn't help me because I don't know which ones they are. I need
to get the ID of the selected line only.
2) Get the start and end points of the line in x and y coordinates. I
found GetStartPoint and GetEndPoint but can't figure out how to use
them.
To me this should be very simple and maybe it is, but I can't seem to
find anything explaining how to do it. Any help will be most
appreciated.
john smith
Reply to
John Smith
Loading thread data ...
get our
formatting link
free, open-source add-in. In the source you'll find an undocumented, unofficial but working trick to get the ID of a sketch segment: the second number of the SketchSegment::GetID result is the number that follows the segment type. This being said, I strongly advise to avoid using SelectByID, and use SketchSegment::Select instead. GetStartPoint and GetEndPoint return SketchPoint objects, which have X,Y,Z properties
Philippe Guglielmetti -
formatting link

Reply to
Philippe Guglielmetti

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.