The main problem here is that Preferences control the decimals places values will be displayed to.
In case your Property's Data Type is "Length", the Project Preferences->Calculation Units->"Length Unit" field will define how many decimals will be displayed for it.
In case your Property's Data Type is "Number", the Project Preferences->Calculation Units->"Numbers without Units" field will define how many decimals will be displayed for it.
So, in order to be able to display a value to the decimals you specify, you have to become creative, and you have to engage in creating Expression-defined Properties. What you can do is you can convert the "3D Length" parameter to a string and specify the number of decimals there.
The "STR" function makes it possible to convert a numeric value to string and at the same time, specify the number of decimal places for it. However, the "STR" function works only on Properties with "Number", "Integer", and "True/False" Data Types.
So, how do we convert a "Length" Data Type to a "Number" Data Type? This is possible by first using the STRCALCUNIT function to convert the "Length" Data Type to a "String" Data Type, then use the STRTONUM function to convert the "String" Data Type to a "Number" Data Type.
Then, we can use the "STR" function to convert that to a string, and we can also use another Property with the "Integer" Data Type to specify the number of decimals for the string.
So, how does all this look in practice?
I have created the following schedule that lists various Expression-defined Properties.
In the first Column, after the name of each Property, I wrote the Data Type of the Property for better understanding.
The Project Preferences->Calculation Units->"Length Unit" field is set to "4" in my file.
The Project Preferences->Calculation Units->"Numbers without Units" field is set to "2".
The third row of values displays the "3D Length" general parameter, which has a "Length" Data Type, and which displays the 3D length of the Wall's Reference Line. As you can see, values are displayed to 4 decimal places because the "Length Unit" field is set to "4" in the Project Preferences.
The fourth row displays the values of the "WallLengthSTR" Property with a "String" Data Type. It is an Expression-defined Property, which simply converts the "3D Length" Property to a String. It has the following code:
STRCALCUNIT ( {Property:General Parameters/3D Length} )
Although its displayed value looks like a Number, it is actually a String.
The fifth row displays the values of the "WallLengthNUM" Property with a "Number" Data Type. It is an Expression-defined Property, which simply converts the "WallLengthSTR" Property from a String to a Number. It has the following code:
STRTONUM ( {Property:CALC/WallLengthSTR} )
As you can see, values are displayed to 2 decimal places because the "Numbers without Units" field is set to "2" in the Project Preferences.
The sixth row displays the value of the "DecimalPlacesINT" Property with the "Integer" Data Type. This is not an Expression-defined Property, but a Property which can be set individually for each Wall element, and it will define how many decimal places our "3D Length" Property should be displayed to. As you can see, I set values between 0 and 4 for the 5 Wall elements shown in the schedule so we can see its effect.
The seventh row displays the values of the "WallLengthNUMTOSTR" Property with the "String" Data Type. This is the Property that will actually display the value we are looking for. It is an Expression-defined Property, which converts the "WallLengthNUM" Property from a Number to a String, and also uses the value of the "DecimalPlacesINT" Property to specify the number of decimal places. It has the following code:
STR ( {Property:CALC/WallLengthNUM}, {Property:CALC/DecimalPlacesINT} )
As you can see, the Property displays the value of the "3D length" Property with the number of decimal places we specified in the "DecimalPlacesINT" Property. So this is the result we were aiming for.
The eighth row displays the values of the "WallLengthNUMTOSTR2" Property with the "String" Data Type. It has practically the same expression as the previous Property, with the difference that it calculates the value in a single step. It has the following code:
STR ( STRTONUM ( STRCALCUNIT ( {Property:CALC/WallLength} ) ), {Property:CALC/DecimalPlacesINT} )
The advantage of this Property expression is that you will not need to create the "WallLengthSTR" and "WallLengthNUM" Properties to store intermediate results.
Actually, the reason I used those is to demonstrate the effect of Project Preferences settings on Length and Number type of Properties.
So this is how it can be achieved.
There is one disadvantage of this method: since the results displayed are not Numbers, but Strings, the Schedule will not be able to generate Total values for it.
Two more comments:
- This example shows how it is done for Length type parameters, but the same can be done with Area or Volume type parameters as well.
- Since these are Properties, their values can be used not only in Schedules but Labels as well.
I have attached a ZIP file, which contains the 5 Properties I have created for this little exercise. You can import the XML file into the Property Manager in AC24 or you can recreate the Properties from the above description in earlier versions. Make sure that all 5 Properties are made available for the Classifications you want to use them with.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27