cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How do you work out how many segments are in a selected bezier curve and which one has been selected?

TimSharp
12-Amethyst

How do you work out how many segments are in a selected bezier curve and which one has been selected?

I'm doing a macro that gets the user to select a bezier, then changes the line thickness of part of that bezier.

To let me know which segments to change, I need to know two things:

  1. How many segments are in the bezier.Can this be done in a macro using a loop until there are no more segments reported?
  2. Which segment has been selected.

Are these things possible?

The reason for wanting this information is:

When we convert IGES drawings to 2d, it leaves thick lines where bolt heads rest against metal and we change them to thin. Annoyingly, there is always 1 bezier line that needs to be half thick and half thin. I can't predict how many segments these lines have (often 6) or which way round the line has generated, so I'm never sure which segments to change. If I know, for example that the user selected segment 2 of 6, I know to change line thicknesses of the first 3 segments.

2 REPLIES 2

Here's the answer to #1. If you have problems with this, I did do it the long way (loop) first.

Macro PartCount

Define E1 as Element

E1=ActiveDoc.FirstSelectedElement

Message E1.SegmentCount

End Macro

Thanks Trevor. This helps a lot. I guess the only way to know which segment I have actually selected would be to check straight lines between end points of each segment and the one that comes closest to the picked point is it.

Announcements

Top Tags