mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
typing
This commit is contained in:
@@ -1308,7 +1308,11 @@ class IfcImporter:
|
|||||||
):
|
):
|
||||||
return representation.Items[0].MappingTarget
|
return representation.Items[0].MappingTarget
|
||||||
|
|
||||||
def create_curve(self, element: ifcopenshell.entity_instance, shape) -> bpy.types.Curve:
|
def create_curve(
|
||||||
|
self,
|
||||||
|
element: ifcopenshell.entity_instance,
|
||||||
|
shape: Union[ifcopenshell.geom.ShapeElementType, ifcopenshell.geom.ShapeType],
|
||||||
|
) -> bpy.types.Curve:
|
||||||
if hasattr(shape, "geometry"):
|
if hasattr(shape, "geometry"):
|
||||||
geometry = shape.geometry
|
geometry = shape.geometry
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -35,15 +35,22 @@ import blenderbim.bim
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.helper import IfcHeaderExtractor
|
from blenderbim.bim.helper import IfcHeaderExtractor
|
||||||
from blenderbim.bim.prop import Attribute
|
from blenderbim.bim.prop import Attribute
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class IFCFileSelector:
|
class IFCFileSelector:
|
||||||
def is_existing_ifc_file(self, filepath=None):
|
filepath: str
|
||||||
|
|
||||||
|
def is_existing_ifc_file(self, filepath: Optional[str] = None) -> bool:
|
||||||
|
"""Check if file path exists and if it's an IFC file.
|
||||||
|
|
||||||
|
If `filepath` is not provided, will use filepath property from the current operator.
|
||||||
|
"""
|
||||||
if filepath is None:
|
if filepath is None:
|
||||||
filepath = self.filepath
|
filepath = self.filepath
|
||||||
return os.path.exists(filepath) and "ifc" in os.path.splitext(filepath)[1].lower()
|
return os.path.exists(filepath) and "ifc" in os.path.splitext(filepath)[1].lower()
|
||||||
|
|
||||||
def get_filepath(self):
|
def get_filepath(self) -> str:
|
||||||
"""get filepath taking into account relative paths"""
|
"""get filepath taking into account relative paths"""
|
||||||
if self.use_relative_path:
|
if self.use_relative_path:
|
||||||
filepath = os.path.relpath(self.filepath, bpy.path.abspath("//"))
|
filepath = os.path.relpath(self.filepath, bpy.path.abspath("//"))
|
||||||
|
|||||||
Reference in New Issue
Block a user