cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.
SOLVED!

Always readable text when rotated 270 degrees

Anonymous
Not applicable
I am trying to get a GDL object with a "always readable text" in it. To this, I have found a tutorial, which seemed like the thing I want to do, but unfortunately, it does not work for me.

The text is just not displayed correctly when the object is rotated 270 degrees, even though in the screen shot from the tutorial, it seems to work. What is displayed in my case, is a text rotation for 180 degrees, not 270.

Here is the code / tutorial I used: http://gdl.graphisoft.com/tips-and-tricks/how-to-make-an-always-readable-text-cs

Am I doing something wrong?
(Trying to get this work in Archicad 20/22 SWE)
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator
mbl wrote:
But it is still unclear to me what does it do in the "if" statement. Why would I need to add a 1/10000 degree rotation in that "if" condition?
When you rotate an element by say 90° it should in theory be exactly 90°.
But in reality it might be 90.000012° - either because of bad user input or rounding errors internally in the program (I think they call it floating point errors?).

So the EPS value is a way of checking for rounding errors.
The smaller the value for EPS the more accurate it will be - but you don't want it too small that it doesn't filter small rotation errors.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

5 REPLIES 5
Anonymous
Not applicable
Any ideas? Anyone?

After playing with the code a little bit, I found out that the object totally ignores the "readable" part of the script.

This was the original part of the script:

if iTypeTextRotation = 2 then ! Readable
if (_totalRotate > (90 + EPS) & _totalRotate < (270 + EPS)) then
rot2 180
_nTrans = _nTrans + 1
endif

And when I took away the "EPS" from the conditions, the object seems to work as it should.
Okay, but then what does the "EPS" do in the script? Other than making it dysfunctional...

Maybe someone more experienced can answer? Or maybe someone from Graphisoft can explain what's going on?

As someone new to the GDL, it can be very frustrating that there is very little help online on the topic and even when there is, it seems to give misleading solutions.
Anonymous
Not applicable
Did you download the example code via the link? You will find in the Master script the definition:
EPS = 0.0001

This is used when comparing real numbers as in the equation in the 2D script:

if (_totalRotate > (90 + EPS) & _totalRotate < (270 + EPS)) then


I agree GDL is not easy to learn, but the best way to start is with the old GDL Cookbook by David Nicholson-Cole (PDF available on internet). It is old but still useful for learning the basics.
Anonymous
Not applicable
Thanks Graeme. No, I didn't download the files at first. I started with copying the code and defining parameters in my own object. And since there was no mention of any "EPS" variable in the tutorial, I have obviously missed it.

I can see where it is used, that's where I've deleted it from to make my original code function. But it is still unclear to me what does it do in the "if" statement. Why would I need to add a 1/10000 degree rotation in that "if" condition?
Solution
Barry Kelly
Moderator
mbl wrote:
But it is still unclear to me what does it do in the "if" statement. Why would I need to add a 1/10000 degree rotation in that "if" condition?
When you rotate an element by say 90° it should in theory be exactly 90°.
But in reality it might be 90.000012° - either because of bad user input or rounding errors internally in the program (I think they call it floating point errors?).

So the EPS value is a way of checking for rounding errors.
The smaller the value for EPS the more accurate it will be - but you don't want it too small that it doesn't filter small rotation errors.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks Barry, that makes sense.