BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

GDL
About building parametric objects with GDL.
SOLVED!

Archicad's GDL lamp is duplicating an element when adding "ROTY"

mendezarcediego
Booster

Help please! I've modified Archicad's "Spotlight Kit 25" Lamp object to rotate along its "Y" axis. But when I rotate it, one of its original elements gets duplicated, as if I made a copy as I was rotating.

 

The object from the screenshot has been rotated 15deg around its "y" axis and 15deg around its "x" axis.

 

FYI: I'm not a programer but I managed to add the new parameter to the interface and all, I just can't get this "duplicated" element to disappear, I'm sure I copy-pasted some code line without really understanding what it does and that is generating this issue. 

 

On a separate note, why can't I rotate around the Y axis by default?

Screen Shot 2022-02-23 at 12.48.23.pngScreen Shot 2022-02-23 at 12.54.31.pngScreen Shot 2022-02-23 at 12.48.47.png

AC26–5002 INT FULL/ Win 11 Pro 22621.1992 / Intel i9-13900KF 24C (8P-16E) 3.00 - 5.80 GHz / 64 GB 5600 MHz DDR5 / Nvidia RTX A4500 20GB, Dual 2560x1440.
20 REPLIES 20
Lingwisyer
Guru

From my understanding, the EPS lines will not be the ones giving you the precision error as it only turns up when you use equals. Rounded, it might be equal, but in reality it may not. Hence < EPS is used as it is essentially zero without actually being zero.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

I checked on my pc  and it is indeed the lines with if bProject2D & ABS(rotAngleX)& ABS(rotAngleY) < EPS then that are generating the error.

 

My guess is that since bProject2D is a boolean  and it is evaluated as a number as its value is checked against EPS Archicad treats is as a real number.

and since this line compares a real to a float you get this warning.

 

Lingwisyer
Guru

So the opposite problem? So to get rid of it you would have to split out the bProject2D = 0?

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

There is no problem.

The error message is a generic one, it just points out that you use different types at the same time, it's just a warning. In this case it doesn't matter and won't cause any problem.

Generic and annoying as hell... In one of my objects, the only way I have figured out how to get rid of it is to change all of my A = B to B - EPS < A < B + EPS... What is more annoying is that A and B are defined by condition statements earlier in the script, defining them as equal or not so that I can use a single SUB. Just fills my error report with junk...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Probably you wanted to write

 

... ABS(rotAngleX) < EPS & ABS(rotAngleY) < EPS ...

 

& has lower precedence than < so

 

ABS(rotAngleX) & ABS(rotAngleY) < EPS

 

is really

 

(ABS(rotAngleX)) & (ABS(rotAngleY) < EPS)

 

where ABS(rotAngleX) is a real number tested as a boolean, so the warning is legitimate.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Hi Peter, yes I thought it would be evaluated as the first line you wrote.

Since it worked written like this I didn't think twice about it.

Thanks for the clarification.

The parameters of ROT are

ROT x, y, z, alpha

a vector to rotate around, not angles in order, and it is an error if you omit some.

Do you know about some legacy command that isn't in the reference guide?

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Sorry for my late response. Thanks for all the help from everyone. I tried your suggestion of using < if bProject2D & (ABS(rotAngleX)) & (ABS(rotAngleY) < EPS) then > but I still get that minor warning, I wonder if I inserted the code incorrectly.

AC26–5002 INT FULL/ Win 11 Pro 22621.1992 / Intel i9-13900KF 24C (8P-16E) 3.00 - 5.80 GHz / 64 GB 5600 MHz DDR5 / Nvidia RTX A4500 20GB, Dual 2560x1440.

What you have written above is still wrong. You need to check both rotAngleX & rotAngleY against EPS separately. Effectively what you have is three arguments you want to test against so you should split it into three lines (using the line continue character "\") so its easier to see the logic.

 

Your current logic looks like this:

    if bProject2D \

    & ABS(rotAngleX)  \

    & ABS(rotAngleY)  < EPS then...

 

in extended form this reads as:

    if bProject2D = 1 \

    & ABS(rotAngleX) = 1  \

    & ABS(rotAngleY)  < EPS then...

 

So the "real value" error is coming from the second line.

You need to write this:

    if bProject2D \

    & ABS(rotAngleX)  < EPS  \

    & ABS(rotAngleY)  < EPS then...

 

Which is what Peter described above.

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
Learn and get certified!