algorithmic modeling for Rhino
So I am drawing symmetrical profiles (in the x and y axis) in vb.net and want to mirror them. The problem is, I cannot figure out how to make a copy when mirroring.
I can get the transformation to work, I just can't copy it.
I've tried a couple of different things. I've added each transformation to arrays and lists, but this doesn't work. I tried assigning the transformation at each step to outputs, still nothing. See code below (not actual code, just an outline of what I am doing)
Dim section as New Polyline
add point
add point
add point
etc.
Dim xMirror as New Transform
xMirror = Transform.Mirror(plane, xVector)
yMirror = Transform.Mirror(plane, yVecotr)
Dim list as New List (Of Polyline=)
list.Add(section)
section.Transform(xMirror)
list.Add(section)
section.Transform(yMirror)
list.Add(section)
section.Transform(xMirror)
list.Add(section)
A = list
Each polyline is added, but it looks like the transformation reads back up on the code.
Simple question, how do I mirror a copy?
Tags:
OK. I just figured out one way to do this, but it seems a bit sloppy. I would still like to know if there is a better way to do this...
Dim crvA as New Curve
Dim crvB as New Curve
crvA = section.ToNurbsCurve
section.Transform(xMirror)
crvB = section.ToNurbsCurve
This seems very inneficient.
The following does not work:
Dim plA as Polyline
Dim plB as Polyline
plA = section
section.Transform(xMirror)
plB = section
Any input on this is greatly appreciated.
Matt
Transformations always affect the object they are called on. So if you want to transform a copy, then you first need to create a copy, then transform it:
Dim crvCopy As Curve = originalCurve.DuplicateCurve()
crvCopy.Transform(xMirror)
Don't use ToNurbsCurve to create a copy as you may lose information that way.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
What about polylines? There are no Duplicate methods.
I could use a polyline curve, or a polycurve, but I don't know how to draw those! They require those strange things called IEnumerables. Not sure how to use those, although I am certain they are terribly useful...
Not all types can be duplicated in the same way. Polylines are nothing more than a list of point3d structs with some extra methods on them. You can create a copy using the copy constructor
Dim copy As New Polyline(originalPolyline)
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Wow, that is a lot more simple than what I was going to do!
Thank you!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by