For some reason the Curve.Offset function in Dynamo/DesignScript does not produce consistent results relative to curve direction. As an example, try drawing lines from the center of a circle to even divisions around that circle - then offset those curves. You’d expect a radially symmetrical figure, but instead it “flips” at a certain point. compare the results between GH and dynamo:
Blue lines are offsets of parts of the centerline. Offset distance is in all cases the same and signed values. The direction of the centerline and the parts that are offsetted is the same (from left to right).
But it is very weird that some lines offset to the wrong side.
@Anton_Huizinga this was fixed in the 2.10 release. If you’re still seeing issues, could you share the Dynamo graph for us to investigate this further?
Attached is a graph and a drawing. It contains an alignment and 4 crossing polylines. The graph reads the geometry of the alignment and the crossings, then the alignment is split at the points in between the crossings with a small cap, and those alignment parts are offsetted. Two of them in the right direction, the other in the opposite direction.
If you fix the offset bug, can you also fix the split bug? Sometimes the last part of a curve is lost after a split. As a workaround I add the endpoint of the curve, as described here:
Thanks @Anton_Huizinga for providing the files to reproduce the issue and for bringing it to our attention. We’ve tracked this internally for now and I’ll let you know if we need any more information from you.
The offset is made in Curve.Normal direction. Whats make sense for me.
Dynamo geometry doesn’t know what is “right” or “left” direction.
One simple approche to solve this is offset curves in both directions and establish some creteria to choose the “correct” side. For instance, using a point on the correct side and filter curves that are more close to it.
For closed curves simply use Polycurve.Offset node.
The offset accepts a negative value to offset to left and positive to right. The PolyCurve direction is the same for all segments. So it is obviously a bug when some PolyCurves are on the wrong side. If you see the screenshot the first and last segment have the same normal but still they are on opposite sides.
Sure we can find workarounds for all bugs, but I would appreciate a fix.
@Anton_Huizinga to fix this we have introduced a new Offset node that takes an additional normal input that defaults to the 2D curve’s plane normal (we support offsets for only 2D curves). This default normal can be overridden using a user-supplied normal that is parallel to the curve’s plane normal, either facing the same direction as the plane normal or facing the opposite direction. The normal direction will control the offset direction of the curve(s). It is especially useful to supply a user input normal in your workflow so that you can have all the split curves offset in a consistent direction as long as they share the same plane.
Note that this node will be available in a future release of Dynamo, 2.15 or higher.
This has been a frustrating issue for quite awhile, so it’s great to hear about a true solution that isn’t another workaround. Thanks for the fix @Aparajit_Pratap, and thanks for following it through @Anton_Huizinga!
How do I manipulate the planenormal input? It appears to be looking for a vector but I am having difficulties getting a consistent output. The signedDistance input will offset the curve vertically or along the Z axis. When I add X or Y axis to the planenormal input it will select elements along those planes but the offset is still vertical. I need to offset the curve parallel to it’s origin.
FWIW, my script worked fine with the previous curve.offset node that has been decommissioned.
@bgarcia668JC if you can share your curve or more preferably, share your graph, I can help you more specifically. However, I can try to explain a little better how the new Curve.OffsetMany node is expected to work. In the attached image, the curve in black is the original curve lying on the XY plane that has been offset to the curve in blue using a default signed distance of 1.0. Marked here are the curve tangent, normal, and offset directions. In this example, the default plane normal is the same as the curve normal pointing toward the negative Z axis (as there is no user-provided normal). The offset direction at any point on the curve is computed using a cross-product of the tangent vector at that point with the plane normal. The offset curve in this case can be switched to lie on the right side instead by either providing a negative signed distance or by reversing the plane’s normal direction to point in the positive Z-axis. The latter can be done by the user providing an explicit plane normal equal to the Z-axis vector. I hope this explanation makes it a bit clearer. If not, please share your example with me and I’ll try to explain it in that context, i.e., if there’s no bug with your example.
Thank you for the reply. I am attaching the graph with an example.
Basically I am taking the sketch of a floor and placing beams at the edges. Since beam placement defaults to origin/ center, I have to add an offset so that the outside face of the beam aligns with the outside face of the floor. With the previous curve.offset node, it was straight forward, but now the curve.offsetmany node adds an element that I am not grasping how to correct it.
@bgarcia668JC apologies for the late response. I’m still unclear about your example. Is your floor sketch (what looks like a square in the right image) a single polycurve or is it 4 straight lines joined end to end? If so, would it be possible for you to create a polycurve from the 4 lines and then offset them? Does the offset you’re expecting look like the one in the image below? Note that in my example, I’m offsetting a polycurve (rectangle).