High resolution drawings in FreeCAD

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: High resolution drawings in FreeCAD

Post by chrisb »

As said before, you shouldn't rely on TechDraw. Export the dxf directly!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: High resolution drawings in FreeCAD

Post by Roy_043 »

chrisb wrote: Mon Dec 20, 2021 9:20 pm Export the dxf directly!
The problem with that approach is that a parabola will not be exported as a curve, but as a faceted approximation. Maybe the parabola can be converted to a spline in FreeCAD?
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: High resolution drawings in FreeCAD

Post by chrisb »

I see. I will do some experiments.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53922
Joined: Tue Mar 17, 2015 9:14 am

Re: High resolution drawings in FreeCAD

Post by chrisb »

Roy_043 wrote: Mon Dec 20, 2021 9:47 pmMaybe the parabola can be converted to a spline in FreeCAD?
This works out very well:
- edit the sketch
- select the parabola
- "Convert geometry to B-spline"
- export the sketch as dxf

After import it shows a smooth B-spline, after setting Deviation to a small enough value.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
cadmar2021
Posts: 15
Joined: Fri Dec 17, 2021 9:11 pm

Re: High resolution drawings in FreeCAD

Post by cadmar2021 »

Bingo! Thanks vm4dim,
vm4dim wrote: Mon Dec 20, 2021 8:10 pm Try export Sketch to SVG
That actually works very well. I had tried that before but had forgotten that this format is a vector format (geometric construct) and therefore scalable. I loaded it in GIMP which allows to set the resolution upon import. I increased the resolution to 500PPI (0.002") and I had a high resolution bitmap which is exportable to PDF and can be sent to a printer! Once printed, the scale can be verified by measuring the distance between reference points in the drawing and the image scaling readjusted (x and y directions) to compensate for printer distortions.
Thank you all for your inputs!
cadmar2021
Posts: 15
Joined: Fri Dec 17, 2021 9:11 pm

Re: High resolution drawings in FreeCAD

Post by cadmar2021 »

chrisb wrote: Mon Dec 20, 2021 10:06 pm
Roy_043 wrote: Mon Dec 20, 2021 9:47 pmMaybe the parabola can be converted to a spline in FreeCAD?
This works out very well:
- edit the sketch
- select the parabola
- "Convert geometry to B-spline"
- export the sketch as dxf

After import it shows a smooth B-spline, after setting Deviation to a small enough value.
I'll have to try this too. You import where and adjust the Deviation where?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: High resolution drawings in FreeCAD

Post by wmayer »

From the comments in the source code, this was a choice of the programmer that concluded that since the display could not resolve higher resolution that this was not necessary.... wrong!
Which comments? Anyway, I implemented a Python wrapper for the "hidden-line-removal" algorithm of the CAD kernel that allows me to use it directly without fearing that there is any pre- or post-processing step that reduces the quality.

Here is the script that does the same as the TechDraw function:

Code: Select all

shape = App.ActiveDocument.Pad.Shape

hlr = Part.HLRBRep.Algo()
hlr.add(shape)
hlr.update()
hlr.hide()

res = Part.HLRBRep.HLRToShape(hlr)
v = res.vCompound()
Part.show(v)
v.Edge1.Curve.Degree # this gives 1
So, it's the CAD kernel to blame to create the 1 degree spline. Looking at the interfaces of the involved classes I didn't find a way to influence the output.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: High resolution drawings in FreeCAD

Post by onekk »

wmayer wrote: Tue Dec 21, 2021 10:00 am Here is the script that does the same as the TechDraw function:

Code: Select all

hlr = Part.HLRBRep.Algo()
res = Part.HLRBRep.HLRToShape(hlr)

Sorry for the intrusion, but what version of FreeCAD include "Part.HLBRep..."

I have just downloaded latest 0.20 AppImage, and I don't find it. (At least searching in the Python Console autocompletion).

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.26683 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0388fbc)
Hash: 0388fbc98d49d874fb341b9037a743bc691d501f
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: Italian/Italy (it_IT)

Maybe I was doing something wrong.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: High resolution drawings in FreeCAD

Post by wmayer »

onekk wrote: Tue Dec 21, 2021 12:02 pm Sorry for the intrusion, but what version of FreeCAD include "Part.HLBRep..."
It's always the latest :D

Or to be more precise you need:
Version: 0.20.26711
Hash: git commit 73a986714c106a
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: High resolution drawings in FreeCAD

Post by onekk »

wmayer wrote: Tue Dec 21, 2021 1:09 pm It's always the latest :D

Or to be more precise you need:
Version: 0.20.26711
Hash: git commit 73a986714c106a
OK I have to wait untill the weekly build is updated.

Maybe after Christmas :-D

Merry Christmas to you and thanks for your work.

Best Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply