Is GetName in ISketchSegment concatenated from GetID and corresponding type, for example
“Line1” = GetName()
1 = GetID()
= >
“Line1” = “Line” + 1
1 Answer
1No, the ID consists of two numbers. See:
https://help.solidworks.com/2018/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISketchSegment~GetID.html
You can set the name of most objects, but not for sketch segments. But you should generally not rely on an object’s name in solidworks. It’s better to use its ID or Persistent ID.
Thank you, 1. I usually use SelectByID to select SketchSegment instead of directly Select. In SelectByID, I will use GetName() to concatenate a final name, but in sw2014, there is no GetName(), only GetID(). I guess there may be a connection between them 2. I have not tried whether Persistent ID can be used with SelectByID
– liuning