Hi Awilliams,
Thanks for your answer.
The suggested nodes don’t seem to work, they give a different output
As far as i understand, i need the same output from the Element.SetParameterByName node as is given from the Select Model Element (as shown in the image).
I dont really understand the Python script, and i cant upload the document so i have to post it like this:
The node takes a object from a family linked with a material and calculates it’s area.
import clr
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(“RevitNodes”)
clr.AddReference(“RevitServices”)
clr.AddReference(“RevitAPI”)
import Revit
import System
import RevitServices
import Autodesk
from Revit.Elements import *
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
elems = UnwrapElement(IN[0])
targetmat = IN[1]
output =
geomopt = app.Create.NewGeometryOptions()
geomopt.ComputeReferences = True
geomopt.DetailLevel = Autodesk.Revit.DB.ViewDetailLevel.Fine
matcol = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Materials).WhereElementIsNotElementType()
targetId = -1
for mat in matcol:
if mat.Name == targetmat:
targetId = mat.Id
#foreach object get geometrysolid, get material name, is name name of target
from Autodesk.Revit.DB import *
from Autodesk import *
for elem in elems:
georaw = elem.get_Geometry(geomopt)
sublist =
for geoobj in georaw:
solids = geoobj.GetInstanceGeometry()
for solid in solids:
facearray = solid.Faces
for face in facearray:
matId = face.MaterialElementId
if matId == targetId:#this is area
area = face.Area
normal = face.ComputeNormal(UV(0.5,0.5))
curves = face.GetEdgesAsCurveLoops()
clist =
for car in curves:
for c in car:
pt1 = c.GetEndPoint(0)
pt2 = c.GetEndPoint(1)
l = DesignScript.Geometry.Line.ByStartPointEndPoint(DesignScript.Geometry.Point.ByCoordinates(pt1.X304.8,pt1.Y304.8,pt1.Z304.8),DesignScript.Geometry.Point.ByCoordinates(pt2.X304.8,pt2.Y304.8,pt2.Z304.8))
clist.append(l)
sublist.append([elem,area*0.09290304 ,normal.ToVector(),clist])
output.append(sublist[:])
del sublist[:]
#transaction
TransactionManager.Instance.EnsureInTransaction(doc)
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = output