@@ -1588,6 +1588,28 @@ def execute(self, context):
15881588 settings .logger = logging .getLogger ("Clash" )
15891589 settings .logger .setLevel (logging .DEBUG )
15901590 ifc_clasher = ifcclash .IfcClasher (settings )
1591+
1592+ if bpy .context .scene .BIMProperties .should_create_clash_snapshots :
1593+ def get_viewpoint_snapshot (self , viewpoint , mat ):
1594+ camera = bpy .data .objects .get ('IFC Clash Camera' )
1595+ if not camera :
1596+ camera = bpy .data .objects .new ("IFC Clash Camera" , bpy .data .cameras .new ("IFC Clash Camera" ))
1597+ bpy .context .scene .collection .objects .link (camera )
1598+ camera .matrix_world = Matrix (mat )
1599+ bpy .context .scene .camera = camera
1600+ camera .data .angle = radians (60 )
1601+ area = next (area for area in bpy .context .screen .areas if area .type == "VIEW_3D" )
1602+ area .spaces [0 ].region_3d .view_perspective = "CAMERA"
1603+ area .spaces [0 ].shading .show_xray = True
1604+ bpy .context .scene .render .resolution_x = 480
1605+ bpy .context .scene .render .resolution_y = 270
1606+ bpy .context .scene .render .image_settings .file_format = "PNG"
1607+ bpy .context .scene .render .filepath = os .path .join (bpy .context .scene .BIMProperties .data_dir , "snapshot.png" )
1608+ bpy .ops .render .opengl (write_still = True )
1609+ return bpy .context .scene .render .filepath
1610+
1611+ ifcclash .IfcClasher .get_viewpoint_snapshot = get_viewpoint_snapshot
1612+
15911613 ifc_clasher .clash_sets = []
15921614 for clash_set in bpy .context .scene .BIMProperties .clash_sets :
15931615 self .a = []
0 commit comments