MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / is_existing_ifc_file

Method is_existing_ifc_file

src/bonsai/bonsai/bim/ui.py:71–80  ·  view source on GitHub ↗

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.

(self, filepath: Optional[str] = None)

Source from the content-addressed store, hash-verified

69 use_relative_path: bool
70
71 def is_existing_ifc_file(self, filepath: Optional[str] = None) -> bool:
72 """Check if file path exists and if it's an IFC file.
73
74 If `filepath` is not provided, will use filepath property from the current operator.
75 """
76 if filepath is None:
77 path = self.get_filepath_abs()
78 else:
79 path = Path(filepath)
80 return path.exists() and path.is_file() and "ifc" in path.suffix.lower()
81
82 def get_filepath_abs(self) -> Path:
83 # self.filepath filled by fileselect_add is absolute

Callers 3

drawMethod · 0.95
executeMethod · 0.80

Calls 2

get_filepath_absMethod · 0.95
lowerMethod · 0.80

Tested by

no test coverage detected