To keep my geometry manageable and performant, I want to offset my curves with a tolerance value (as to not get too many control points per curve). So I found David Rutten’s Offset Curve with Tolerance component on the old forums (Wish: Curve Offset Tolerance in Component - Grasshopper) and managed to rename the component’s inputs (I like components to display full names).
Anyways, looking at the Rhinocommon curve offset documentation, I saw a direction point, angle tolerance, loose and corner- and endstyle options that I would also like to use.
I have no clue how to proceed, could someone help me with this? I’d like to have the full-blown Offset Curve component with all features, incl. a Both Sides option like in Pufferfish (to offset in negative direction by default).
Here’s what I have now, unfortunately, I can’t seem to get the EndStyle working to begin with. Offset Curve C#.gh (11.6 KB)
E: If Visual Basic works better, that’s also fine by me. I don’t know either language.
If you are working in Rhino WIP, the C#/Python/VB.NET scripting component have been changed to a new scripting component, so the old C# script would become old. Still, it should work.
However I do see an error in the last line of the red component, there is a comma that has nothing to do here.
Guess that was due to it being a WIP back then. I removed the comma and commented text, because I couldn’t get the script to work without spending a couple of days on learning C#
Yes, that seems to fix it.
Considering the input names change when I save ths component as a user component, I think I’ll be looking into making this into a proper component following the guides in the 2nd post.
But before I do that @magicteddy do you happen to be able to add a both sides distance input, so I could offset a centreline in both directions and cap the result? Just like Pufferfish’s offset component? Then I can make it into an offset on steroids component to distribute in this topic
Thank you for your help this was one of the components I wanted to have for a couple years already.
There is no direct BothSides option in any of the Offset signatures, so that would have to be done by hand (probably what Pufferfish does is offset by x then offset back by x+y with the cap options).
I also noticed Loose option doesn’t work with caps, whereas the Rhino command does.
So I think it would be best to also build the caps manually.
I’ll look into that… when I have more time.
Do you need the Loose option ?
And Pufferfish has continuity options for capping, but not a simple half circle.
I don’t necessarily need the loose option for my current project. And indeed, Pufferfish does seem to have been customly scripted for the both sides option. What it doesn’t do is always make the second distance input a negative value, so it is actually moved to the other side of the curve.
In other words:
Distance = x
Both Sides = -x (I always have to add an expression to the input for this or a negative before my input)
As for caps, I only really need the end points connected when I offset to both sides, anything else is a nice to have.
Well, let’s call the component Magic Curve Offset or offset curve with tolerance
Depending on the output, you need to add a list item to connect the first set of curves and the second set of curves. When there are more distances supplied, you’ll need to do sorting. So at least 2 additional components if you have to use connect curve ends (indicated by the arrow). The one up top is connect curves.
Really cool!, I’ll check it out first thing tomorrow, but do already want to leave a thank you message!
Thanks, this will help me build a lot of cool scripts! Also, a good tip, by lowering the tolerance during the conceptual stage, you can easily shave off half of the computation time for the offset. That’s why I wanted it so badly. It’s the difference between live updates and sluggish updates (with very control point bloated splines)