At this point you have a Revit solid, not a Dynamo one. As a result you will need to stay in the Python node.
The methods you can call can be exposed in a few ways:
- Read the documented members for the class from the product documentation. The site RevitAPIDocs.com works well for this and is quite reliable. This is often the most informative as you get the full documentation, but it doesn’t expose everything, include the Python specific stuff, or help in all cases (ie: trying to find Dynamo core tools).
- Pull one item out of the list and pull the directory of members you can call on the Python environment. This is done by doing something like this:
OUT = dir(solids[0])
. - Inspect a single object by pulling a solid out of the list and using pythons inspect method. This is more powerful than calling the directory as it returns values for properties rather than a blank list of members, but may fail in some instances so it’s best to know #2 as well. This requires two lines, which in your case might be implemented like this:
import inspect
OUT = inspect.getmembers(solids[0])
Using those three methods, you can likely find that solids have a Volume property, which can be called by using some list comprehension, something like this:
OUT = [s.Volume for a in solids]
Note that I can’t confirm as I am running some errands.
once you use “solid.ToProtoType()” it will convert the geometry to dynamo geometry…try to avoid that
@newshunhk @c.poupin @jacob.small ,
Can i also set union of these Autodesk.Revit.DB.Solid
in the code?
like Autodesk.Revit.DB.Solid.ByUnion
i try first just merge 2 walls, without success
how do i set union all solids XXX ?
import sys
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
element1 = UnwrapElement(IN[0])
element2 = UnwrapElement(IN[1])
solidA = element1.get_Geometry(Options())
s1 = solidA.Solid
solidB = element2.get_Geometry(Options())
solidintersections = BooleanOperationsUtils.ExecuteBooleanOperation(solidA, solidB, BooleanOperationsType.Intersect)
mass = solidintersections.Volume
OUT = solidintersections, mass
Here an example
import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
collectorColumns = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns)
placedColumns = collectorColumns.WhereElementIsNotElementType().ToElements()
lst_Geo = []
opt = Options()
for i in placedColumns:
# get Solid with volume > 0
geoset = i.get_Geometry(opt)
for geo in geoset:
if isinstance(geo, DB.Solid) and geo.Volume > 0:
lst_Geo.append(geo)
elif isinstance(geo, DB.GeometryInstance):
for geoi in geo.GetInstanceGeometry():
if isinstance(geoi, DB.Solid) and geoi.Volume > 0:
lst_Geo.append(geoi)
global_solid = lst_Geo.pop(0)
for s in lst_Geo:
global_solid = BooleanOperationsUtils.ExecuteBooleanOperation(global_solid, s, BooleanOperationsType.Union)
OUT = global_solid, global_solid.Volume, global_solid.ComputeCentroid().ToPoint()
Hi, what is your output from this in Dynamo, does it return DB.Solids?
PS: Why don’t you try the JoinGeometry class as mentioned in this topic: Join solids in Revit API
What is your end goal actually? Do you need to get the exact geometry of the difference between both sets of columns or only check if there is a difference? If it is the latter, you could try getting the sums of volumes for both sets of columns, using the Solid.Volume property. If both sums are equal in the end, there is no difference
i want to make a model compare indepented from categories! So i want the pure Concrete geometry (Asbuild) i want to compare the volumes to get a real diference!
because in constructuion field there is no slab, beam or wall… …there is just concrete