201181
Mechanical
- Apr 13, 2006
- 49
thread561-234303
Hi,
I am currently playing with the creation of attributes from expressions, so that they can be shown in a parts list on a 2D drawing. This is very new to me, just started playing with this function today.
I'm having no problems in creating the attributes from an expression using the following, which was explained very well in the thread linked above:
ug_setPartAttrValue("A",format("%f",A_DIA))
However, there is one small thing I would love to modify if possible. At the moment, the number is shown with 6 digits after the full stop (so for example, 17 shows as 17.000000). This is a bit annoying to show in the part table. I have found that in the above formula, one can add for example 0.2 ( ug_setPartAttrValue("A",format("%0.2f",A_DIA)) ) to limit the number of decimal places to 2, but is there any way to generate the attribute where it only creates the additional values after the zero, if they are present (so for example, 17.25 shows as 17.25, and not 17.250000, and 17 shows as 17 and not 17.000000)?
Any help would be most appreciated
Hi,
I am currently playing with the creation of attributes from expressions, so that they can be shown in a parts list on a 2D drawing. This is very new to me, just started playing with this function today.
I'm having no problems in creating the attributes from an expression using the following, which was explained very well in the thread linked above:
ug_setPartAttrValue("A",format("%f",A_DIA))
However, there is one small thing I would love to modify if possible. At the moment, the number is shown with 6 digits after the full stop (so for example, 17 shows as 17.000000). This is a bit annoying to show in the part table. I have found that in the above formula, one can add for example 0.2 ( ug_setPartAttrValue("A",format("%0.2f",A_DIA)) ) to limit the number of decimal places to 2, but is there any way to generate the attribute where it only creates the additional values after the zero, if they are present (so for example, 17.25 shows as 17.25, and not 17.250000, and 17 shows as 17 and not 17.000000)?
Any help would be most appreciated