API, retrieving names of sketch entities.

Hi,

Can anyone tell me how to obtain the names (e.g. Point1, Line3, Spline2, etc...) of the sketchsegments in an active sketch. SolidWorks shows this information when right-clicking on a sketchsegment. However, I don't seem to find any API-function which gives me that info. I need these names for use with SelectByID2. Any help is greatly appreciated!

Thanks, Tony

Reply to
Tony Van De Velde
Loading thread data ...

I would think you could use the Sketch.GetSketch segments call to get a handle to sketch segments in the sketch. Then, you can just iterate through those to get the names.

Evan

Reply to
Evan T. Basalik

Yes, I also thought it was that simple. But sadly enough the interface SketchSegment doesn't seem to have a function GetName or something like that. Or I'm not seeing it? It has GetID but that gives me two integers and that's not what I'm searching for.

Thanks, Tony

"Evan T. Basalik" schreef in bericht news:BZfvd.70000$ snipped-for-privacy@bignews3.bellsouth.net...

sketchsegment.

Reply to
Tony Van De Velde

Are you selecting segments that you created durring the running macro or created before hand. How are you going to know wether you want Line1, Line2 or Line15. I ask because there may be another way to select the appropriate line without the SelectByID.

Corey

Reply to
CS

I am selecting existing segments created outside a macro. Let me explain the situation. We're programming an addin using C#. This addin helps us to create aluminium constructions (conservatories). One point of our design is the creation of the roof panels. The sketch which defines the roof panel must be dimensioned. Therefore I need to select sketchpoints and sketchsegments (lines). I was going to use the API-functions SketchPoint.Select4 and SketchSegment.Select4, but these are flawed when using in-context. I have reported this to SW and they've issued SPR's. However, I am trying to work around the problem. That's why I'm trying to use SelectByID. This function works correctly, but only when I can give the sketch entity name as a parameter. Unfortunately, there doesn't seem to be a way to retrieve that name. I hope this clarifies the situation a bit.

Regards, Tony

"CS" schreef in bericht news: snipped-for-privacy@individual.net...

Reply to
Tony Van De Velde

A stab in the dark but if you use Sketch.GetLines2 and assume that the first segment in the safe array would be Line1 and the second Line2, or more likely ID has something to do with the number. If I had time I would test some code for you but I just don't today.

Corey

Reply to
CS

Hi Try SketchSegment::GetID this gives you a uniq couple of numbers ,associated with the type of segment, which corresponds to the number you see in the selection.

regards

dudi peer

Reply to
dudi

Yes, this does the trick. Thanks to you all for your input !!

Regards, Tony

"dudi" schreef in bericht news: snipped-for-privacy@f14g2000cwb.googlegroups.com...

Reply to
Tony Van De Velde

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.