Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

AND OR !?!?!?!

Red
Advocate
How come GDL can understand this:

if StartSide= 'Notch' or StartSide= 'Top Notch' or StartSide= 'Bottom Notch' or StartSide= 'Reverse Top Notch' or StartSide= 'Reverse Notch' and EndSide= 'Reverse Notch' then

And not this:

if StartSide= 'Notch' or StartSide= 'Top Notch' or StartSide= 'Bottom Notch' or StartSide= 'Reverse Top Notch' or StartSide= 'Reverse Notch' and EndSide= 'Notch' or EndSide= 'Top Notch' or EndSide= 'Bottom Notch' or EndSide= 'Reverse Top Notch' or EndSide= 'Reverse Notch' then

Unless I'm missing something very simple (as a missing "quote","equal", or etc...) the problem I see is that whenever I have more than 1 "or" after the "and" it gives me an error.

If there an easier way to get the same solution feel free to bash away! I got thick skin. (I'm still learning new things in GDL every time I fool with it.)

Here is what I'm trying to achieve. (BTW I work for a log home company.) When one of the logs in the house is notched it can be defined in 5 different notches (within a drop down list of parameters) or it will be tag as "Normal" for no notch (which is also in the same drop down list). So within GDL when it notices that the log has a notch on one side it will run an equation to figure out the material needed. If the log has a notch on both sides then it will double that amount.

Log 1.60.jpg
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz
8 REPLIES 8
LiHigh
Newcomer
I assume notch at both end do not have to be the same.
an easier way would be:

IF StartSide<>"Normal" AND Endside<>"Normal THEN
..........(both end notched)............
ELSE
..........(at least one end is normal)............
ENDIF


Howard Phua

Win 10, Archicad 19 INT
Laszlo Nagy
Community Admin
Community Admin
Maybe you should include some parantheses to create two blocks (both having all ORs withing them) and then place the AND between the two block.

if StartSide= ('Notch' or StartSide= 'Top Notch' or StartSide= 'Bottom Notch' or StartSide= 'Reverse Top Notch' or StartSide= 'Reverse Notch') and (EndSide= 'Notch' or EndSide= 'Top Notch' or EndSide= 'Bottom Notch' or EndSide= 'Reverse Top Notch' or EndSide= 'Reverse Notch') then

I haven't tried it, so I am just guessing this might work.
Laszlo
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-Ac28
Anonymous
Not applicable
In the list values i would delete the lines with "------",
because i guess AC cannot interpretate them
Same thing for "error".
Not sure but maybe.
Oleg
Expert
The length of a code line is limited. I think, you have exceeded allowable length.
You can continue expression on the next line having placed \ char at the end of a line.

Except for that I think, that you have a logic mistake. AND have the higher precedence over OR (like multiplication over addition) and you need to use brackets as Laszlo suggested.

For example:
1+2*3+4 differs from (1+2) * (3+4) right ?
it is like 1+(2*3)+4
As well
A1 or A2 and A3 or A4 is same as A1 or (A2 and A3) or A4
but not (A1 or A2) and (A3 or A4)
Did you are expected like this ?

Try this:
if  (StartSide= 'Notch' or\
   StartSide= 'Top Notch' or\
   StartSide= 'Bottom Notch' or\
   StartSide= 'Reverse Top Notch' or\
   StartSide= 'Reverse Notch')\
   and\
   (EndSide= 'Notch' or\
   EndSide= 'Top Notch' or\
   EndSide= 'Bottom Notch' or\
   EndSide= 'Reverse Top Notch' or\
   EndSide= 'Reverse Notch') then
! some code
ENDIF
Red
Advocate
Olivier wrote:
In the list values i would delete the lines with "------",
because i guess AC cannot interpretate them
Same thing for "error".
Not sure but maybe.
I wasn't the one that originally made the part, but I have often wondered what the dashes were for in the parameter list.
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz
Anonymous
Not applicable
Red wrote:
Olivier wrote:
In the list values i would delete the lines with "------",
because i guess AC cannot interpretate them
Same thing for "error".
Not sure but maybe.
I wasn't the one that originally made the part, but I have often wondered what the dashes were for in the parameter list.
I imagine that the author probably put the dashes in as separator lines. It may be graphically desirable but is questionable programming.
Anonymous
Not applicable
Sorry, i was wrong, and Oleg is right. Laszlo too.

It is because the lenght of your line exceeds 255 characters
that the error message occurs.
Try Oleg's solution, it works great.
Nothing to see with the dash lines, except perhaps if the user
select them, but it depends how your script is written.
Red
Advocate
Oleg wrote:
The length of a code line is limited. I think, you have exceeded allowable length.
You can continue expression on the next line having placed \ char at the end of a line.

Except for that I think, that you have a logic mistake. AND have the higher precedence over OR (like multiplication over addition) and you need to use brackets as Laszlo suggested.

For example:
1+2*3+4 differs from (1+2) * (3+4) right ?
it is like 1+(2*3)+4
As well
A1 or A2 and A3 or A4 is same as A1 or (A2 and A3) or A4
but not (A1 or A2) and (A3 or A4)
Did you are expected like this ?

Try this:
if  (StartSide= 'Notch' or\
   StartSide= 'Top Notch' or\
   StartSide= 'Bottom Notch' or\
   StartSide= 'Reverse Top Notch' or\
   StartSide= 'Reverse Notch')\
   and\
   (EndSide= 'Notch' or\
   EndSide= 'Top Notch' or\
   EndSide= 'Bottom Notch' or\
   EndSide= 'Reverse Top Notch' or\
   EndSide= 'Reverse Notch') then
! some code
ENDIF
Thanks that worked!

In the process I learned something new today about GDL. Thanks again Oleg
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz