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!

Math Bricking 2D

Lingwisyer
Guru
These are two lines within my 3D script dictated by a boolean:
louvre_seal_width = ( 2 * d - 2 * dp * (n - 1) - 2 * gs_louvre_thk * cos (gs_louvre_opening_angle) ) / ( 2 * sin (gs_louvre_opening_angle) )
louvre_seal_width = ( d - dp * (n - 1) + 3 * Louvre_over * sin (gs_louvre_opening_angle) - 2 * gs_louvre_thk * cos (gs_louvre_opening_angle) ) / ( 2 * sin (gs_louvre_opening_angle) )

Any idea why including the first line bricks my 2D projection while the second line does not? They both use the same variables in similar ways...



Ling.

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
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru
Fixed by solving indirectly. Used the same inputs to solve for a new horizontal value to allow the use of Pythagoras...

Side A cos θ to side A tan θ, Pythagoras



Ling.

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

View solution in original post

5 REPLIES 5
Use a process of elimination to determine the piece of code that is causing the issue.

Its difficult to spot the issue without deeper exploration; what are "d", "n", "dp", and "Louvre_over". Typically "n" is used for loops, so is this in a loop?

Send though more of the code and an explanation of the values and it should be easier to work out.
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
Lingwisyer
Guru
Kristian wrote:
Typically "n" is used for loops, so is this in a loop?

Woops. Completely overlooked that fact. Probably the cause of some of my other minor issues...

The issue is the 1 / sinθ and it turns out the issue isn't equation specific as if I swap them around, the one that fulfils that boolean still causes it to brick. If I set it to a static value not equal to 0, it works fine...



Ling.

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
A_ Smith
Expert
Lingwisyer wrote:

The issue is the 1 / sinθ and...
If I set it to a static value not equal to 0, it works fine...

Maybe occurs the situation when sin (x) = 0 and you can't divide by 0 (zero) => 1/0 => error ?
AC 22, 24 | Win 10
Lingwisyer
Guru
A. wrote:
Lingwisyer wrote:

The issue is the 1 / sinθ and...
If I set it to a static value not equal to 0, it works fine...

Maybe occurs the situation when sin (x) = 0 and you can't divide by 0 (zero) => 1/0 => error ?

That was a thought, but there is the fact that both equations have include that situation and it only has an issue with one of them... Then there is the fact that it equalling zero is impossible within my object since my script sets it to as close to 1 as possible without causing a geometry clash.



Ling.

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
Solution
Lingwisyer
Guru
Fixed by solving indirectly. Used the same inputs to solve for a new horizontal value to allow the use of Pythagoras...

Side A cos θ to side A tan θ, Pythagoras



Ling.

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
Learn and get certified!