algorithmic modeling for Rhino
Hi,
How can I flip the direction of a curve based on the Z value of the start and end point?
The flip based on an example curve is not working to my satisfactory. The direction of all curves should listen to the following rules:
1. from the start to the end point
2. where the Z value of the start point should be below the Z value of the End point.
Is that possible and how?
Cheers,
Bas
Tags:
The easy solution (which perhaps might not work in all cases) is to use a guide curve in the [Flip] component. Create a vertical line that goes up as a guide. Open curve are aligned with the guide using the start->end direction, so I'm guessing that will do the trick. Closed curves are flipped if their orientation is counter, but I think all your curves are open.
Alternatively, a more general solution to "do X only for those items that are like Y" is to use the [Sift]/[Combine] pattern. First get the end-points of each curve and extract the Z coordinate. Use the smaller than or larger than operator on both z values. This gives you a list of booleans. You can use these booleans to [Sift] your curves into two sets, one containing all downwards pointing curves and other all upwards pointing curves. You can then flip only one of these two sets. Finally, put both sets back together using the [Combine] component.
The nice thing about [Sift]/[Combine] is that it preserves the data structure, something which is not possible with [CullXXXX].
Dear David,
The above example shows only open curves (no deck), but I am looking for a solution that also works with semi closed curves (with deck, e.g start and end at the XZ plane), like below picture. That is why the guide curve does not work.
I will give it a go and come back with the result (or questions).
Cheers, Bas
I'm lost, what's a 'semi closed curve'? As long as the two end-points of a curve are not coincident, a curve is considered to be open and it will be treated as a straight line connecting the start and end-point when compared to the guide.
Hello Tom, (and David)
I agree with you that scripting would be easier, but....
Now that grasshopper will be included in V6, I hope that Grasshopper develops in a way that it can be used to parameterize and automate repeating work in Rhino. If Grasshopper functions uses the same naming as in Rhino and work the same, than Grasshopper will be much more intuitive to learn (like Rhino).
And I am hoping for a Rhino Command Help that also shows and explains the alternative command or solution in Grasshopper.
To my opinion grasshopper would be a greater tool if you can avoid scripting more often than it is possible nowadays. You should have the possibility to do both.
Does that make sense?
Makes sense to me, unless you already know how to type in working VB or C#, scripting should be considered a last resort.
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by