Maybe, I create this topic not first, but I’ve a problem: I need to create spaces by architects rooms, and I tired) I finded a dynamo script (whith Python), but it’s work only on small project. As example: if you have 2 linked files (AR) in HVAQ’s model and AR’s models insert in consolidated file by shared coordinates - this script doesn’t work. My python is not so good to create code, but I can find a problem in existing code. Author of this script used coordinates XYZ to finded rooms, but all of linked files (AR model) create at point 0.0.0 (I mean intersection point of axis A and 1).
Maybe someone have working script??? Or someone can help me with this code??? Please, help!!!
from math import *
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
from System.Collections.Generic import *
links = FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.RevitLinkInstance).ToElements()
linkdocs = 
for i in links:
linkrooms = 
for linkdoc in linkdocs:
levels = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()
old_spaces = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_MEPSpaces).WhereElementIsNotElementType().ToElements()
for g_rooms in linkrooms:
for room in g_rooms:
for room in rooms:
pt = room.Location.Point
for space in old_spaces:
y = space.IsPointInSpace(XYZ(pt.X,pt.Y,pt.Z+1))
uv = UV(pt.X,pt.Y)
elev = round(room.Level.Elevation)
level2 = None
for level in levels: elev2 = round(level.Elevation) if elev==elev2: level2=level if level2 is not None: name = room.get_Parameter(BuiltInParameter.ROOM_NAME).AsString() number = room.get_Parameter(BuiltInParameter.ROOM_NUMBER).AsString() height = room.get_Parameter(BuiltInParameter.ROOM_UPPER_OFFSET).AsDouble() space = doc.Create.NewSpace(level2,uv) space.get_Parameter(BuiltInParameter.ROOM_NAME).Set(name) space.get_Parameter(BuiltInParameter.ROOM_NUMBER).Set(number) space.get_Parameter(BuiltInParameter.ROOM_UPPER_OFFSET).Set(height) list.append(space)
OUT = list
Code.txt (2.4 KB)
It’s doesn’t worked(
If you look at my file (picture), you can see, that I select model “ПУШ31_АГО_АР_К3…”. The script does work whith Rooms (in picture - “Помещения”) - it select rooms from model “ПУШ31_АГО_АР_К3…” but it create points (location) on model “ПУШ31_АГО_АР_К1…” (K1).
Maybe we inserted models not by the rules?
it is working
you are missing the node Space.byPoint
Look at this topic to transform the “origin” coordinates in shared coordinates.
I was show you, that node “Room.Location” gives to us points not in “true” model
yes, i see it now, sorry
Alban, you give me a good idea! I think, I did samething wrong. I uploaded 2 version of my script. Any ideas???
It’s hard to know without your revit files.
I think the internal origin must be different in the host and linked Revit file.
You can try this :
Get locations of rooms.dyn (21.6 KB)
Alban, it’s doesn’t worked(
Script created space by rooms from model AR_2 on model AR_1. I can’t uploaded my projects - after cleaning revit model, it size - 53 mb).
I just uploaded model AR_2 to AR_1 and gived to AR_2 coordinates (Shared Site)
On picture - work result of your script:
You can you upload your models with a third party sharing site such as onedrive, google drive, dropbox, wetransfer…
For which model do you want to create spaces AR_1 or AR_2 ? Because your rooms come from the AR2 model.
I want to create spaces in all models. In AR_1 it’s creating - I upload it first (base point to base point). Then, I gives coordinates from AR_1, inserted AR_2 and tranfer to this model coordinates.
AR_1 model is missing.
Oh, I’m sorry. Try it now
That’s exactly what I thought. The internal origin is different in your in the host and in the linked Revit file.
You must transform the location of your room points.
Alban, who created node “springs.collector.linkedinstanselements”?) I can’t find it
It’s in package Springs