2022-03-29 02:50 PM - last edited on 2022-09-28 08:22 PM by Oleksandra Vakariuk
Hi everyone,
I have an expression to show the height of Elements in stories including the prefix -, ± and +. In one project, we encountered a problem that this expression was not showing the 5mm values as a superscript. If the true value was 2,105m it was rounding it up to 2,11m. The correct display would be 2,10^5.
Here is the expression that I have:
CONCAT ( IF ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ) > 0; "+"; IF ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ) = 0; "±"; "" ) ); IF ( ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ) ) >= 1; STR ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ); 2 ); IF ( ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ) ) = 0; STR ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ); 2 ); IF ( ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ) ) <= - 1; STR ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ); 2 ); STR ( STRTONUM ( STRCALCUNIT ( {Property:Öffnung/Mittlere Höhe zu Projektursprung} ) ); 2 ) ) ) ) )
Here it is a bit better readable:
I have tried 2^5, but it did not work since apparently it is a String. For this reason, I was trying to add the 2^5 to STRCALCUNIT, but without success. Which interpretation has the 2^5 for Archicad (Float, Integer)???
Is anyone capable of helping me extend this expression?
I would be very thankful.
cheers
2022-03-29 04:12 PM
Technically superscript is markup (like bold or itatlic) so there is sadly not direct way to achieve this.
You can cheat however by using a true Unicode superscript 5: "⁵"
This however has one caveat: Some fonts might not have a glyph for this. So use with caution!
2022-03-30 10:53 AM
The font that I use allows generating a superscript as "⁵", so I don't believe it is a problem of the font.
I have another expression in Archicad that can actually do it. It is used for other elements, and it is already long in itself to do the superscript. Embedding this script in my first script will be simply a horror (too long!).
I wanted to know, if there was a possibility to extend my expression, in order to integrate the "⁵".
2022-03-31 05:02 PM
For some reason my comment got lost! Someone deleted it?
Nontheless, here I go again.
The Font that I am using does allow a superscript, so I would not say it is the problem of the font. There are other expressions that I use and they have the superscript included. Sadly I cannot use those expressions for this particular case.
As I was researching and in communication with GS Germany, I am coming to a conclusion that this 5mm aspect won't work in Archicad. It is not programmable, or it is exceeding my programming capabilities. This is really sad and a disaster, because we are not capable of documenting the 5mm with labels in our plans.
2022-03-31 06:01 PM
@agroni wrote:
For some reason my comment got lost! Someone deleted it?
For some reason it got caught by the spam filter.
I have released it now.
Barry.
2022-03-31 10:29 PM
Sorry, but what are you talking about?
While it might not be the easiest thing it is absolutely doable. I don't understand how your conclusion was this would not work in Archicad? 🙂
IF ( {Property:Allgemeine Parameter/Höhe} < 1,0 m;
IF ( RIGHT ( SPLITRIGHT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ); ","; 2 ); 1 ) = "0";
LEFT ( SPLITRIGHT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ); ","; 2 ); 2 );
CONCAT ( LEFT ( SPLITRIGHT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ); ","; 2 ); 2 ); "⁵" ) );
IF ( RIGHT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ); 1 ) = "0";
LEFT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 );
LEN ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ) ) - 1 );
CONCAT (
LEFT ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 );
LEN ( STR ( MROUND ( {Property:Allgemeine Parameter/Höhe} / 1 m; 0,005 ); 3 ) )- 1 );
"⁵" ) ) )
How to achieve the leading "+" is left as an exercise for the reader.