[Improvement] Autofill name and date in template

Discussions about the development of the TechDraw workbench
vocx
Posts: 2328
Joined: Thu Oct 18, 2018 9:18 pm

[Improvement] Autofill name and date in template

Postby vocx » Sat Oct 20, 2018 4:15 am

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 920 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.
chrisb
Posts: 20531
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Postby chrisb » Sat Oct 20, 2018 6:07 am

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.
Jee-Bee
Posts: 1978
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: [Improvement] Autofill name and date in template

Postby Jee-Bee » Sat Oct 20, 2018 7:21 am

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
Posts: 2328
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Improvement] Autofill name and date in template

Postby vocx » Sat Oct 20, 2018 7:29 am

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.
vocx
Posts: 2328
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Improvement] Autofill name and date in template

Postby vocx » Sat Oct 20, 2018 7:37 am

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.
chrisb
Posts: 20531
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Postby chrisb » Sat Oct 20, 2018 8:05 am

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.
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

Postby carbonblueGTS » Sun Jan 20, 2019 5:33 am

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
Posts: 20531
Joined: Tue Mar 17, 2015 9:14 am

Re: [Improvement] Autofill name and date in template

Postby chrisb » 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.
User avatar
wandererfan
Posts: 3319
Joined: Tue Nov 06, 2012 5:42 pm

Re: [Improvement] Autofill name and date in template

Postby wandererfan » Mon Jan 21, 2019 2:24 pm

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

Postby carbonblueGTS » Mon Jan 21, 2019 3:23 pm

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?