Good afternoon!
Task: I want to solve the problem with automatic placement of equipment in the room (in my case - lighting fixtures). For this, I need to know the coordinates of the room’s edges . For this I need to get:
a) The lines of which consist of a room to further obtain the coordinates of the vertices of these lines. Or
b) Coordinates of the room’s edges
Problem: using method of BoundarySegment I get only coordinates of the plane of the floor.
Question: How can I get the coordinates of lines describing a 3D room?
P.S. In LookUP, I found where is located coordinates of the room’s edges, but I could not get them.
import clr
Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *Import DocumentManager and TransactionManager
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManagerImport ToDSType(bool) extension method
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *#The input to this node will be stored in the IN[0] variable.
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Applicationappversion = app.VersionNumber
rooms =
boundaries =collector = FilteredElementCollector(doc)
collector.OfCategory(BuiltInCategory.OST_Rooms)famtypeitr = collector.GetElementIdIterator()
famtypeitr.Reset()output =
for item in famtypeitr:
elmID = item
eleminst = doc.GetElement(elmID)#print eleminst
if eleminst.Area > 0:
room = eleminstboptions = Autodesk.Revit.DB.SpatialElementBoundaryOptions() boundsegs = room.GetBoundarySegments(boptions) boundcurves = [] if app.VersionNumber == 2016: for bound in boundsegs: crvs = [] for seg in bound: crv = seg.Curve() crvs.append(Revit.GeometryConversion.RevitToProtoCurve.ToProtoType( crv, True )) boundcurves.append(crvs) else: for bound in boundsegs: crvs = [] for seg in bound: crv = seg.GetCurve() crvs.append(Revit.GeometryConversion.RevitToProtoCurve.ToProtoType( crv, True )) boundcurves.append(crvs) rooms.append(room) boundaries.append(boundcurves)
OUT = boundaries