I want to get the side faces of a floor and a slab
the following code i use to get the exterior faces off a wall. But that won’t work with a floor
is it possible to get the Side faces off a floor? And how?
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
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
line = UnwrapElement(IN[0]).GeometryCurve
elements = UnwrapElement(IN[1])
elementsRef = ReferenceArray()
opt = Options()
opt.ComputeReferences = True
opt.IncludeNonVisibleObjects = True
opt.View = doc.ActiveView
for element in elements:
a = HostObjectUtils.GetSideFaces(element, ShellLayerType.Exterior)
for i in a:
elementsRef.Append(i)
TransactionManager.Instance.EnsureInTransaction(doc)
dim = doc.Create.NewDimension(doc.ActiveView, line, elementsRef).ToDSType(True)
TransactionManager.Instance.TransactionTaskDone()
OUT = (dim, a, elementsRef)
What’s the specific reason you want to do it in Python? As you do have a way to get it done in Dynamo, maybe there’s a way to alterate that in a way that serves you goal rather than trying to do it in Python.
It is because I started this with the use of Python.
In mine script for dimension walls i had to use python to get the exterior side of the wall.
And i used that script to bild a script to dimension floor
but indeed when there is a way to get to my goal it is stupid to waste mine time trying to do it in Python.
Sometimes it is better to start a script from new instead of use another one
thank for keeping me by the lesson
ps i am learning Python maybe thats why i want it to use to often lately
Well, trying to learn Python is a perfectly valid reason to do it in Python. I’ve made rather nonsensical things in Dynamo to learn Dynamo (like this: I created a Node to Check and find Prime Numbers) but if that isn’t much of a goal it’d be a bit silly.
I’ve seen a lot of people (including myself) asking for a method to do something in Python even though Dynamo is perfectly capable of doing so. It’s arguably silly to confront a “regular” of the forum with it but I got that status as well recently and I really feel like I’m a complete novice on most things Dynamo. So I’m asking just to be sure.
One of the key aspects of learning dynamo is understanding the various ways to accomplish any task. At one point I had 20 or so scripts which were ‘play time’ scripts where I did a task in method 1 (nodes), then method 2 (design script), then method 3 (in line design script), then method 4 (custom node), then method 5 (python).
Each of these methods have strengths and weaknesses related to speed, expert availability, complexity of changes, management, flexibility, and maintenance. If you only know one well you’re in for an issue someday. So knowing all is good.
However, it’s also important to know when to walk away - if you need it done and it works, then hit run and move on. There will be another time to learn later this week, perhaps with something similar, and you can come back to this as needed.
With the OOTB node Dimension.ByElements i can not dimension at the sides of floor/walls/etc
So i think i stil need Python to dimension a side of a floor or foundation slab etc
at this moment i have a Python script that works for sides of floors, walls, str foundations, etc
see image