I tried the following, but it didn't work either.
I thought i could shift the IFCCARTESIANPOINTLIST3D by the IFCLOCALPLACEMENT and then boolean it.
I also messed around with...
...but nothing unlocked it. :\
import bpy
import ifcopenshell
import blenderbim.bim.import_ifc
from blenderbim.bim.ifc import IfcStore
ifcFile = ifcopenshell.open(IfcStore.path)
cube1 = ifcFile.by_type("IfcActuator")[0]
cube2 = ifcFile.by_type("IfcActuator")[1]
cube1Shape = cube1.Representation.Representations[1].Items[0]
cube2Shape = cube2.Representation.Representations[1].Items[0]
cube1Shape.Closed = True
cube2Shape.Closed = True
cube1placement_to_list = list(cube1.ObjectPlacement.RelativePlacement.Location.Coordinates)
cube2placement_to_list = list(cube2.ObjectPlacement.RelativePlacement.Location.Coordinates)
cube2vertices = list(cube2Shape.Coordinates.CoordList)
temp_vertices_list = []
for x in cube2vertices:
x_temp_list = list(x)
i=0
temp_coord_list = []
for y in x_temp_list:
y = cube1placement_to_list[i] - cube2placement_to_list[i]
temp_coord_list.append(y)
i+=1
temp_coord_list_to_tuple = tuple(temp_coord_list)
temp_vertices_list.append(temp_coord_list_to_tuple)
temp_vertices_list_to_tuple = tuple(temp_vertices_list)
cube2Shape.Coordinates.CoordList = temp_vertices_list_to_tuple
booleanResult = ifcFile.createIfcBooleanResult(Operator="INTERSECTION", FirstOperand=cube1Shape, SecondOperand=cube2Shape)
context = ifcFile.by_type("IfcGeometricRepresentationContext")[0]
storey = ifcFile.by_type("IfcBuildingStorey")[0]
point = ifcFile.createIfcCartesianPoint((0.0, 0.0, 0.0))
zdir = ifcFile.createIfcDirection((0.0, 0.0, 1.0))
xdir = ifcFile.createIfcDirection((1.0, 0.0, 0.0))
origin = ifcFile.createIfcAxis2Placement3D(point, zdir, xdir)
placement = ifcFile.createIfcLocalPlacement(None, origin)
road = ifcopenshell.api.run('root.create_entity', ifcFile, ifc_class = 'IfcWall')
road.Name = "MY NEW ROAD SEGMENT!"
road.ObjectPlacement = placement
shapeRepresentation = ifcFile.create_entity('IfcShapeRepresentation', ContextOfItems = context, RepresentationIdentifier = 'Body', RepresentationType = 'CSG', Items = [booleanResult])
ifcopenshell.api.run('geometry.assign_representation', ifcFile, product = road, representation = shapeRepresentation)
ifcFile.write("D:/Dropbox/Learning/Python/edge_to_wall/bollean/MVP_modified.ifc")