Hi guys.
I got a problem, i want to collect elements (walls, structural framing, structural columns, floors, stairs, structural fundations, etc) by it´s surfaces (as inputs only as inputs) with python code (not a ptyhon expert) and i have no warnings but an “empty lists”, i need to input surfaces ant return its elements here is my code…
from your try statement the Except refer to emty lists…
what are you trying exactly ?
import clr
import sys
import System
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
faces = UnwrapElement(IN[0])
elementlist = []
for f in faces:
try:
ref = f.Tags.LookupTag("RevitFaceReference")
e = doc.GetElement(ref)
elementlist.append(e)
except:
elementlist.append(f)
OUT = elementlist
KR
Andreas
Hi,
of memory, when a new ProtoGeometry (like solid) is created, there is no reference to any Revit elements
Thanks for the answer, but you code gives me surfaces i need elements instead of surfaces (something like image below, or something like the “element.fromdynamosurface” node… not working in this case),
i´m trying to create a unique solid (solid.by.union) for walls, floors, structural framing, structural columns, stairs, etc, then explode them to collect surfaces (formwork), and with “Directhshape.ByGeometry” assing the level on a parameter related to surface element, i already have my script completed and works fine, but the idea is to split this surfaces and sort them by level and to get levels i need elements and i think this is not possible to do with surfaces.
I tried to explain the best i could
But the “Element.fromDynamoSurfaces” works when "selecting faces node, why isn´t work here?
Because the data of Surfaces are directly extract from selection, no geometries are re-created
so you want get faces from your elements… and later sort these elements by there faces
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
elements = UnwrapElement(IN[0])
opt = Options()
output = []
results = []
for i in elements:
output.append(i.get_Geometry(opt))
for x in output:
results.append(Geometry.Explode(x))
OUT = output, results
code has an error i can`t finaly create the faces, just getting the Geometry
I think if you skip the solid.ByUnion the node should work fine.
Instead of modifying the Dynamo geometry you should be modifying the Revit elements and joining the members before doing the form work effort.
@Draxl_Andreas No, i need the elements of surfaces, once i got this i can get the level of every surfaces creating a relationship between surfaces and levels(given by the elements) with two LISTS or (i think its not possible) but ¿can i get the level of every surface with some python code or Node?.., i´ll try to explain again the concept because maybe there is another way to achive mi goal and my english isn´t allow me to… i´ll go at the end of my script, i already create a “formwork” with DirectShape.ByGeometry" Node to all of the elements, what i want to do next is to assign the corresponding level to every “DIrectShape” element in a parameter called “level”, how cain i achive this?
Yes, works fine, the only problem if i do that is this… not cutting where supposed to and revit joins automatically some elements
Did you trim/join your columns yet? Looks like they should union with that floor or the beams.
I don’t know if there is a similar option for floors/beams, but for walls there is the option to disallow walljoin:
WallUtils.DisallowWallJoinAtEnd(wall, int)
Without a sample model (like 1/3 of what you’re showing should do) and your current graph there isn’t much I can do to help. There is a lot of time required to build such data sets and anyone who wants to help would be guessing at your conditions (and likely to guess wrong to boot!).
You are right… here is the file
Proyecto1.rvt (5.5 MB)
Structural_Formwork.dyn (196.0 KB)
Hi guys,
I just wanna say thanks y’all for your answers and your time, it seems i already found the answer to my problem, @c.poupin, you were right in your first comment but i needed to try…
@jacob.small i couldn´t understand at first… but the solution was joinning revit elements like you said,