Wavefront OBJ exporter

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!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Wavefront OBJ exporter

Post by vocx »

sgrogan wrote: Wed Oct 09, 2019 10:01 pm ...
Pasteing the same in code tags fixes it?
Oh, this is very bad. Indeed spaces and tabs shouldn't be mixed. It's not fixed, the tabs are still there, although both the forum and GitHub display them as 8 spaces by default. If you can submit a pull request for that, that would be good. Four spaces indentation should be the norm. That's what is used in the big Python workbenches like Draft, Arch, and FEM.
vejmarie wrote: Mon Oct 07, 2019 6:42 pm Just posted my code through PR #2593. It is improving current implementation into Arch
Ping.
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.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Wavefront OBJ exporter

Post by yorik »

wmayer
Founder
Posts: 20322
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Wavefront OBJ exporter

Post by wmayer »

Oh, this is very bad. Indeed spaces and tabs shouldn't be mixed. It's not fixed, the tabs are still there, although both the forum and GitHub display them as 8 spaces by default
When looking at the code of the PR you can see that the indentation is inconsistent and when selecting the highlighted code you can see that these are tabs.

Anyway, it's good that Py3 raises an error now compared to Py2 where this was allowed. There the behaviour could be quite unexpected when in the editor tab size is set to 4 characters instead of 8.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Wavefront OBJ exporter

Post by vocx »

yorik wrote: Thu Oct 10, 2019 1:55 pm Fixed in git commit 04f87588b0
I think the fix isn't entirely correct.

It should be

Code: Select all

if not curves:
    myshape = obj.Shape.copy(False)
    myshape.Placement=obj.getGlobalPlacement()
    mesh=MeshPart.meshFromShape(Shape=myshape, LinearDeflection=0.1, AngularDeflection=0.7, Relative=True)
and

Code: Select all

except: # unimplemented curve type
    myshape = obj.Shape.copy(False)
    myshape.Placement=obj.getGlobalPlacement()
    mesh=MeshPart.meshFromShape(Shape=myshape, LinearDeflection=0.1, AngularDeflection=0.7, Relative=True)
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.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Wavefront OBJ exporter

Post by sgrogan »

"fight the good fight"
Post Reply