I know it might be too premature but in the sticky post in the forum it said to post what I'm planning to do before I submit code. I'll probably use the wrong terminology because I'm new to this, feel free to correct me.
At the moment you can export your project as a wavefront obj file and import it to, for example, blender. The python script at the moment doesn't recognize multi-materials when applied to windows and everything gets exported as a single object.
I did some experiments in the python console to figure out how the window object was stored and think I can find the shapes of the individual components (frames, panels, etc..). I was thinking of implementing something along the line of: "If there's a multi-material and the object is a window => export the child shapes separately and find the material in the multi-material".
If that works maybe I can extend it to when there are hinges defined, freecad could then also optionally export it as a separate object/group in the obj format. In that case there are still several manual steps involved. When importing it in your 3d program, you need to parent that (sub)object to an empty axis node and then rotate it if you needed that in an animation. I'm not sure about the usefulness of this feature, but at that point we already have the code to split the window object apart if needed.
export wavefront obj file: support multi-materials in a window object (arch)
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: export wavefront obj file: support multi-materials in a window object (arch)
As someone who once did exactly that, FreeCAD to Blender through OBJ, I think any improvements that you can do are very welcome.Nocturnial wrote: ↑Thu Aug 15, 2019 2:32 pm At the moment you can export your project as a wavefront obj file and import it to, for example, blender. The python script at the moment doesn't recognize multi-materials when applied to windows and everything gets exported as a single object.
See Tutorial Render with Blender. At the end of that Tutorial there is mention of the Blender plugin to import FreeCAD files directly, that is, without using OBJ as an intermediate format.
If your objective is to improve Blender-FreeCAD integration, probably your efforts should be made on improving that plugin. If you just want to improve the OBJ importer-exporter of FreeCAD, then by all means go ahead and improve Arch's importOBJ.py.
I suggest you ask in the Draft, Arch, BIM subforum as that is where people usually discuss Arch topics.I did some experiments in the python console to figure out how the window object was stored...
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: export wavefront obj file: support multi-materials in a window object (arch)
Looks like a good plan! Indeed any bettering there is welcome. I'm curious if obj doesn't support having more than one material per object? If not, then indeed your proposed way seems the best way to go.Nocturnial wrote: ↑Thu Aug 15, 2019 2:32 pm I was thinking of implementing something along the line of: "If there's a multi-material and the object is a window => export the child shapes separately and find the material in the multi-material".
If that works maybe I can extend it to when there are hinges defined
About hinges, it might not be too hard either, you could just grab the solids that are under a same hinge, then place their blender pivot point at the midpoint of the hinge... That would make them pretty easy to open in Blender...
But indeed if your only purpose is Blender, the FreeCAD-to-Blender importer might be more interesting to you..