Hi Community,

I was trying to create filled region from cad link but im getting an error.heres the progress.

Thank you.

Hi Community,

I was trying to create filled region from cad link but im getting an error.heres the progress.

Thank you.

1 Like

Just luckily solved it myself if anyone has the same issue hereâ€™s my solution

Python

```
# Assign curves to groups according to whether they are connected via shared start points and end points. Group numbers are not important.
# Colin McCrone, 2015-09-28
import clr
import math
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Determine whether two points are equal
def PointsEqual(pt1, pt2):
tolerance = 0.00001
if (math.fabs(pt1.X - pt2.X) < tolerance and
math.fabs(pt1.Y - pt2.Y) < tolerance and
math.fabs(pt1.Z - pt2.Z) < tolerance):
return True
else:
return False
# Get input
crvs = IN[0]
# List the group to which each curve belongs
crvGroup = [-1 for x in range(len(crvs))]
crvGroup[0] = 0
maxGroupNum = 1
# Find start and end points for each curve
starts = []
ends = []
for crv in crvs:
starts.append(Curve.PointAtParameter(crv,0))
ends.append(crv.PointAtParameter(1))
# Find connected groups of curves
for i in range(len(crvs)):
# Add i to its own group it not already part of a group
if (crvGroup[i] == -1):
crvGroup[i] = i
# Find connections
for j in range(len(crvs)):
if (i != j and
(PointsEqual(starts[i], starts[j]) or
PointsEqual(starts[i], ends[j]) or
PointsEqual(ends[i], starts[j]) or
PointsEqual(ends[i], ends[j]))):
# Add j to i group
if (crvGroup[j] == -1):
crvGroup[j] = crvGroup[i]
# Add j group to i group
elif (crvGroup[i] != crvGroup[j]):
oldNum = crvGroup[j]
for k in range(len(crvs)):
if (crvGroup[k] == oldNum):
crvGroup[k] = crvGroup[i]
# Output the (arbitrary) group numbers
OUT = crvGroup
```

1 Like

Python Nodes Basics