From f10ec930f8a32c4f03b4e59fb854931b49464e6a Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Wed, 10 Dec 2025 20:12:31 +0100 Subject: [PATCH] BIM: ArchReference: fix coin node handling Fixes #25772. --- src/Mod/BIM/ArchReference.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Mod/BIM/ArchReference.py b/src/Mod/BIM/ArchReference.py index 7b08210518..031a85cb8e 100644 --- a/src/Mod/BIM/ArchReference.py +++ b/src/Mod/BIM/ArchReference.py @@ -755,6 +755,7 @@ class ViewProviderArchReference: FreeCAD.Console.PrintWarning(t + " " + obj.Label + "\n") return from pivy import coin + from draftutils import gui_utils inputnode = coin.SoInput() inputnode.setBuffer(ivstring) @@ -773,13 +774,9 @@ class ViewProviderArchReference: # check node contents rootnode = obj.ViewObject.RootNode - if rootnode.getNumChildren() < 3: - FreeCAD.Console.PrintError( - translate("Arch", "Invalid root node in") + " " + obj.Label + "\n" - ) - return - switch = rootnode.getChild(2) - if switch.getNumChildren() != 4: + # display mode switch + switch = gui_utils.find_coin_node(obj.ViewObject.RootNode, coin.SoSwitch) + if switch is None or switch.getNumChildren() != 4: FreeCAD.Console.PrintError( translate("Arch", "Invalid root node in") + " " + obj.Label + "\n" ) @@ -804,16 +801,14 @@ class ViewProviderArchReference: return if (not hasattr(self, "orig_wireframe")) or (not self.orig_wireframe): return + from pivy import coin + from draftutils import gui_utils # check node contents rootnode = obj.ViewObject.RootNode - if rootnode.getNumChildren() < 3: - FreeCAD.Console.PrintError( - translate("Arch", "Invalid root node in") + " " + obj.Label + "\n" - ) - return - switch = rootnode.getChild(2) - if switch.getNumChildren() != 4: + # display mode switch + switch = gui_utils.find_coin_node(obj.ViewObject.RootNode, coin.SoSwitch) + if switch is None or switch.getNumChildren() != 4: FreeCAD.Console.PrintError( translate("Arch", "Invalid root node in") + " " + obj.Label + "\n" )