mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
typing
This commit is contained in:
@@ -185,8 +185,8 @@ class IFC_Sv_write_file(bpy.types.Operator):
|
||||
def poll(cls, context):
|
||||
return any("IFC" in n for n in context.space_data.edit_tree.nodes.keys())
|
||||
|
||||
def ensure_hirarchy(self, file):
|
||||
elements_in_buildings = set()
|
||||
def ensure_hirarchy(self, file: ifcopenshell.file) -> None:
|
||||
elements_in_buildings: set[ifcopenshell.entity_instance] = set()
|
||||
if len(file.by_type("IfcBuilding")) == 0:
|
||||
my_building = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcBuilding", name="My Building")
|
||||
elements = ifcopenshell.util.element.get_decomposition(my_building)
|
||||
@@ -269,6 +269,7 @@ class IFC_PT_write_file_panel(bpy.types.Panel):
|
||||
def poll(cls, context):
|
||||
if context.space_data.edit_tree and any("IFC" in n for n in context.space_data.edit_tree.nodes.keys()):
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
ng = context.space_data.node_tree
|
||||
|
||||
@@ -21,11 +21,12 @@ import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.representation
|
||||
from ifcopenshell import template
|
||||
from typing import Union
|
||||
|
||||
|
||||
class SvIfcStore:
|
||||
path = ""
|
||||
file = None
|
||||
file: Union[ifcopenshell.file, None] = None
|
||||
schema = None
|
||||
cache = None
|
||||
cache_path = None
|
||||
@@ -47,7 +48,7 @@ class SvIfcStore:
|
||||
schema_identifiers = ["IFC4", "IFC2X3"]
|
||||
|
||||
@staticmethod
|
||||
def purge():
|
||||
def purge() -> None:
|
||||
SvIfcStore.path = ""
|
||||
SvIfcStore.file = None
|
||||
SvIfcStore.schema = None
|
||||
@@ -67,8 +68,7 @@ class SvIfcStore:
|
||||
SvIfcStore.schema_identifiers = ["IFC4", "IFC2X3"]
|
||||
|
||||
@staticmethod
|
||||
def create_boilerplate():
|
||||
|
||||
def create_boilerplate() -> ifcopenshell.file:
|
||||
file = template.create(
|
||||
filename="IfcSverchokDemoFile",
|
||||
organization=None,
|
||||
@@ -93,7 +93,7 @@ class SvIfcStore:
|
||||
return SvIfcStore.file
|
||||
|
||||
@staticmethod
|
||||
def get_file():
|
||||
def get_file() -> ifcopenshell.file:
|
||||
if SvIfcStore.file is None:
|
||||
SvIfcStore.create_boilerplate()
|
||||
return SvIfcStore.file
|
||||
|
||||
Reference in New Issue
Block a user