Draft.string from a parameters (or expression)
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 2
- Joined: Tue Apr 09, 2019 9:21 am
Draft.string from a parameters (or expression)
Hello,
I'm looking for this function by so far, but until now I never found any thread or question about this.
I'm design a meccanical part, with some parameters taken from a spreadsheet object. I want to create different 3D printed samples with a different parameter (inclination), and reported it on the surface by a Draft.String object engraved.
Because this parameter is in the spreadsheet and used for three different expression in order to calculate the shape, would by very userfull if the string (the text) could by generated from that parameter, but I did't find any way to do it. Until now, the text in the string isn't generable with an expression (the expression icon is missing).
I started this project using the version 0.16, passing trough 0.17 beta, after a while the 0.17 stable and now I'm tring v0.19 from github, but never changed.
Also, I tried the way to use the string.string value as source, but isn't praticable, because it is a "string" type and the "expression" module seems to not have a casting function to convert it in float or integer.
Do anybody have the solution or tips?
Regards,
Andrea
Actual Freecad version:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16274 (Git)
Build type: Release
Branch: master
Hash: 7c760259a389b38b76da78e4f6e1f9be66714842
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Italian/Italy (it_IT)
I'm looking for this function by so far, but until now I never found any thread or question about this.
I'm design a meccanical part, with some parameters taken from a spreadsheet object. I want to create different 3D printed samples with a different parameter (inclination), and reported it on the surface by a Draft.String object engraved.
Because this parameter is in the spreadsheet and used for three different expression in order to calculate the shape, would by very userfull if the string (the text) could by generated from that parameter, but I did't find any way to do it. Until now, the text in the string isn't generable with an expression (the expression icon is missing).
I started this project using the version 0.16, passing trough 0.17 beta, after a while the 0.17 stable and now I'm tring v0.19 from github, but never changed.
Also, I tried the way to use the string.string value as source, but isn't praticable, because it is a "string" type and the "expression" module seems to not have a casting function to convert it in float or integer.
Do anybody have the solution or tips?
Regards,
Andrea
Actual Freecad version:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16274 (Git)
Build type: Release
Branch: master
Hash: 7c760259a389b38b76da78e4f6e1f9be66714842
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Italian/Italy (it_IT)
Re: Draft.string from a parameters (or expression)
Your first post, welcome to FreeCAD.
I suggest you make a "feature request" ticket on the FreeCAD mantis bug tracker. Post a link to the ticket in this topic, and a link to this topic in the bug tracker ticket.
Yorik is the most likely to understand this and add it if he thinks its a good idea, he wrote most of Draft WB.
and it lists all fonts on the system and their directories. Just wondered if that is Linux wide and if you could use that in some way to help selecting a font for the font property of Draft Shape String?
Jim
Expressions has not been implemented yet for the "string" property of A Draft ShapeString.AndreaMcNew wrote: ↑Tue Apr 09, 2019 9:41 am Until now, the text in the string isn't generable with an expression (the expression icon is missing).
I suggest you make a "feature request" ticket on the FreeCAD mantis bug tracker. Post a link to the ticket in this topic, and a link to this topic in the bug tracker ticket.
Yorik is the most likely to understand this and add it if he thinks its a good idea, he wrote most of Draft WB.
Hi Yorik, I discovered today that in Ubuntu on the command line you can typeyorik wrote:
Code: Select all
fc-list
Jim
-
- Posts: 2
- Joined: Tue Apr 09, 2019 9:21 am
Re: Draft.string from a parameters (or expression)
Hi Jmaustpc,
Thanks for reply.
I'll try to make a feature request, but at this moment it seems I'm the only person interested in ...!
Bye,
Andrea
Thanks for reply.
I'll try to make a feature request, but at this moment it seems I'm the only person interested in ...!
Bye,
Andrea
Re: Draft.string from a parameters (or expression)
No you're probably not the only person to ask, but if not: then boff ... it surely come one daybut at this moment it seems I'm the only person interested in
Re: Draft.string from a parameters (or expression)
Ideally every input field should have this feature IMO.
Re: Draft.string from a parameters (or expression)
I am also interested in custom text from parameters or expression. searching around the forums, can't seem to find much, besides this thread. To me it seems that the text should have the properties of a label, and label of text, with one being with a built-in leader and the other without. So maybe it is the label that could get updated to use custom parameter references of expression engine and be able to exist without a leader line.yorik wrote:
Re: Draft.string from a parameters (or expression)
Is that what is in example file there? https://forum.freecadweb.org/viewtopic. ... =8&t=58657
Re: Draft.string from a parameters (or expression)
Yes! That's pretty cool! That expression possibility should be available to the regular draft text tool as well, so there is no need to create too much new real geometry by using the shape string tool.openBrain wrote: ↑Sat Jan 22, 2022 3:08 pm Is that what is in example file there? https://forum.freecadweb.org/viewtopic. ... =8&t=58657
Re: Draft.string from a parameters (or expression)
It already is:
- Create the Arch_Text with a dummy string.
- Right click the "Text" field in the Property editor and select "Expression...".
- Enter f.e.: list(<<Cube length: %s>> % Box.Length; <<Cube width: %s>> % Box.Width; <<Cube height: %s>> % Box.Height)
Re: Draft.string from a parameters (or expression)
Got it! A bit of a roundbout way, but it works! Thank you! This should be in the wiki.Roy_043 wrote: ↑Sun Jan 23, 2022 6:34 pm It already is:
- Create the Arch_Text with a dummy string.
- Right click the "Text" field in the Property editor and select "Expression...".
- Enter f.e.: list(<<Cube length: %s>> % Box.Length; <<Cube width: %s>> % Box.Width; <<Cube height: %s>> % Box.Height)
The units though, don't mach the scene units. I am using meters, and I am getting a box.length in mm. I tried entering the following
<<Cube Length %s>> % Rectangle.Length * 1000
And i got 1000 copies of the 1.4m rectangle length! Yikes.
So what's the way to expand the expression with some more maths?