import ifcopenshell import ifcopenshell.api ifcFilePath = r"C:\Users\sbe\Documents\IFC\MVP.ifc" ifcFile = ifcopenshell.open(ifcFilePath) cube1, cube2 = ifcFile.by_type("IfcActuator") cube1Shape = cube1.Representation.Representations[0].Items[0] cube2Shape = cube2.Representation.Representations[0].Items[0] booleanResult = ifcFile.createIfcBooleanResult(Operator="INTERSECTION", FirstOperand=cube1Shape, SecondOperand=cube2Shape) context = ifcFile.by_type("IfcGeometricRepresentationContext")[0] storey = ifcFile.by_type("IfcBuildingStorey")[0] origin = ifcFile.createIfcAxis2Placement3D(ifcFile.createIfcCartesianPoint((0.0, 0.0, 0.0)), ifcFile.createIfcDirection((0.0, 0.0, 1.0)), ifcFile.createIfcDirection((1.0, 0.0, 0.0)),) 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("".join(ifcFilePath.split('.')[:-1])+"_new.ifc")