View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002139 | Arch | Feature | public | 2015-06-01 15:06 | 2017-02-25 04:08 |
Reporter | yorik | Assigned To | yorik | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Platform | PC | OS | Debian | OS Version | Testing 64bit |
Summary | 0002139: Export materials to obj | ||||
Description | http://forum.freecadweb.org/viewtopic.php?f=8&t=10935 | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
Hi, Very cool work! Thanks for attacking that matter! So far it seems the right direction. One thing I would change, though: Instead of adding importMTL to the export types in InitGui.py, which forces the user to export twice, I would manage everything from inside importOBJ. We can add a preference setting, if needed so the user can choose wether he wants to import/export mtl files, but for me it's not necessary. We can always import/export the mtl file (that's what other apps do). So I would leave the mtl stuff inside importMTL.py, that's a good idea to separate, simply I would remove the line you added in InitGui.py. Instead, inside importOBJ, I would add something like this: import importMTL materials = importMTL.makeMAterialsList(exportlist) importMTL.export(materials,filename) After that we need to import MTL files too, if you have more courage ;) |
|
Excellent, well done! We don't need to worry too much about speed I think, because the user can use the standard OBJ importer from Mesh if needed. Now the delicate question is this: So far only Arch and FEM objects have support for materials. So what are we going to do with the materials from the obj file... Maybe creating "blank" Arch components with ArchCommands.makeComponent.. These can have materials. But then we need to convert the mesh data into Part Shapes, which can become heavy... |
|
great progress! I think creating meshes is the way to go, because 1) OBJ files will only contain meshes anyway, 2) converting meshes to shapes can be a very heavy operation and 3) there migth be no need, better to leave the user to decide. So I would do this first 1) only create meshes frpm the geometry 2) create one material object from each material in the MTL file. See how it works in Arch/ArchMaterial.py, but this is independent from Arch 3) After that is done, we can look at how to relate the meshes and the materials... |
|
Hi damian, great work! this is almost done! Be careful with the Part tessellate stuff at lines 295->300 because it can modify slightly the vertices positions (there is sometimes a kind of "rounding" happening with OCC) but I don't know a pure Mesh way to triangulate a face with more than 3 verts... wmayer might have an idea For your function at line 310, it is fine, you must just add this line: mat.Material = propDict You must just take care that your propDict contains ONLY string:string pairs (no ints or floats) |
|
Reminder sent to: wmayer |
|
Werner, any idea about the last post above? Thanks! |
|
hi https://github.com/caceres/FreeCAD/blob/aa2b74188f5e5d0edeed590aebe16bc7245a5944/src/Mod/Arch/importOBJ.py https://github.com/caceres/FreeCAD/blob/aa2b74188f5e5d0edeed590aebe16bc7245a5944/src/Mod/Arch/importMTL.py by |
|
Fix committed to master branch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-06-01 15:06 | yorik | New Issue | |
2015-06-01 15:06 | yorik | Status | new => assigned |
2015-06-01 15:06 | yorik | Assigned To | => yorik |
2015-12-03 12:47 | yorik | Note Added: 0006577 | |
2015-12-14 21:17 | yorik | Note Added: 0006610 | |
2016-01-03 18:59 | yorik | Note Added: 0006661 | |
2016-01-15 19:41 | yorik | Note Added: 0006717 | |
2016-01-15 19:41 | yorik | Note Added: 0006718 | |
2016-01-15 19:42 | yorik | Note Added: 0006719 | |
2016-01-19 14:41 | damian | Note Added: 0006734 | |
2016-01-22 09:31 | damian | Note Edited: 0006734 | |
2016-01-31 18:41 | yorik | Relationship added | has duplicate 0001300 |
2016-01-31 19:54 | damian | Note Edited: 0006734 | |
2016-02-03 07:13 | damian | Note Edited: 0006734 | |
2016-03-22 14:44 | yorik | Project | FreeCAD => Arch |
2016-03-22 14:45 | yorik | Summary | Arch - export materilas to obj => Export materilas to obj |
2017-01-24 02:33 | Kunda1 | Summary | Export materilas to obj => Export materials to obj |
2017-02-25 04:08 | yorik | Changeset attached | => FreeCAD master aab99ad9 |
2017-02-25 04:08 | yorik | Note Added: 0008428 | |
2017-02-25 04:08 | yorik | Status | assigned => closed |
2017-02-25 04:08 | yorik | Resolution | open => fixed |