diff --git a/src/Mod/BIM/nativeifc/ifc_generator.py b/src/Mod/BIM/nativeifc/ifc_generator.py index 578fe3c368b4..583dac7a24d3 100644 --- a/src/Mod/BIM/nativeifc/ifc_generator.py +++ b/src/Mod/BIM/nativeifc/ifc_generator.py @@ -464,13 +464,23 @@ def set_cache(ifcfile, cache): def set_representation(vobj, node): """Sets the correct coin nodes for the given Part object""" + def find_node(parent, nodetype): + for i in range(parent.getNumChildren()): + if isinstance(parent.getChild(i), nodetype): + return parent.getChild(i) + return None + # node = [colors, verts, faces, edges, parts] if not vobj.RootNode: return if vobj.RootNode.getNumChildren() < 3: return - coords = vobj.RootNode.getChild(1) # SoCoordinate3 - switch = vobj.RootNode.getChild(2) + coords = find_node(vobj.RootNode, coin.SoCoordinate3) + if not coords: + return + switch = find_node(vobj.RootNode, coin.SoSwitch) + if not switch: + return num_modes = switch.getNumChildren() if num_modes < 3: return diff --git a/src/Mod/BIM/nativeifc/ifc_tools.py b/src/Mod/BIM/nativeifc/ifc_tools.py index 2b98c240a1aa..1c3dd9aa39bb 100644 --- a/src/Mod/BIM/nativeifc/ifc_tools.py +++ b/src/Mod/BIM/nativeifc/ifc_tools.py @@ -942,7 +942,7 @@ def set_colors(obj, colors): if len(colors) > 1: #colors[0] = colors[0][:3] + (0.0,) # TEMP HACK: if multiple colors, set everything to opaque because it looks wrong - colors = [color[:3] + (0.0,) for color in colors] + colors = [color[:3] + (1.0,) for color in colors] sapp = [] for color in colors: sapp_mat = FreeCAD.Material()