Problem Extracting Geometry of Walls to Dynamo

Hello, continuing a previous question of how to extract geometry of walls from revit and following the guidelines that I have received, I now now have the following issue.

I collected a list of walls and am now trying to convert the geometry to dynamo geometry using the ToProtoType() method, as shown in previous thread and I receive an error.
This is the code and the error.

Now after adopting a slightly different code from a different example - I began by unwrapping the collected walls and passed on the ToProtoType() method - I manage to collect the list of solids but not show the geometry in Dynamo.

Anyone have suggestions how to proceed or can explain why the ToProtoType() method isn’t read properly?

Thanks ahead of time

Hello
add a condition to be sure it is a solid

for e in fecWall_Struct:
	geo_set = e.get_Geometry(opt)
	for geo in geo_set:
		if isinstance(geo, Solid):
			#convert to Dynamo Geometry
			geoDS_set = geo.ToProtoType()
1 Like

Great it works!
Can you explain why it wasn’t able to convert without that condition?
On my previous thread you wrote further conditions - can you explain why they are necessary? I was trying figure it out through the API but haven’t gotten much out of it on that subject…

I assumed that in your list you have one (or more) object of type Autodesk.Revit.DB GeometryInstance (the method does not work on this type of object).
But by rereading your error message it is likely that this type of error is generated by very fine solids

So basically the method ToProtoType() performs the GeometryInstance which can only work on element types? So in the case that the general Autodesk.Revit.DB object doesn’t fall in that category?
Am I close?

to my knowledge ToProtoType () works with

Autodesk.Revit.DB Curve
Autodesk.Revit.DB Edge
Autodesk.Revit.DB Face
Autodesk.Revit.DB Mesh
Autodesk.Revit.DB Point
Autodesk.Revit.DB PolyLine
Autodesk.Revit.DB Profile
Autodesk.Revit.DB Solid

more info here

1 Like

Thanks C.