Topic - Convert edges to curves script (NOTE: slow!!)

Hi!

Inpsired by the recent render curves postings here, I have tried to cobble together
a script that will convert edges to curves. However it is a little slow but
I do not have time to look at how to speed it up so I am putting it here
in case anyone else wants to muddle with it.

Copy the script below into a text file and save it as "Edges2Curves.pl".
Just select a bunch of edges (I would suggest less than 100 to start with)
and locate and run the script using the "Run script" dialog from modo's System menu.

#! perl

if( !lxq( "select.typeFrom {edge} ?" ) ) {
    die( "Edges2Curves.pl: Please select one or more edges" );
}

$layer = lxq( "query layerservice layers ? main" );

my @edges = lxq( "query layerservice edges ? selected" );
if( $edges == -1 ) {
    die( "Edges2Curves.pl: Please select one or more edges" );
}

for( $i=0; $i < $#edges+1; $i++ ) {
    $edge = $edges[$i];
    @verts = lxq( "query layerservice edge.vertList ? $edge" );
    @vs = (@verts);
    $vstring = join( " ", @vs );
    @vlists = (@vlists, $vstring);
}

lxout("Edges2Curves: $i edges stored!");

$i=0;

foreach $varray ( @vlists ) {
    @vs = split( / /, $varray );

    lx( "select.drop vertex" );
    foreach $v (@vs) {
        $i++;
        lx( "select.element layer:$layer type:vertex mode:add index:$v" );
    }
    lx( "poly.make curve" );
}

lx( "select.type edge" );


lxout("Edges2Curves: $i vertices converted!");



Let me know what you guys (and gals) think!!

Cheers

John

Message edited by John Rafferty on 7/1/2009 - 3:00 AM

hi

thanks for sharing

regards
Laurent
nice!
maybe check "JJ Edge to Curve" from Julian Johnson :
http://vertexmonkey.com/downloads/modeling/create/jj_edgeToCurve.zip

I'm not sure if it works with modo 401, coz it's written for 201

regards.
Das Link is broken. Relink please? I'm interested in getting edges into curves for the render curve option.

-Insert witty one-liner here-

And big thanks to LuxLucid/John Rafferty for the script bones, will be trying these for some Arch Viz work!

-Insert witty one-liner here-

Quote from DaBo :
nice!
maybe check "JJ Edge to Curve" from Julian Johnson :
http://vertexmonkey.com/downloads/modeling/create/jj_edgeToCurve.zip

I'm not sure if it works with modo 401, coz it's written for 201

regards.


Works fine in 401. Though the annoying thing is that sometimes the curves are upside down and you have to flip them to get the "Roots" all at the same end.

Anyone who can improve on that, it'd be appreciated.
Thanks for your script(Convert edges to curves)!
I used it in 501,OK!
I love it indeed......
I had a bit of trouble with this script. It made one curve for each edge I had selected. I wanted it to make one continues curve with multiple points. I don't know if I am using it wrong or what. But I got the jj script people mentioned and it works. i did have to flip my curves after, but thats not hard. just press f. here is a link:

http://www.exch.demon.co.uk/jj_modoscripts.htm