BooleanOperationsUtils is not defined

Thanks in advance for every input.

I tried to use

BooleanOperationsUtils.ExecuteBooleanOperation(arg1, arg2, BooleanOperationsType.Intersect)

to evaluate if a solid gets intersected by another solid. (Later i want to use it to compare the whole list)

Do i miss some necessary imports in PythonScript, or what could be the problem here?

Input Parameters are 2 non-nested lists with solids as items.

import sys
import clr
clr.AddReference('ProtoGeometry')
clr.AddReference('RevitAPI')
from Autodesk.DesignScript.Geometry import *

rooms = IN[0]
gds = IN[1]

a = rooms[0]
b = gds[0]

val = BooleanOperationsUtils.ExecuteBooleanOperation(a, b, BooleanOperationsType.Intersect)

OUT = val

@d.feyerer Try adding from Autodesk.Revit.DB import *
image

1 Like

Thank you for your answer, first error wasn´t shown again.

But now i have another error message, which quite confuses me:

“Expected Solid, got Solid” → ?

What does that mean? Are there different Types of “Solid”?

I used Object.Type node and it shows, that the items of both lists got type:
Autodesk.DesignScript.Geometry.Solid

CUSTOMWriteSlabTagsToRooms_adaptions.dyn (148.8 KB)

Yes: You are inputting a Dynamo Solid from its ProtoGeometry library where as the Revit API BooleanOperationsUtils.ExecuteBooleanOperation method expects a Revit API Solid. Try calling ToRevitType() on the Proto Solid, just don’t expect very reliable results as it will fail conversion often.

3 Likes

@Thomas_Mahon

I´ve found a wiki entry on github.com, where you have described the transformation from Dynamo Geometry to Revit GeometryObject instances ( Python 0.6.3 to 0.7.x Migration · DynamoDS/Dynamo Wiki · GitHub)

I managed to transform the Dynamo Solids to Revit Solids with this approach (for one item). I am actually testing the approach if it produces stable results.

import sys
import clr

clr.AddReference("RevitAPI")
import Autodesk

clr.AddReference("RevitNodes")
import Revit

clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('ProtoGeometry')
clr.ImportExtensions(Revit.GeometryConversion)

from Autodesk.Revit.DB import *
from Autodesk.DesignScript.Geometry import *

rooms = IN[0]
gds = IN[1]

a = UnwrapElement(rooms[0])
a2 = a.ToRevitType(TessellatedShapeBuilderTarget.Solid, TessellatedShapeBuilderFallback.Abort)
a3 = a2[0]

b = UnwrapElement(gds[0][0])
b2 = b.ToRevitType(TessellatedShapeBuilderTarget.Solid, TessellatedShapeBuilderFallback.Abort)
b3 = b2[0]

val = BooleanOperationsUtils.ExecuteBooleanOperation(a3, b3, BooleanOperationsType.Intersect)
		
OUT = val, a3, b3
1 Like