(self, context: bpy.types.Context)
| 96 | return filepath.as_posix().replace("\\", "/") |
| 97 | |
| 98 | def draw(self, context: bpy.types.Context) -> None: |
| 99 | assert isinstance(context.space_data, bpy.types.SpaceFileBrowser) |
| 100 | # Access filepath & Directory https://blender.stackexchange.com/a/207665 |
| 101 | params = context.space_data.params |
| 102 | assert params |
| 103 | # Decode byte string https://stackoverflow.com/a/47737082/ |
| 104 | directory = Path(params.directory.decode("utf-8")) |
| 105 | filepath = os.path.join(directory, params.filename) |
| 106 | layout = self.layout |
| 107 | if self.is_existing_ifc_file(filepath): |
| 108 | box = layout.box() |
| 109 | box.label(text="IFC Header Specifications", icon="INFO") |
| 110 | header_data = IfcHeaderExtractor(filepath).extract() |
| 111 | for key, value in header_data.items(): |
| 112 | if value != "": |
| 113 | split = box.split() |
| 114 | split.label(text=key.title().replace("_", " ")) |
| 115 | split.label(text=str(value)) |
| 116 | if key.lower() == "schema_name" and filepath[-4:].lower() == ".ifc": |
| 117 | schema_lower = str(value).lower() |
| 118 | if schema_lower == "ifc2x3": |
| 119 | row = box.row() |
| 120 | op = row.operator("bim.run_migrate_patch", text="Upgrade to IFC4") |
| 121 | op.infile = filepath |
| 122 | op.outfile = filepath[0:-4] + "-IFC4.ifc" |
| 123 | op.schema = "IFC4" |
| 124 | elif schema_lower == "ifc4": |
| 125 | row = box.row() |
| 126 | op = row.operator("bim.run_migrate_patch", text="Upgrade to IFC4X3") |
| 127 | op.infile = filepath |
| 128 | op.outfile = filepath[0:-4] + "-IFC4X3.ifc" |
| 129 | op.schema = "IFC4X3" |
| 130 | |
| 131 | if bpy.data.is_saved: |
| 132 | layout.prop(self, "use_relative_path") |
| 133 | else: |
| 134 | self.use_relative_path = False |
| 135 | layout.label(text="Save the .blend file first ") |
| 136 | layout.label(text="to use relative paths for .ifc.") |
| 137 | |
| 138 | |
| 139 | class BIM_PT_section_plane(Panel): |
nothing calls this directly
no test coverage detected