Hello, I am working with curtain panel families that consist of multiple materials. The base case contains Glazing and Spandrel. Parameters are built into each family to identify the glazing and spandrel materials e.g. “GL-1” and “Aluminum”.
I’d like to extract these material info and add them as attributes (via Elefront) to Rhino geometries within Rhino.Inside. This will eventually help with various takeoff data that cross-reference different panel properties e.g. Operable windows on the South office stack that feature GL-2. Pivot tables from Revit Schedules is one way to go but is there any way I can extract material data directly from Element Geometries?
The closest I’ve gotten is using Element Materials and Material Quantities - but these only provide a single area value for the whole panel. There is a Volume output per material, which is nice to have but requires division by depth (which varies by material) to arrive at a surface area. However,
Another workaround is to apply the formula used to create the curtain panels in the first place e.g. 3’ height for spandrel, with the remainder is allocated to glazing. It’s simple and flexible enough but I’d prefer to extract data directly from the panel itself.
On a related note, I did try asking ChatGPT for a Python script for the job … which it did so promptly. Thing is, I then end up getting non-stop “G is not a Brep” errors despite the geometry inputs being closed breps.
Thanks!
Code below:
import clr
clr.AddReference(‘System.Core’)
clr.AddReference(‘RhinoInside.Revit’)
from System import Enum
import rhinoscriptsyntax as rs
import Rhino
from RhinoInside.Revit import Revit, Convert
from Autodesk.Revit import DB
doc = Revit.ActiveDBDocument
if doc is not None:
if isinstance(G, Rhino.Geometry.Brep):
# Convert Brep to DB.Solid if needed
solid = Convert.Geometry.ToRevit(G, DB.Options())
if solid is not None:
gobj_mats = set(x.MaterialElementId.IntegerValue for x in solid.Faces)
if gobj_mats:
M = [doc.GetElement(DB.ElementId(x)) for x in gobj_mats if doc.GetElement(DB.ElementId(x))]
if M:
# Process M as needed
print(“Material elements retrieved successfully.”)
else:
print(“Material elements not found in the document.”)
else:
print(“No material IDs associated with the solid faces.”)
else:
print(“Failed to convert Brep to Solid.”)
else:
print(“Geometry G is not a Brep.”)
else:
print(“No active Revit document.”)