Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken color inheritance for 3MF export #929

Open
jdegenstein opened this issue Mar 4, 2025 · 1 comment
Open

Broken color inheritance for 3MF export #929

jdegenstein opened this issue Mar 4, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@jdegenstein
Copy link
Collaborator

jdegenstein commented Mar 4, 2025

Currently color inheritance seems to not be working in the way intended, this works:

a=Cone(1,0,2).solid()
b=Box(3,3,3).solid()
a.color = Color(0.137, 0.306, 0.439)  # Tealish
b.color = Color(0.980, 0.973, 0.749, 0.25)  # Transparent Goldish 
exporter = Mesher(unit=Unit.CM)
exporter.add_shape([a,b])
exporter.write("ab_dual_color.3mf")

this doesn't:

a=Cone(1,0,2)
b=Box(3,3,3)
...

The resulting 3MF from the 2nd case has no color or transparency applied. I don't know if this is a regression or not, but I believe we tried to avoid this problem before.

@gumyr gumyr added the bug Something isn't working label Mar 5, 2025
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Mar 5, 2025
@gumyr
Copy link
Owner

gumyr commented Mar 5, 2025

The problem is at the beginning of the Mesher.add_shape method:

        shapes = []
        for input_shape in shape if isinstance(shape, Iterable) else [shape]:
            if isinstance(input_shape, Compound):
                shapes.extend(list(input_shape))
            else:
                shapes.append(input_shape)

where the sub-Shapes are extracted from the Compound (i.e. Cone or Box) but not any color information from the parent Compound object. This Shape extraction section needs to be reworked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants