[Feature Request] Creation of the Template as FreeCAD object

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
tobiasfalk
Posts: 93
Joined: Fri Feb 05, 2021 2:35 pm

[Feature Request] Creation of the Template as FreeCAD object

Post by tobiasfalk »

Hi,
There is the problem that if you export as a PDF the text of the Template is converted in to lines and not as text(https://forum.freecadweb.org/viewtopic.php?f=35&t=69791). I know that this is because of a Qt problem, but it would be nice if there where a way to create the templates not as SVG and import that but as a FreeCAD object, further more it would be nice if it was possible to use a existing format like that of the KiCAD community(but pleas theta for the version 7/6.99 so that the font can be selected), this would make us of these two easier and it would save the trouble of creating a template drawer or something like that.
Summery:
  • A way to create the templates as FreeeCAD objects
  • Use of KiCAD(7/6.99) template format
Greetings
Tobias Falk
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by wandererfan »

tobiasfalk wrote: Wed Jul 27, 2022 10:44 am it would be nice if there where a way to create the templates not as SVG and import that but as a FreeCAD object,
I think this was planned for by the original author (Luke Parry), but not completely implemented. There is some code for a template based on TD geometry instead of SVG, but it hasn't been touched since 2014. Based only on a quick look, it would need some love to be useful.
it would be nice if it was possible to use a existing format like that of the KiCAD community
I'll have to do some research on this one before I can make a sensible comment.
User avatar
tobiasfalk
Posts: 93
Joined: Fri Feb 05, 2021 2:35 pm

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by tobiasfalk »

I'll have to do some research on this one before I can make a sensible comment.
The KiCAD template is a simple text file where it is written where a line is and so on.I'll have to do some research on this one before I can make a sensible comment.I'll have to do some research on this one before I can make a sensible comment.

Code: Select all

(kicad_wks (version 20220228) (generator pl_editor)
  (setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)
  (left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
  (line (name "") (start 276.0022 192.0072) (end 268.0022 192.0072))
  (rect (name "") (start 276.0022 190.0072) (end 268.0022 187.0072))
  (tbtext "Text" (name "") (pos 276.0022 184.0072))
  (tbtext "Text 2" (name "") (pos 263.002 184.007))
  (tbtext "Text 3" (name "") (pos 251.002 184.007) (font (face "KiCad Font") bold italic))
  (tbtext "Text" (name "") (pos 0 0))
)
Attachments
KiCAD_Template_example.kicad_wks.txt
you need to remove the .txt, this is because it didn'nt allow me to upload it without it
(569 Bytes) Downloaded 22 times
KiCAD_Template_example.pdf
(3.57 KiB) Downloaded 45 times
User avatar
Shalmeneser
Veteran
Posts: 9474
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by Shalmeneser »

It's just plain text.
But a svg file is way more powerful.
User avatar
tobiasfalk
Posts: 93
Joined: Fri Feb 05, 2021 2:35 pm

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by tobiasfalk »

The problem with using SVG's as Templates is that the Text in the SVG's is not printeted as Text when exported as PDF.(https://forum.freecadweb.org/viewtopic.php?f=35&t=69791)
The next thing is that it would just be nice to have one Templateformate for both KiCAD and FreeCAD.
Last edited by tobiasfalk on Thu Jul 28, 2022 9:44 pm, edited 1 time in total.
User avatar
Shalmeneser
Veteran
Posts: 9474
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by Shalmeneser »

tobiasfalk wrote: Thu Jul 28, 2022 9:41 pm The problem with using SVG's as Templates is that the Text in the SVG's is not printeted as Text when exported as PDF.
This is a real problem.
Laurie Hartley
Posts: 522
Joined: Mon Feb 27, 2017 5:33 am
Location: Australia

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by Laurie Hartley »

Recently on another thread Wandererfan very kindly helped me clean up my own personal svg template and explained the how to’s using Inkscape. I must admit that I have no knowledge of Inkscape and struggled with the user interface.

However during the course of exploring this question of developing personal templates I came across this very good YouTube tutorial which describes how you can create a template in the Draft workbench and open it in the Techdraw workbench. When your drawing is finished it can be exported to pdf without any problems.

https://youtu.be/th3n5M10nYA

I was very impressed with this approach and will delve into it a bit further next week. I can’t see a lot of downside to this approach really. I wonder what others views are?
User avatar
tobiasfalk
Posts: 93
Joined: Fri Feb 05, 2021 2:35 pm

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by tobiasfalk »

Laurie Hartley wrote: Fri Aug 05, 2022 3:44 am Recently on another thread Wandererfan very kindly helped me clean up my own personal svg template and explained the how to’s using Inkscape. I must admit that I have no knowledge of Inkscape and struggled with the user interface.

However during the course of exploring this question of developing personal templates I came across this very good YouTube tutorial which describes how you can create a template in the Draft workbench and open it in the Techdraw workbench. When your drawing is finished it can be exported to pdf without any problems.

https://youtu.be/th3n5M10nYA

I was very impressed with this approach and will delve into it a bit further next week. I can’t see a lot of downside to this approach really. I wonder what others views are?
Yes seams like a nice WORKATOUND, but its still a workaround and not somthing that I think that should be a permanent solution.
The Problems thet I see with this solution:
  • There is no real way to save a template
  • There is no nice way to fill the fields of the template
  • It fills your work area(the Objekt list)
These are the Problems that I see with this solution and I rather use the curren SVG solution than this.
Laurie Hartley
Posts: 522
Joined: Mon Feb 27, 2017 5:33 am
Location: Australia

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by Laurie Hartley »

tobiasfalk wrote: Fri Aug 05, 2022 4:54 am The Problems thet I see with this solution:
  • There is no real way to save a template
  • There is no nice way to fill the fields of the template
  • It fills your work area(the Objekt list)
These are the Problems that I see with this solution and I rather use the curren SVG solution than this.
Thanks for the feedback - I haven't looked into this in depth as yet but I will -paying particular attention to your list. I will follow this thread because a solution will take this workbench and FreeCAD in general to another level.
User avatar
bensay
Posts: 202
Joined: Wed Dec 22, 2021 8:14 pm
Location: Danmark
Contact:

Re: [Feature Request] Creation of the Template as FreeCAD object

Post by bensay »

I personally see this as a very low prioritized problem. While it can be annoying that the text gets outputted as paths and not text, there is a workaround as I earlier mentioned:
bensay wrote: Sat Jul 30, 2022 5:29 pm @wandererfan @tobiasfalk
So apparently, there is a workaround made for SVG: https://github.com/FreeCAD/FreeCAD/blob ... #L731-L733.

A workaround for you then is to export as SVG and then convert the SVG to PDF
And honestly, the workaround is EASY: you don't even need to open InkScape graphically
  1. Export page as SVG
  2. Run the command inkscape --export-type="pdf" --export-filename="page.pdf" page.svg
I don't see any advances in using the KiCad template format rather than SVG:
- SVG is close to unlimited in terms of function of what is needed
- While InkScape (to some users) can be difficult to use, it is no different from making a KiCad template: a plain SVG takes as much effort to code manually as a KiCad template
(Also, if it has been possible for the user to use FreeCAD with bodies, sketches, workbenches, and pockets, then making a simple template with lines and a logo in InkScape should be to overcome - and templates by FreeCAD is even provided)

To create templates as FreeCAD objects seems like a heavy coding job. I believe it would be easier to implement the workaround I mentioned above into FreeCAD (so FreeCAD internally creates the PDF from a Qt exported SVG.

So while I recognize that it is an issue to users, I consider this a very low prioritized issue by making templates FreeCAD objects and using KiCad style templates instead:
  • There is a workaround (first SVG, then convert to PDF)
  • Implementing the workaround internally is easier than converting all templates to FreeCAD objects (I believe)
  • SVG got all needed functions - KiCad style has limits
  • SVG is equivalent to code as Kicad style - only difference is syntax. Meanwhile, SVG can also be edited graphically in InkScape
Post Reply