Where to start to add option to trigger "Join objects" before mesh export?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
samudge
Posts: 16
Joined: Fri Nov 19, 2021 11:45 am

Where to start to add option to trigger "Join objects" before mesh export?

Post by samudge »

I had mentioned this in a vaguely-related post, but here is my current issue:

I have a lot of multi-component parts comprised of multiple adjacent (and topologically complex) smaller parts. I wish to export them as a joined part (no internal surfaces on shared/"joined" faces).

However, adding a "Join objects" command severely increases computation time for my part. From like 5-6 seconds of computation to 30-50 seconds. It really makes adjusting the parameters a major PITA.

So for the time being, I simply use an Std Part container for all of the sub-components, select the entire container, and export the mesh of the part that way. The final exported STL looks okay on the outside, but there are a lot of redundant interior surfaces which show up as errors on multiple 3D printing slicers.

I want to make a plugin which either triggers a temporary "Join objects" command on a cached/buffered copy of the to-be-exported selection, right before export (during the actual export process), or add it as an option to my fork of FreeCAD.

Where in the code-base should I inject this kind of process? I got a good explanation of how to hook into the export process here (https://forum.freecadweb.org/viewtopic.php?f=10&t=64225) with a plugin, but being able to cache a selected object/part and apply an arbitrary set of temporary commands to it before exporting seems a bit more complex.
Post Reply