mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
black .
This commit is contained in:
@@ -260,7 +260,6 @@ class SaveBlendMetadataFile(bpy.types.Operator):
|
|||||||
self.report({"WARNING"}, "No IFC file path set.")
|
self.report({"WARNING"}, "No IFC file path set.")
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
|
||||||
blendmetadata_path = ifc_file + ".metadata.blend"
|
blendmetadata_path = ifc_file + ".metadata.blend"
|
||||||
|
|
||||||
ifc_dir = os.path.dirname(ifc_file)
|
ifc_dir = os.path.dirname(ifc_file)
|
||||||
@@ -332,12 +331,14 @@ except Exception:
|
|||||||
bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}')
|
bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}')
|
||||||
"""
|
"""
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False) as script_file:
|
with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False) as script_file:
|
||||||
script_file.write(cleanup_script)
|
script_file.write(cleanup_script)
|
||||||
script_path = script_file.name
|
script_path = script_file.name
|
||||||
|
|
||||||
blender_exe = bpy.app.binary_path
|
blender_exe = bpy.app.binary_path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[blender_exe, temp_path, "--background", "--python", script_path], capture_output=True, text=True
|
[blender_exe, temp_path, "--background", "--python", script_path], capture_output=True, text=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -488,28 +488,28 @@ def sync_references(
|
|||||||
|
|
||||||
for element in potential_reference_elements:
|
for element in potential_reference_elements:
|
||||||
# Skip spatial elements - their IFC placement is the source of truth
|
# Skip spatial elements - their IFC placement is the source of truth
|
||||||
if element.is_a("IfcSpatialElement"):
|
if element.is_a("IfcSpatialElement"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip grids - their IFC placement is the source of truth
|
# Skip grids - their IFC placement is the source of truth
|
||||||
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||||
drawing_tool.sync_object_placement(obj)
|
drawing_tool.sync_object_placement(obj)
|
||||||
|
|
||||||
for element in drawing_tool.get_group_elements(group):
|
for element in drawing_tool.get_group_elements(group):
|
||||||
if not drawing_tool.is_auto_annotation(element):
|
if not drawing_tool.is_auto_annotation(element):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip spatial elements - should never sync their placement
|
# Skip spatial elements - should never sync their placement
|
||||||
if element.is_a("IfcSpatialElement"):
|
if element.is_a("IfcSpatialElement"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip grids
|
# Skip grids
|
||||||
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||||
drawing_tool.sync_object_placement(obj)
|
drawing_tool.sync_object_placement(obj)
|
||||||
if not (reference_element := drawing_tool.get_assigned_product(element)):
|
if not (reference_element := drawing_tool.get_assigned_product(element)):
|
||||||
|
|||||||
Reference in New Issue
Block a user