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

!Restored: Negative Numbers in GDL

Anonymous
Not applicable
I'm trying to make variables in GDL, and it's not recognizing negative numbers. For instance, Temp = -0'-2.0000" * -0'-2.0000". I'm also trying to get the difference between 2 negative numbers. For example, the Difference between -1'-0.0000" and -3'-0.0000" should be -2'-0.0000". However, in algebra using Addition, the result would be -4'-0.0000". If I try to subtract 2 negative numbers in GDL, I get an error.

Why does GDL not handle negative numbers?
11 REPLIES 11
Anonymous
Not applicable
Weston wrote:
that looks like matthew's description of two operators in a row. Have you tried the suggestion using () around the second number:

-0'-1.0000" - (-0'-3.0000")

Does that work?
Or how about 3" - 1", or -1" + 3"?

Why do you need to subtract a negative number? (Which is the same as adding a positive.)
Anonymous
Not applicable
Putting the parenthesis around the second number worked.

To explain why I needed to subtract 2 negatives is a little complicated, but I'll try. I'm doing a Roof Detail GDL that allows for 4 or 5 different roof scenarios (Knee Wall, Finished Floor/Ceiling, Finished Floor/Ceiling with blocking, etc.). I started the 0,0,0 point at the bottom of the blocking which rests on top of the Finished Floor/Ceiling. That means that depending on the pitch of the roof that the user selects, the edge of the overhang for the roof would be a negative number. I also allowed the user to be able to select how long they wanted the vertical stud wall below the Finished Floor/Ceiling to be. Since the user can select brick, stone, shake, etc. (all different heights), I needed to create a formula (trigonometry, geometry, algebra) to calculate the distance between the bottom of the overhang (negative number) and the bottom of the stud wall (negative number from the original 0,0,0) in order to automatically calculate how many brick, stone, shake, etc. that needed to fill in the distance from the bottom of the overhang to the bottom of the stud wall.

I finally figured out how to do all this. After thorough checking, I finally figured out one of the variables inside my program was original positive, but I made it negative for the final results. I know that's confusing, but the final output was that I actually ended up with one variable being positive and the other negative which was easier to work with. However, it's good to know that the parenthesis work because I've had other situations that I couldn't get around before because of 2 negative numbers.

Thanks for all the advice.