Space Autodesk.Revit.DB.Solid to Solid

I created solids from space geometries but I am struggling to convert it into a solid that Dynamo can use. Is anyone able to point me in the right direction?

Please also see:

`import clr 

import sys
from Autodesk.DesignScript.Geometry import *
sys.path.append(r’C:\Program Files (x86)\IronPython 2.7\Lib’)
import Revit
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import traceback
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Plumbing import *
from operator import itemgetter, attrgetter, methodcaller
import System
from DSCore import *
dataEnteringNode = IN
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
Spaces = UnwrapElement(IN[0])
objResults = [None] * len(Spaces)
Centroids = [None] * len(Spaces)
calculator = SpatialElementGeometryCalculator(doc)
for i in range(len(Spaces)):
objResults[i] = calculator.CalculateSpatialElementGeometry(Spaces[0]).GetGeometry()
Centroids[i] = objResults[i].ComputeCentroid()
#objResults[i] = objResults[i].ToProtoType()
OUT = [objResults, Centroids]`

1 2 3

Shouldn’t this be “ToDSType” instead of “ToProtoType”?

Though going back, what sort of geometry are you getting from revit, because dynamo can sometimes have fits with certain geometry types when in python and trying to convert it directly. Eg i have had issues with revit spline lines getting them into dynamo which then means you have to utilize tessellation to do the conversion.

A revit solid element cannot be put into a dynamo node that requires a solid, you have to convert the revit element into a dynamo element. There is a node called “Element.Solids” that will do this change for you, just make sure you have done the wrapping of the solid prior.

Have you tried doing the following:

Hi Brendan,
Thanks for the advice. The following error is generated when I use the nodes as described in the blog (so I am not sure if Dynamo is able to extract the geometry from a Space):

When I use ToDSType I get the following error

Kind Regards,
Paul Storm

What is the space geometry types for how they are built? Maybe take a snippet of the floor plan?

Reason for saying this is that the actual geometry could be causing your issue(eg complex curves not converting over and may need tessellating into points then recreating it in dynamo).

I meant replace the ToProtoType() with the “ToDSType(true)”.

Hi Brendan,
Sorry about that: ToDSType(True) returns the same error.

The spaces a re as simple as they come : cubic, room bounded by floor, 4 walls and a ceiling.

I am thinking the conversion method Autodesk provides does not work and that I will need to leverage the API for any operations I would like to perform on Solids generated by Space Geometry. I was hoping to use Dynamo Nodes.
Kind Regards,
Paul Storm

Hey, sorry if I misunderstand, but is this what you’re after?

for i in range(len(Spaces)):
    objResults[i] = calculator.CalculateSpatialElementGeometry(Spaces[0]).GetGeometry().ToProtoType()

OUT = objResults

Hope that helps,



Hi @Paul.Storm

In your code you have many unwanted items here is simplified version with both solids and centroid in single python magic :sunglasses:

Hi @Mark.Ackerley

Did you look your graph closely? It’s returning single solid many times and also Solid.Centroid values :man_superhero:


Thanks Mark and Kulkul,
That is exactly what I am looking for. Thank you. I will give it a try.
Kind Regards,
Paul Storm


I have asked IT to reinstall Dynamo as i think there may be some .dll’s missing on my side. Thanks for all your help thus far.

@Paul.Storm Don’t forget to mark the post. Cheers!

It just needed the reinstall. Works no, thanks.