Here's a script that I made that I use when I need nicely spaced curve
points:

si = Application
 def frange(x, y, jump):
    '''    Like range() but with float values.    '''
    while x < y:
        yield x
        x += jump
 def evenPositions(crv, quantity):
    '''    Get an amount of evenly spaced positions on a given curve.    '''
    subcrv = crv.ActivePrimitive.Geometry.Curves(0)
    percs = [num for num in frange(0.0, 100.0, 100.0 / quantity)]
    percs.append(100)
    ppos = [ subcrv.EvaluatePosition(
subcrv.GetUFromPercentage(percs[i]) )[0] for i in xrange(len(percs)) ]
    return ppos
 def main():
    size = float( Application.XSIInputBox("What spacing do you want
between points, in XSI units?", "Spacing?", 1) )

    newCurves = []
    si.OpenUndo("Make evenly spread linear curves")
    for crv in si.Selection:
        quantity = int(crv.ActivePrimitive.Geometry.Curves(0).Length / size)
        positions = evenPositions(crv, quantity)

        positions = ["(%s,%s,%s)" % (a.X,a.Y,a.Z) for a in positions]
        newCurve = si.CreateCurve( 1, 0, ",".join(positions), False)('Value')

        newCurve.Name = crv.Name+'_evenlySpaced'
        newCurves.append(newCurve)
    si.SelectObj(newCurves)
    si.CloseUndo()

main()




On Fri, Aug 2, 2013 at 11:26 AM, Ponthieux, Joseph G. (LARC-E1A)[LITES] <
[email protected]> wrote:

> Rob,
>
> Yeah, its turns out that this might be a far more reliable method than
> what I was trying to accomplish. I guess I'll have to make a copy of every
> curve, but there are far fewer curves than objects or strands. This might
> solve the problem nicely.
>
> Thanks
>
> --
> Joey Ponthieux
> LaRC Information Technology Enhanced Services (LITES)
> Mymic Technical Services
> NASA Langley Research Center
> __________________________________________________
> Opinions stated here-in are strictly those of the author and do not
> represent the opinions of NASA or any other party.
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Rob Chapman
> Sent: Friday, August 02, 2013 9:16 AM
> To: [email protected]
> Subject: Re: Convert curve to linear
>
> yes!  create > curve > fit on curve
>
>  I was going to suggest it earlier but your point 3. requirements said it
> must fit with *any* curve :)
>
> change to degree linear, subdivision high and untick maintain discontinuity
>
>
>
> On 2 August 2013 15:11, Ponthieux, Joseph G. (LARC-E1A)[LITES] <
> [email protected]> wrote:
> > Is there in any way in Soft to convert a NURBS curve of any shape, to
> > a high density linear curve with equidistant points?
> >
> >
> >
> > --
> >
> > Joey Ponthieux
> >
> > LaRC Information Technology Enhanced Services (LITES)
> >
> > Mymic Technical Services
> >
> > NASA Langley Research Center
> >
> > __________________________________________________
> >
> > Opinions stated here-in are strictly those of the author and do not
> >
> > represent the opinions of NASA or any other party.
> >
> >
>
>

Reply via email to