mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
IfcCobie : Prevent executing operator if no ifc file
This commit is contained in:
@@ -62,14 +62,19 @@ class ExecuteIfcCobie(bpy.types.Operator):
|
|||||||
bl_label = "Execute IFCCOBie"
|
bl_label = "Execute IFCCOBie"
|
||||||
file_format: bpy.props.StringProperty()
|
file_format: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
props = context.scene.COBieProperties
|
||||||
|
return props.should_load_from_memory or props.cobie_ifc_file
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
from cobie import IfcCobieParser
|
from cobie import IfcCobieParser
|
||||||
props = context.scene.COBieProperties
|
props = context.scene.COBieProperties
|
||||||
|
|
||||||
output_dir = os.path.dirname(props.cobie_ifc_file)
|
|
||||||
|
|
||||||
if props.should_load_from_memory:
|
if props.should_load_from_memory:
|
||||||
output_dir = tempfile.gettempdir()
|
output_dir = tempfile.gettempdir()
|
||||||
|
else:
|
||||||
|
output_dir = os.path.dirname(props.cobie_ifc_file)
|
||||||
|
|
||||||
output = os.path.join(output_dir, "output")
|
output = os.path.join(output_dir, "output")
|
||||||
logger = logging.getLogger("IFCtoCOBie")
|
logger = logging.getLogger("IFCtoCOBie")
|
||||||
|
|||||||
Reference in New Issue
Block a user