Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit 2cc8c3e

Browse files
committed
BIM: Fixes appearance defects coming from recent transparency and FreeCAD#18298
1 parent 7f456d8 commit 2cc8c3e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Mod/BIM/nativeifc/ifc_generator.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,23 @@ def set_cache(ifcfile, cache):
464464
def set_representation(vobj, node):
465465
"""Sets the correct coin nodes for the given Part object"""
466466

467+
def find_node(parent, nodetype):
468+
for i in range(parent.getNumChildren()):
469+
if isinstance(parent.getChild(i), nodetype):
470+
return parent.getChild(i)
471+
return None
472+
467473
# node = [colors, verts, faces, edges, parts]
468474
if not vobj.RootNode:
469475
return
470476
if vobj.RootNode.getNumChildren() < 3:
471477
return
472-
coords = vobj.RootNode.getChild(1) # SoCoordinate3
473-
switch = vobj.RootNode.getChild(2)
478+
coords = find_node(vobj.RootNode, coin.SoCoordinate3)
479+
if not coords:
480+
return
481+
switch = find_node(vobj.RootNode, coin.SoSwitch)
482+
if not switch:
483+
return
474484
num_modes = switch.getNumChildren()
475485
if num_modes < 3:
476486
return

src/Mod/BIM/nativeifc/ifc_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ def set_colors(obj, colors):
942942
if len(colors) > 1:
943943
#colors[0] = colors[0][:3] + (0.0,)
944944
# TEMP HACK: if multiple colors, set everything to opaque because it looks wrong
945-
colors = [color[:3] + (0.0,) for color in colors]
945+
colors = [color[:3] + (1.0,) for color in colors]
946946
sapp = []
947947
for color in colors:
948948
sapp_mat = FreeCAD.Material()

0 commit comments

Comments
 (0)