Hi all, I have created a model and tried to get the surface and line geometry of the walls in a space. However, when there is another wall added not within the space but connected to the wall, the surfaces split.
What I need is to get the lines of the entire wall.
From the diagram below, I have a space with 4 walls but with 5 different surfaces.
I have tried to get the line/curve geometry of all the walls but I kept receiving this error “Unable to create Line. Points are likely coincident”.
Any tips on pasting codes? I can’t seem to post my code properly. I’ve uploaded my python script below.
Is there a simpler method to acquire the geometry lines of a space though?
Thank you very much!
CombineLines.py (1.7 KB)
My code for creating new lines is as shown below.
#Get curves of similiar vectors with same start and end pt
for curve_1 in allcrvs:
curvestartpt_1 = curve_1.StartPoint
curveendpt_1 = curve_1.EndPoint
curvevec_1 = Vector.ByTwoPoints(curvestartpt_1, curveendpt_1)
for curve_2 in allcrvs:
curvestartpt_2 = curve_2.StartPoint
curveendpt_2 = curve_2.EndPoint
curvevec_2 = Vector.ByTwoPoints(curvestartpt_2, curveendpt_2)
curvevec_2_opp = Vector.ByTwoPoints(curveendpt_2, curvestartpt_2)
if curve_1 == curve_2:
continue
if (curvestartpt_1 == curvestartpt_2 or curvestartpt_1 == curveendpt_2 or curveendpt_1 == curvestartpt_2 or curveendpt_1 == curveendpt_2) and (curvevec_1 == curvevec_2 or curvevec_1 == curvevec_2_opp):
if curvestartpt_1 == curvestartpt_2:
newstartpt = curveendpt_1
newendpt = curveendpt_2
elif curvestartpt_1 == curveendpt_2:
newstartpt = curveendpt_1
newendpt = curvestartpt_2
elif curveendpt_1 == curveendpt_2:
newstartpt = curvestartpt_1
newendpt = curvestartpt_2
elif curveendpt_1 == curvestartpt_2:
newstartpt = curvestartpt_1
newendpt = curveendpt_2
else:
pass
newcrv = Line.ByStartPointEndPoint(newstartpt, newendpt)
combcrv.append(newcrv)
counter += 1
#Combine the curves
for combcurve in combcrv:
combcurvestpt = combcurve.StartPoint
combcurveendpt = combcurve.EndPoint
combcurvevec = Vector.ByTwoPoints(combcurvestpt, combcurveendpt)
combcurve_Z = combcurve.Point.Z
for curve in crv:
curvestpt = curve.StartPoint
curveendpt = curve.EndPoint
curvevec = Vector.ByTwoPoints(curvestpt, curveendpt)
curvevec_opp = Vector.ByTwoPoints(curveendpt, curvestpt)
curve_Z = curve.Point.Z
if (combcurvevec == curvevec or combcurvevec == curvevec_opp) and combcurve_Z ==curve_Z:
crv.remove(curve)
crv.append(combcurve)