Is there a setting for export resolution?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
pnt103
Posts: 4
Joined: Sun Aug 18, 2019 12:15 pm

Re: Is there a setting for export resolution?

Postby pnt103 » Mon Aug 19, 2019 11:03 am

Sure, I can see that the Mesh WB provides finer control and I've not disputed that. I know once you tell me so. But it's not at all obvious that, having designed a perfectly well defined part or set of parts using the Parts WB, anyone should not use the obvious export function but instead add another, unexpected, set of operations in order to get the file they want.

I'd also point out that the commonly suggested advice to change the Shape View settings in the Part Design WB preferences is completely irrelevant because they have no effect on the STL export resolution, and further, that the omission of the Mesh Formats settings in Import-Export until the user has done a non-obvious thing (importing some random STL file before they can export the one they want) seems a bit, well, daft. If the user can't see the Mesh Format settings, how would they know they could/should change them...
chrisb
Posts: 24369
Joined: Tue Mar 17, 2015 9:14 am

Re: Is there a setting for export resolution?

Postby chrisb » Mon Aug 19, 2019 2:04 pm

pnt103 wrote:
Mon Aug 19, 2019 11:03 am
If the user can't see the Mesh Format settings, how would they know they could/should change them...
They could read the docs or ask in the forum.
pnt103
Posts: 4
Joined: Sun Aug 18, 2019 12:15 pm

Re: Is there a setting for export resolution?

Postby pnt103 » Mon Aug 19, 2019 5:20 pm

Sigh. Yes, but how would they know to ask that specific question if they have no idea the Mesh Format setting exists? The usual question is simply along the lines of "How do I change the STL resolution", and this thread is the first and only place I've seen an answer involving the Mesh Format setting. As for reading the documentation, the page about "Export to STL" is actually incorrect, or at least misleading, because it talks about "the tessellation is controlled by the overall display tessellation set in Edit → Preferences... → Part Design → Shape view" - and that doesn't work for the Export in the File menu. Trust me, I've played about with that quite a lot in the last 48 hours.
RatonLaveur
Posts: 693
Joined: Wed Mar 27, 2019 10:45 am

Re: Is there a setting for export resolution?

Postby RatonLaveur » Mon Aug 19, 2019 5:58 pm

Actually, there are several threads addressing this in some shape or form. In fact, reading this I thought "well here goes another time one of the key Freecad contributors will repeat the answer...". But often looking for a forum answer is a depency of being able to word the question and use the correct terminology, which to be fair, if you don't know the answer it's likely you didn't know the terminology either...the snake bites its own tail.

The three key tesselation settings i know of are the Viewport Shape setting, the stl export mesh accuracy and the PathWB toolpath tolerance.

Each are to some extent dependant on the other depending on cases. Or correct me if I'm wrong.
I know that for example the PathWB contributors (specifically Sliptonic) recently hardcoded automated tesselation meshing at a high accuracy level for some of the operations.

It's also necessary for some people to quickly access viewport tesselation to handle large models and then revert the setting to operate on them more accurately. That can prove to be a hassle.

I was thinking of a unified Preferences tab called "accuracies" or something similar in which everytime a workbench contributor would create such an accuracy setting you'd have access to it there with tooltip of where it has an impact. For one I'm not sure this is a good idea, for second I've often heard "i want does not get".

Lucky for us, for now, we have patient teachers and doers like ChrisB.
chrisb
Posts: 24369
Joined: Tue Mar 17, 2015 9:14 am

Re: Is there a setting for export resolution?

Postby chrisb » Tue Aug 20, 2019 6:55 am

pnt103 wrote:
Mon Aug 19, 2019 5:20 pm
As for reading the documentation, the page about "Export to STL" is actually incorrect, or at least misleading, because it talks about "the tessellation is controlled by the overall display tessellation set in Edit → Preferences... → Part Design → Shape view" - and that doesn't work for the Export in the File menu. Trust me, I've played about with that quite a lot in the last 48 hours.
So at least the documention should be updated. Would you mind doing this?
jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Is there a setting for export resolution?

Postby jmaustpc » Tue Aug 20, 2019 9:27 am

pnt103 wrote:
Mon Aug 19, 2019 11:03 am
Sure, I can see that the Mesh WB provides finer control and I've not disputed that. I know once you tell me so. But it's not at all obvious that, having designed a perfectly well defined part or set of parts using the Parts WB, anyone should not use the obvious export function but instead add another, unexpected, set of operations in order to get the file they want.
Of course its obvious, you start talking about or using a mesh and there is a Mesh workbench in FreeCAD by default and you don't think "Oh maybe I should look and see what the Mesh WB does?" If you have a perfectly designed part and you export it to a lossy format like STL you have by definition made it not perfectly defined. Obviously people use STL a lot for 3d printing but it is still a lossy format by definition.

Anyway as I said earlier "it depends" on your FreeCAD version. It also depends on what workbench you are talking about. This area was changed since this topic was started nearly 4 years ago! Literally tens of thousands of updates to FreeCAD since then.

As I said earlier, if you just go to the file menu and export, FreeCAD just creates a STL file from the visualisation mesh. The mesh tessellation was earlier simply defined from the FreeCAD PartDesign WB visualisation setting. There was a feature request ofor on STL export to collect that value from the individual PartDesign "Body" objects' individual visualisation "property" rather than the FreeCAD setting value, which is what happens now IF we are talking about exporting a PartDesign Body object. If we are talking about Part WB objects, then the value is still collected from the PartDesign visualisation setting as previously explained.

Further, if your mesh values don't seem to be changing in either case, then it is most likely because you have not forced a recompute of the solid object after the value was changed.

The property is found by clicking on the Body object, then View tab of the property editor in the Combo View, then look for "Deviation".

I have tested in the version below and it works as expected.

If you want more control of the generated mesh then go to the Mesh WB and use its tools, see "create a mesh from a solid".

In the future please follow the forum rules link above and post your version data in the manner explained.

If you notice some issue in the documentation then post a link to the page you are talking about and save us having to guess.


OS: Ubuntu 18.04.3 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Is there a setting for export resolution?

Postby jmaustpc » Tue Aug 20, 2019 9:53 am

Also a hint, the smaller the value then the smaller the triangles, hence more triangles, hence higher precision.
RatonLaveur wrote:
Mon Aug 19, 2019 5:58 pm
I was thinking of a unified Preferences tab called "accuracies" or something similar in which everytime a workbench contributor would create such an accuracy setting you'd have access to it there with tooltip of where it has an impact. For one I'm not sure this is a good idea, for second I've often heard "i want does not get".
A specific precision value but its not always appropriate for all tools etc.

FreeCAD is designed from the beginning to be modular and extensible, many of the "add-ons" are third party etc. The workbench must be initialised before its properties will be visible, even if it is a standard WB, this has been the case for many years, presumably always was. Load times and memory usage would both be effected if all workbenches were always loaded.
RatonLaveur wrote:
Mon Aug 19, 2019 5:58 pm
Lucky for us, for now, we have patient teachers and doers like ChrisB.
Yes, indeed. :)

Anyway I am just finishing cooking dinner, I made roast pork and veggies, I just now pulled out the pork to rest, and the crackling worked perfectly. Yum. :)
pnt103
Posts: 4
Joined: Sun Aug 18, 2019 12:15 pm

Re: Is there a setting for export resolution?

Postby pnt103 » Tue Aug 20, 2019 12:00 pm

Well, it may be obvious to a FreeCAD guru that one should only use the Mesh WB to creates STLs. It was not at all obvious to me, and evidently (from the number of hits in Google) to very many others, that using that extra step rather than the very obvious "Export" entry in the File menu would be necessary. To me, and probably many others, Mesh WB initially suggests the sort of post-processing one might otherwise do in, for example MeshMixer for sculpting or plane slicing or mesh repair.

When I first started using FreeCAD some time ago and used the Export entry in the File menu, at first all seemed fine, largely because I was creating simple rather angular objects. When I added curves, I discovered the resolution issue, but since my slicer (Cura) can handle FreeCAD .FCstd files itself, I just switched to doing that. It was only last week that I discovered a problem with a particular object where a set of vertical edges were not rendered vertical in the slicer. I first thought I might have inadvertantly mis-edited a sketch (the object was partly made by lofting with five sketches containing some lines constrained to be parallel) but that wasn't the case, and FreeCAD itself displayed the object correctly. That's when I went back to the Export STL function for the first time recently, and then the verticals came out correctly in the slicer - but the tesselation problem came back too.

So my slicer would seem to be, um, less than perfect, hence my investigation into STL resolution. I can assure you that last week, when this happened, I was using the current stable release of FreeCAD, and still am. Fair point, I should have mentioned this:

Code: Select all

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16131 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
In fact that's still the current stable release for Windows; I just checked.

I also point out that I checked what was happening with mesh resolution very carefully, and made sure to force a recompute when I changed the settings. Yes, I did read the paragraph about that.

The documentation I referred to is, as I clearly stated, the FreeCAD page "Export to STL or OBJ", which you can reach directly at https://www.freecadweb.org/wiki/Export_to_STL_or_OBJ or simply by typing "Export to STL" into Google - it's the first hit.

So anyway I've gone back into FreeCAD to double-check all this with several widely-differing deviation values. And guess what - sometimes it works, sometimes it doesn't. So it's not even consistent (at least not in a way I can determine). :( And it didn't work before I imported an STL and looked at the previously-missing Mesh Format tab under Import-Export.

Anyway, that's the limit of my patience for testing. Having found the Mesh Formats tab and having marked bodies to recompute and stabbed the F5 key until it hurts, I've got a solution that may not be the "right" one or the "best" one but which work for me, for now.
jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Is there a setting for export resolution?

Postby jmaustpc » Tue Aug 20, 2019 1:37 pm

pnt103 wrote:
Tue Aug 20, 2019 12:00 pm
which you can reach directly at https://www.freecadweb.org/wiki/Export_to_STL_or_OBJ
thank you for posting the link. The page is correct its just out of date, so most of the data is correct however now two things have changed 1) the tessellation value can now be set for an individual item in its view properties "deviation" and 2) a new feature has been added to allow you to right click on an object or complete project and mark it for recompute, you then have to click the recompute icon for it to actually be recomputed.

So if you use the file menu ...export simplistic STL export method, just change the deviation property to whatever you want for your specific solid, then mark for recompute, recompute, then select the solid and file ..export. Don't go into edit ...preferences. If you just do this you should have no problems....don't edit your preferences or if you do, go back and manually change the values again for the individual solid you want to export.

However if you go into Edit...preferences.. when you save anything, the default value in PartDesign ... Shape view...Tessellation.."maximum deviation depending on model bounding box"... is forced into all your solids Deviation properties in your project. Even if you have not changed that value but change any other preference then save, all your solids will be given the deviation value in the settings not whatever you might have individually changed them two.

This applies to all Part and PartDesign objects. FreeCAD is fighting between default and custom values for that view deviation property. I am going to write up a bug report on this aspect of this.

I have tested in the two versions below.


OS: Ubuntu 18.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.3.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)


OS: Ubuntu 18.04.3 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
TomB19
Posts: 43
Joined: Wed May 01, 2019 4:58 am

Re: Is there a setting for export resolution?

Postby TomB19 » Mon Oct 28, 2019 10:45 pm

I appreciate the great info in this thread.

Setting the "Maximum deviation...." to 0.01%, from 5%, was a great boost arc quality. See the attached pic for before/after comparison.

Mostly, I don't mind the faceted curves that come out of FreeCAD. I have no interest in pretending the objects are organic. Faceted output is generally fine. This is a great new tool, though.

By the way, I find no change to the user experience with this parameter set to finest resolution. My designs aren't particularly complex, though. My CPU is an old AMD A10-6700 so you would think I'd notice the hit.

IMG_20191028_155359.jpg-small.jpg
IMG_20191028_155359.jpg-small.jpg (196.09 KiB) Viewed 402 times