Line trim\ surface patch

I’m trying to create a surface patch here but im getting error because of curve loops.
SAMPLE RVT.rvt (7.4 MB)

below image is my expected result


Is there any custom node to remove such intersecting lines

Since your automation relies on users selecting lines, why not have them select just the external lines rather than whatever those openings in the interior are?

2 Likes

first i will say as Jacob, but it isnt impossible in your case…here is way thre probably can work in that case


2 Likes

@jacob, that’s a valid question. But unfortunately, we were working in script to club the rooms in respective floors to get a union boundary based on zone values. We won’t be selecting the rooms manually, instead we were collecting all rooms in that project & segregating it based on levels. The scenario shown above is that, assuming some columns were closer to the room boundary, in that cases we were experiencing the challenge of skipping the inner curves, as the exterior curves were in a loop along with the inner one.

hi,
i’m still stammering in python here is
a possibility, provided that an interior segment does not start on an exterior vertex

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
stock_begin=IN[0]
sb=stock_begin
loop_ext=[sb[0]]
sb.pop(0)

for idx,l in enumerate(sb):
    if (loop_ext[0].StartPoint).DoesIntersect(l.StartPoint) or (loop_ext[0].StartPoint).DoesIntersect(l.EndPoint):
        sb.pop(idx)
        loop_ext.append(l)

ind=1
c=0
while c<=len(stock_begin):
    for idx,l in enumerate(sb):
        if loop_ext[ind].StartPoint.DoesIntersect(l.StartPoint) or loop_ext[ind].StartPoint.DoesIntersect(l.EndPoint) or loop_ext[ind].EndPoint.DoesIntersect(l.StartPoint) or loop_ext[ind].EndPoint.DoesIntersect(l.EndPoint) :
            loop_ext.append(l)
            sb.pop(idx)
            ind+=1
    c+=1

OUT = loop_ext

cordially
christian.stan

1 Like

So something like:

  • All Elements Of category > Rooms
  • Room.Boundaries (make sure you use one with the opiton for ‘center line’) to get the perimeter curves of the rooms.
  • PolyCurve.ByGroupedCurves to get PolyCurves from each room
  • Surface.ByPatch to convert the polycurve to surfaces
  • Surface.Area to get the area of each polycurve
  • List.SortByKey to sort the curve lists by the area (largest is last)
  • >= to test if the area is greater than your tolerance (you pay to heat the column if it’s in the room, but if there is a floating closet in the room that closet pays to heat itself).
  • List.FilterByBoolMask to filter the polycurves by the area, thereby removing the ones which are too small
  • List.LastItem to pull the last polycurve from each list
  • Surface.Patch to build a surface from the polycurves
  • Surface.TrimWithEdgeLoops to trim the new surfaces by the associated set of polycurves (before you pulled the last).

If you used the centerline of the room all rooms should abut the adjacent room.

That said, I don’t know if the original poster @vishalghuge2500 is after the same thing as you.

nice…have you tried that on the shared sample file and does it work there??

1 Like

hi,
i will try and let you know
edit:
will not work these lines overlap on some parts (arced areas)
unfortunately not yet competent enough to raise these exceptions

cordially
christian.stan

1 Like

yeah it was my issue to0 when i try thats why i build it up by separation lines…but i will give it take again when have some time, and probably find another way …maybe :wink: :wink:

1 Like


everything that is continuous on the exterior part from the largest segment (assuming it is outside in terms of possible probability)
cordially
christian.stan

1 Like

try closed loops from ampersand and probably some shatter as well…maybe :slight_smile: but absolutly not sure in that situation…im not at dyn more today for try

1 Like

hi
Did you also get an alert message when creating a fictitious room for the roomseparators?

script used


python

import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk 
from Autodesk.Revit.DB import Location,Outline,Line,XYZ,Plane,SketchPlane,Transaction,CurveArray,Level

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

elts=UnwrapElement(IN[0])
doc=elts[0].Document
view=doc.ActiveView


lines=[e.Location.Curve for e in elts]
outl=Outline(lines[0].GetEndPoint(0),lines[0].GetEndPoint(1))
for i in range(1,len(lines)):
    outl.AddPoint(lines[i].GetEndPoint(0))
    outl.AddPoint(lines[i].GetEndPoint(1))
outl.Scale(1.1)
pb=outl.MinimumPoint
ph=outl.MaximumPoint
l1=Line.CreateBound(pb,XYZ(ph.X,pb.Y,pb.Z))
l2=Line.CreateBound(XYZ(ph.X,pb.Y,pb.Z),ph)
l3=Line.CreateBound(ph,XYZ(pb.X,ph.Y,pb.Z))
l4=Line.CreateBound(XYZ(pb.X,ph.Y,pb.Z),pb)
lcont=[l1,l2,l3,l4]
ploc=XYZ(pb.X+1,pb.Y+1,pb.Z)
lines.extend(lcont)
carray=CurveArray()
for l in lines:
    carray.Append(l)
plane=Plane.CreateByNormalAndOrigin(XYZ(0,0,1),pb)
t=Transaction(doc,"Create sp and rb")
t.Start()
sp=SketchPlane.Create(doc,plane)
doc.Regenerate()
mca=doc.Create.NewRoomBoundaryLines(sp,carray,view)
doc.Regenerate()
t.Commit()
OUT =ploc.ToPoint()

Sincerely
christian.stan

Nope but guess you room need number and name

1 Like