Offset Curve not the sample distance

Hello All. I am trying to create a node to offset lines that are not the same distance, the result is figure 1, is there any way that the result of figure 1 is the same as image number 2? Hope everyone can help. Thanks very much…!



import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
curve = IN[0]
distance = IN[1]

# Place your code below this line
offset = []
for i,j in zip(curve,distance):
	offset.append(Curve.Offset(i,j))
# Assign your output to the OUT variable.
OUT = offset

Unfortunately most programs don’t have a builtin way of achieving this - need to do some geometry gymnastics. I had the same challenge in Grasshopper as well, I’ve attached my method built in Dynamo instead. It involves hyperextending the curves in an offset state and finding the most likely center segment when they’re all split at the intersections. It gets a bit messed up for very distorted shapes. You could also use trigonometry on each corner for a better but more complex outcome (I’m not going to do it, too complex/annoying!).

It uses one method from BiMorph nodes (Curves.IntersectAll).

find inner.dyn (73.2 KB)

3 Likes

Thanks You :heart_eyes: :heart_eyes:

1 Like