Feature #2335: export in .obj file should use the objects labels

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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

issue #2335: export in .obj file should use the objects labels (Related is also issue #2336: importing .obj file should use the object names as labels)
Looks like a user named damian in the bug tracker offered a fix. His repo link is 404 (his github user is @caceres
Maybe someone can ping him on github ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

bump
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

Should we keep pursuing this ticket or close?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

please advise
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #2335: export in .obj file should use the objects labels

Post by Kunda1 »

feedback from the community is welcome...
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature #2335: export in .obj file should use the objects labels

Post by chrisb »

Would be nice to have. Another good choice is to propose the FreeCAD filename prefix.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
cadfunforfweeee
Posts: 1
Joined: Sun Oct 17, 2021 6:29 am

Re: Feature #2335: export in .obj file should use the objects labels

Post by cadfunforfweeee »

On Ubuntu Linux 20.04 (e.g. installed using apt-get install freecad), all you have to do is edit ./src/Mod/Arch/importOBJ.py and change "obj.Name" to "obj.Label" where it gets written to a file (search for outfile.write).

Not sure if it's possible/if issues can arise using non-unique object labels in FreeCAD or what might happen in a Wavefront OBJ file with duplicate object names (or for import?) but this works a charm.

If you know how to use git/diff/patch, git diff fix against master branch commit 0926a4148bcff11249fd4f56bc30256102ffe105 below:

diff --git a/src/Mod/Arch/importOBJ.py b/src/Mod/Arch/importOBJ.py
index 0dd361d186..2cd5a156dd 100644
--- a/src/Mod/Arch/importOBJ.py
+++ b/src/Mod/Arch/importOBJ.py
@@ -208,7 +208,7 @@ def export(exportList,filename,colors=None):
else:
offsetv += len(vlist)
offsetvn += len(vnlist)
- outfile.write("o " + obj.Name + "\n")
+ outfile.write("o " + obj.Label + "\n")

# write material
m = False
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature #2335: export in .obj file should use the objects labels

Post by chrisb »

Since my last post the naming of export files was improved.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply