PDA

View Full Version : Need a script...


Jorge Arango
08-20-2010, 01:23 PM
Unfortunately I don't have enough COFFEE knowledge to code it myself. This script would reorder the points in a messed up spline:

1. You select an open spline in point mode and select one of the end points.
2. The script converts this point to point zero. The command Set First Point doesn't always work. What I do manually, in the structure manager, is to select this point and drag and drop it to position zero.
3. It will search all the points and find the one nearest to point number zero and convert it to point 1 (move its position in the structure manager to 1).
4. It will search all the points except for number zero and find the one nearest to point number one and convert it to point 2.
5. And so on with all the points, excluding the points already reordered.

I know this won't work with some splines, for instance some zig zag splines but it would save me a lot of work in most cases.

I would use this with some splines that I get with the edge to spline command and sometimes with imported .dwg drawings.

Here is an example of a tangled spline:

Scott Ayers
08-20-2010, 04:24 PM
Hi Jorge,

Maybe I'm just not "with it" today. But I'm confused about the exact kind problem you're having and the end result you're trying to achieve.
The example you posted does look messed up. But only because lots of the points are stacked on top of each other. Giving the illusion that their point order is messed up.

When you say a "messed up spline" what exactly is messed up about it?
Could you also explain more what the end result is you're looking? Are you trying to straighten it? Or maybe fix the points that are overlapping each other?

-Scott

Jorge Arango
08-20-2010, 04:56 PM
Hi Jorge,

Maybe I'm just not "with it" today. But I'm confused about the exact kind problem you're having and the end result you're trying to achieve.
The example you posted does look messed up. But only because lots of the points are stacked on top of each other. Giving the illusion that their point order is messed up.

When you say a "messed up spline" what exactly is messed up about it?
Could you also explain more what the end result is you're looking? Are you trying to straighten it? Or maybe fix the points that are overlapping each other?

-Scott

Thank you for your reply Scott, here's a better example of a messed up spline and the result after manually ordering the points. Hope it's clearer with this example.

afffa
08-20-2010, 05:16 PM
hey,

here's a script that does what you need, i guess.
It doesn't start from the selected point though. You'd need to move the point you want to have as the first one to the top in the Structure Manager

Scott Ayers
08-20-2010, 06:09 PM
That's a cool script Tobias,
Do you mind if I add that (with your name on it of course)to the Coffee Bible?

Do you really need the EventAdd() function at the end?
It seems to work fine without it.

-ScottA

afffa
08-20-2010, 06:16 PM
sure, just add it ;)

yes, the EventAdd should be obsolete i guess.

Jorge Arango
08-20-2010, 06:47 PM
It's working like a charm! Thanks Tobias!

CGTalk Moderation
08-20-2010, 06:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.