Skip to content

Support outputting a STEP file with per-face colors #1427

Open
@mkovaxx

Description

@mkovaxx

I need to set per-face colors on programmatically created shapes, then export into STEP format. Please help me find a way to do this. I'm somewhat familiar with the underlying C++ OCCT, and I'm more than happy to contribute code. I'm filing this issue so we can discuss and align on the best approach here.

Here's a self-contained demo of the approach I found so far:
https://github.com/mkovaxx/cadquery_fused_assembly/tree/4572a63616a614f3920c859b5224c8d4aaed3d64

I create each face as a separate shape, then pass it to the Assembly.add method along with its desired color. Saving the assembly as STEP then contains the colors as expected.

For details, see this section:
https://github.com/mkovaxx/cadquery_fused_assembly/blob/4572a63616a614f3920c859b5224c8d4aaed3d64/src/tubes.py#L22-L37

However, this approach has two severe limitations.

First, the output contains topologically disconnected shells. I expected this to be resolved by setting ExportModes.FUSED on the Assembly.save method, unfortunately that does not help.

Second, the output contains no volumes. There doesn't seem to be a way to get around this without extending CadQuery in some way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions