[Improvement] Autofill name and date in template

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

[Improvement] Autofill name and date in template

Post by vocx »

In Catia the Drawing workbench auto-fills certain text fields in the Page Templates that come with the software. TechDraw could do the same.
FreeCad_TechDraw_autofill.png
FreeCad_TechDraw_autofill.png (24.86 KiB) Viewed 4174 times
The usage would be something like a button in the TechDraw toolbar to open a dialog with the fields that can be written in the page template. It could also have a button in this dialog to automatically fill at least Author Name (the username which the operating system would report), Date (taken from some Qt function), and Title (file name or part name). Another option is to right click the field in the page itself (highlighted in green) which would open a menu to choose Author name, Date, Page Number, etc.

I think in order to implement this well, each SVG Template should use a standardized name for the fields, for example, FC_AUTHOR, FC_DATE, FC_DRAWING_NAME, FC_SCALE, etc. The current Templates (A0 to A4) already include some of these fields, but I'm not sure if they have been standardized yet.

Catia can save arbitrary variables with text or numerical values; the values can be used to compute distances for use in sketches or elsewhere, and the text can be used in the text fields in the Drawing pages. Maybe in FreeCAD the same could be done by storing information in a Spreadsheet (Spreadsheet_Workbench); TechDraw could then read the variables and auto-fill the Templates as long as they have standard names.
Last edited by vocx on Sat Oct 20, 2018 7:30 am, edited 1 time in total.
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.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Post by chrisb »

vocx wrote: Sat Oct 20, 2018 4:15 am The usage would be something like a button in the TechDraw toolbar to open a dialog with the fields that can be written in the page template. It could also have a button in this dialog to automatically fill at least Author Name (the user name which the operating system would report),
You should use the Author name from FreeCAD's preferences.
vocx wrote: Sat Oct 20, 2018 4:15 am Catia can save arbitrary variables with text or numerical values; the values can be used to compute distances for use in sketches or elsewhere, and the text can be used in the text fields in the Drawing pages. Maybe in FreeCAD the same could be done by storing information in a Spreadsheet (Spreadsheet_Workbench); TechDraw could then read the variables and auto-fill the Templates as long as they have standard names.
I don't like too much automatism, but for your personal use you can write a macro.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: [Improvement] Autofill name and date in template

Post by Jee-Bee »

vocx wrote: Sat Oct 20, 2018 4:15 am I think in order to implement this well, each SVG Template should use a standardized name for the fields, for example, FC_AUTHOR, FC_DATE, FC_DRAWING_NAME, FC_SCALE, etc. The current Templates (A0 to A4) already include some of these fields, but I'm not sure if they have been standardized yet.
creo have something similar but get all info some properties.

Would be a great addition!! maybe FC should find a( or more) method to find common model properties so it would be usble for all workbenches!!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Improvement] Autofill name and date in template

Post by vocx »

chrisb wrote: Sat Oct 20, 2018 6:07 am You should use the Author name from FreeCAD's preferences.
Sure, I think that'd work. Author, Company or Organization, and Date would be the three most important values to keep updated, I think.
I don't like too much automatism, but for your personal use you can write a macro.
I think it's personal preference. I think many people would benefit from having the date automatically updated in the TechDraw Page with a simple click of a button. Writing a personal macro would be unnecessary if it can be included in the workbench itself. As with many tools that are part of FreeCAD you may decide to not use autofill at all; it'd be entirely optional.
Last edited by vocx on Tue Oct 23, 2018 5:01 pm, edited 1 time in total.
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.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Improvement] Autofill name and date in template

Post by vocx »

Jee-Bee wrote: Sat Oct 20, 2018 7:21 am creo have something similar but get all info some properties.

Would be a great addition!! maybe FC should find a( or more) method to find common model properties so it would be usble for all workbenches!!
A Preference object associated with a model. Or as I suggested, a Spreadsheet that has key-value pairs with different information. Then the specific workbenches would read the information off this spreadsheet.
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.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Post by chrisb »

I didn't mean that using the date would be too much automatism, but connecting it with a spreadsheet should be done by a personal macro.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
carbonblueGTS
Posts: 6
Joined: Fri Jan 18, 2019 8:20 pm
Location: Fort Worth, Texas

Re: [Improvement] Autofill name and date in template

Post by carbonblueGTS »

vocx wrote: Sat Oct 20, 2018 7:37 am A Preference object associated with a model. Or as I suggested, a Spreadsheet that has key-value pairs with different information. Then the specific workbenches would read the information off this spreadsheet.
How would you go about doing that? I have a spreadsheet with all the information. I was following this template: https://www.freecadweb.org/wiki/Manual: ... readsheets but for it to work, I have to be able to enter an expression. Editable fields don't allow for expressions, so I'm stuck. Thoughts?
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Post by chrisb »

carbonblueGTS wrote: Sun Jan 20, 2019 5:33 am Editable fields don't allow for expressions, so I'm stuck. Thoughts?
From the page you linked:
Although these results are expressed with their units, the values can be manipulated as any number, try for example entering in cell C1: =B1*2.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Improvement] Autofill name and date in template

Post by wandererfan »

Could somebody make a Feature Request for this so it doesn't get overlooked in v0.19 development?

Author and Company are available in Preferences>General>Document. Date is easy, but it shouldn't update automatically, just when the Page is changed? Page number could be the sequence number of the Page in the Document, but I'm not sure that is necessarily the desired Page number.

Not sure how we can enforce using the correct names for Template fields. I guess if you don't use the right names in your custom template then you don't get to use the auto-entry feature.
User avatar
carbonblueGTS
Posts: 6
Joined: Fri Jan 18, 2019 8:20 pm
Location: Fort Worth, Texas

Re: [Improvement] Autofill name and date in template

Post by carbonblueGTS »

chrisb wrote: Sun Jan 20, 2019 6:10 am
carbonblueGTS wrote: Sun Jan 20, 2019 5:33 am Editable fields don't allow for expressions, so I'm stuck. Thoughts?
From the page you linked:
Although these results are expressed with their units, the values can be manipulated as any number, try for example entering in cell C1: =B1*2.
I think I was unclear in what I was asking, my fault. If I have a value in a spreadsheet, I can currently reference that value in a sketch by clicking the "Expression" button and linking a cell from the spreadsheet like this:

Image

However, if I want a Techdraw template to auto-fill the fields based on the values in a spreadsheet, I can't do it because there's no "Expression" button:

Image

Is there a work-around for this?
Post Reply