From 4f66fdd339a30eb131f1ebf190fb69ac6b5d82b3 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 29 Mar 2024 15:29:19 +1100 Subject: [PATCH] Fix #4411. Fallback to absolute paths if relative paths fail. --- src/blenderbim/blenderbim/bim/module/project/operator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index 44b5168bf4..b3caa863cf 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -860,7 +860,10 @@ class LinkIfc(bpy.types.Operator): continue new = context.scene.BIMProjectProperties.links.add() if self.use_relative_path: - filepath = os.path.relpath(filepath, bpy.path.abspath("//")).replace("\\", "/") + try: + filepath = os.path.relpath(filepath, bpy.path.abspath("//")).replace("\\", "/") + except: + pass # Perhaps on another drive or something new.name = filepath bpy.ops.bim.load_link(filepath=filepath, false_origin=self.false_origin) print(f"Finished linking {len(files)} IFCs", time.time() - start)