Fix #3752. Accommodate situations where layouts don't match IFC.

This commit is contained in:
Dion Moult
2023-09-18 23:14:52 +10:00
parent 0f1d675bef
commit 27b71a9d07
@@ -345,8 +345,12 @@ class SheetBuilder:
def build_drawings(self, root, sheet): def build_drawings(self, root, sheet):
for view in root.findall('{http://www.w3.org/2000/svg}g[@data-type="drawing"]'): for view in root.findall('{http://www.w3.org/2000/svg}g[@data-type="drawing"]'):
drawing_id = int(view.attrib["data-id"]) drawing_id = int(view.attrib["data-id"])
reference = tool.Ifc.get().by_id(int(view.attrib["data-id"])) try:
drawing = tool.Ifc.get().by_id(view.attrib["data-drawing"]) reference = tool.Ifc.get().by_id(int(view.attrib["data-id"]))
drawing = tool.Ifc.get().by_id(view.attrib["data-drawing"])
except:
# Perhaps the SVG has outdated content or is edited externally which we cannot control.
continue
images = view.findall("{http://www.w3.org/2000/svg}image") images = view.findall("{http://www.w3.org/2000/svg}image")
@@ -387,8 +391,12 @@ class SheetBuilder:
def build_schedules(self, root, sheet): def build_schedules(self, root, sheet):
for view in root.findall('{http://www.w3.org/2000/svg}g[@data-type="schedule"]'): for view in root.findall('{http://www.w3.org/2000/svg}g[@data-type="schedule"]'):
reference = tool.Ifc.get().by_id(int(view.attrib["data-id"])) try:
schedule = tool.Ifc.get().by_id(int(view.attrib["data-schedule"])) reference = tool.Ifc.get().by_id(int(view.attrib["data-id"]))
schedule = tool.Ifc.get().by_id(int(view.attrib["data-schedule"]))
except:
# Perhaps the SVG has outdated content or is edited externally which we cannot control.
continue
images = view.findall("{http://www.w3.org/2000/svg}image") images = view.findall("{http://www.w3.org/2000/svg}image")