I’m struggling to connect these together to create a floor outline. I’m suspecting it’s the curve length that’s causing this issue. Is there a workaround for this? I’ve tried numerous methods including turning it into a surface and extracting the perimeter curves but no luck.
I believe the succeeding issue after that is… how do i create a floor with opening??
Similar topic as this post (Floor By Nested Loops) but it got deviated to filled regions. Multi curveloop has been a struggle to deal with.
# Load the Python Standard and DesignScript Libraries
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.
dataEnteringNode = IN
def direc(curve):#in case if not line(but straight curve)
spt=curve.StartPoint
ept=curve.EndPoint
vec=Vector.ByTwoPoints(spt,ept)
return vec
# Place your code below this line
lines=IN[0]
angle=IN[1]#minimum angle
minlength=IN[2]
points=[]
#collect useful points only
for i in range(len(lines)):
if i<len(lines)-1:
j=i+1
else:
j=0
line0=lines[i]
line1=lines[j]
spt0=line0.StartPoint
spt1=line1.StartPoint
leg=spt0.DistanceTo(spt1)
vec0=direc(line0)
vec1=direc(line1)
ang=vec0.AngleWithVector(vec1)
if ang>=angle and leg>minlength:
points.append(spt1)
#create useful lines
poly0=PolyCurve.ByPoints(points,True)
newlines=Geometry.Explode(poly0)
# Assign your output to the OUT variable.
OUT = newlines
Thanks for the assistance!
Unfortunately, I work with a lot of modelers and line control isn’t their best suit.
Just have to do what we do best. Workaround!
I’ve tried to use the python script but I believe it doesn’t allow for a loop of elements in a L3 list.
Is there a way to tweak for that to work?
Still a bit new to the python environment so… i’m not too sure on how to control the input and output for a looping action.
Another method that I’ve found was to use either Synthesize or Spring node’s simplify to simplify the lines and arcs. That reduced the amount of <1mm lines derived from the closewithline node.
# Load the Python Standard and DesignScript Libraries
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.
dataEnteringNode = IN
def direc(curve):#in case if not line(but straight curve)
spt=curve.StartPoint
ept=curve.EndPoint
vec=Vector.ByTwoPoints(spt,ept)
return vec
# Place your code below this line
lists=IN[0]#multiple lists of lines
angle=IN[1]#minimum angle
minlength=IN[2]
newlists=[]
#collect useful points only
for lines in lists:#run below for each list of lines
points=[]
for i in range(len(lines)):
if i<len(lines)-1:
j=i+1
else:
j=0
line0=lines[i]
line1=lines[j]
spt0=line0.StartPoint
spt1=line1.StartPoint
leg=spt0.DistanceTo(spt1)
vec0=direc(line0)
vec1=direc(line1)
ang=vec0.AngleWithVector(vec1)
if ang>=angle and leg>minlength:
points.append(spt1)
#create useful lines
poly0=PolyCurve.ByPoints(points,True)
newlines=Geometry.Explode(poly0)#each of list of lines
newlists.append(newlines)
# Assign your output to the OUT variable.
OUT = newlists #new list of lists of lines
My last code is for a list contains lists of closed chain lines. like [[l1,l2,l3,l4…],[l11,l12,l13…]]
it will reduce unnecessary points(by measuring angle and length) and return new lines which maintain each chain.