From daba504981b5c2e2a15ae8662767729aabebcab1 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 1 Sep 2024 15:33:52 +0200 Subject: [PATCH] Update draw.py - test for --drawing-guid existance --- src/ifcopenshell-python/ifcopenshell/draw.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/draw.py b/src/ifcopenshell-python/ifcopenshell/draw.py index 774b5f9523..f1472394f2 100644 --- a/src/ifcopenshell-python/ifcopenshell/draw.py +++ b/src/ifcopenshell-python/ifcopenshell/draw.py @@ -128,6 +128,14 @@ def main( # it's up to user to keep them valid for the provided projects. if settings.drawing_guid or settings.drawing_object_type: if settings.drawing_guid: + found_guid = False + for f in files: + try: + f.by_guid(settings.drawing_guid) + found_guid = True + except: pass + if not found_guid: + raise ValueError(f"Unable to find guid {settings.drawing_guid!r}") sr.setElevationRefGuid(settings.drawing_guid) elif settings.drawing_object_type: sr.setElevationRef(settings.drawing_object_type)