mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Fix #2516. Add/build/remove/view/rename/copy sheet/drawing/schedule now all references and updates user configurable relative paths.
This commit is contained in:
@@ -21,6 +21,7 @@ import re
|
||||
import bpy
|
||||
import math
|
||||
import bmesh
|
||||
import shutil
|
||||
import logging
|
||||
import mathutils
|
||||
import webbrowser
|
||||
@@ -136,7 +137,7 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
def create_svg_sheet(cls, document, titleblock):
|
||||
sheet_builder = sheeter.SheetBuilder()
|
||||
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
|
||||
uri = cls.get_document_uri(document)
|
||||
uri = cls.get_document_uri(document, "LAYOUT")
|
||||
sheet_builder.create(uri, titleblock)
|
||||
return uri
|
||||
|
||||
@@ -583,8 +584,9 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
continue
|
||||
|
||||
for reference in cls.get_document_references(sheet):
|
||||
if reference.Description == "LAYOUT":
|
||||
continue # The layout itself is an internal detail and should not be visible to users
|
||||
if reference.Description in ("SHEET", "LAYOUT", "RASTER"):
|
||||
# These references are an internal detail and should not be visible to users
|
||||
continue
|
||||
new = props.sheets.add()
|
||||
new.ifc_definition_id = reference.id()
|
||||
new.is_sheet = False
|
||||
@@ -726,6 +728,18 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
|
||||
# TODO below this point is highly experimental prototype code with no tests
|
||||
|
||||
@classmethod
|
||||
def does_file_exist(cls, uri):
|
||||
return os.path.exists(uri)
|
||||
|
||||
@classmethod
|
||||
def delete_file(cls, uri):
|
||||
os.remove(uri)
|
||||
|
||||
@classmethod
|
||||
def move_file(cls, src, dest):
|
||||
shutil.move(src, dest)
|
||||
|
||||
@classmethod
|
||||
def generate_drawing_name(cls, target_view, location_hint):
|
||||
if target_view in ("PLAN_VIEW", "REFLECTED_PLAN_VIEW") and location_hint:
|
||||
@@ -737,6 +751,12 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
return location_hint + " " + target_view.split("_")[0]
|
||||
return target_view
|
||||
|
||||
@classmethod
|
||||
def get_default_layout_path(cls, identification, name):
|
||||
return os.path.join(
|
||||
bpy.context.scene.DocProperties.layouts_dir, cls.sanitise_filename(f"{identification} - {name}.svg")
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_default_sheet_path(cls, identification, name):
|
||||
return os.path.join(
|
||||
@@ -1176,6 +1196,14 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
return document.DocumentReferences or []
|
||||
return document.HasDocumentReferences or []
|
||||
|
||||
@classmethod
|
||||
def get_reference_description(cls, reference):
|
||||
return reference.Description
|
||||
|
||||
@classmethod
|
||||
def get_reference_location(cls, reference):
|
||||
return reference.Location
|
||||
|
||||
@classmethod
|
||||
def get_reference_element(cls, reference):
|
||||
if tool.Ifc.get_schema() == "IFC2X3":
|
||||
|
||||
Reference in New Issue
Block a user