Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4120

How to transform returned curve array?

$
0
0

Nathan Coatney wrote:

I'm not sure I am doing this correctly so I thought I would ask here.

Using RhinoPython, I have a list of lines and arcs. I convert to nurbs curves and combine for one list. I then join them together with Rhino.Geometry.Curve.JoinCurves. It works, I think, and it returns an array of curves:

def getShape(self):
    curveList = []
    for line in self.lineList:
        curveList.append(line.ToNurbsCurve())
    for arc in self.arcList:
        curveList.append(arc.ToNurbsCurve())
    joinedCurves = Rhino.Geometry.Curve.JoinCurves(curveList)
    return joinedCurves

The only way I could find to add the array of curves to the document is to step through array and scriptcontext.doc.Objects.AddCurve(curve) for each one. Somehow, the result is a single joined curve in the viewport.

The next thing I need to do is transform this curve, but I can't figure out how to apply a transform to the returned array of curves. I am working around it now by transforming each curve as I add it to the document, but that doesn't seem like the best way to go about it.

shapeCurve = shape.getShape()
            for curve in shapeCurve:
                curve.Transform(moveXform)
                curve.Transform(mirrorXform)
                curve.Transform(rotationXform)
                sc.doc.Objects.AddCurve(curve)

So my question is, after the joining, how do I manipulate the joined curve? How does the document know the array of curves is supposed to be joined? I think if I knew that I could answer the first question.

Thanks!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4120

Trending Articles