GDL
About building parametric objects with GDL.

Gdl unlimited copying

Bhtsz_pyd
Contributor

Hello Everyone
I am trying to create a grid layout with gdl. what I want is that the parameter I want is to be able to increase or decrease the number of grid lines and each time I add a grid line, a new parameter is created where I can adjust the distance between it and the previous grid line. At first I created 4 different grid lines and did the work in the program, but here I can create a maximum of 4 grid lines. what I want is to be able to create an infinite number of grid lines and I want to create a length parameter that I can change the value between each one I create. 

 

Thanks...


WhatsApp Image 2024-12-01 at 17.59.57.jpegWhatsApp Image 2024-12-01 at 17.59.04.jpeg

3 REPLIES 3
runxel
Legend

For this kind of thing you will need loops in your code.

And arrays (because you can not make up Parameters on the fly, meaning you need to have solution that is actually extensible).

 

for i=1 to n_of_lines
    line2 0, 0, 0, B
    add2 distances[i], 0
next i

Take this very rudimentary example. (please mind that this still needs some more code to work, e.g. handling consistency between "n_of_lines" and the distances array, so you don't run into errors, because the array is too small)

"n_of_lines" is your number of grid lines you want to appear.

Then you draw the line, and "add2" the distances to the next grid line.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Lingwisyer
Guru

You would probably also want to include Hotlines for snapping, then if you are wanting to label the grids, you will need to link and update a second array.

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
ElijahBailey
Participant

Thank you so much for the help.

Spoiler
To create a dynamic grid layout with adjustable parameters, consider using an array or list-based approach. Each grid line should have its own adjustable distance parameter. You can apply conditional logic to create new parameters as needed. For an unlimited number of grid lines, implement a loop or recursive function to generate and control them. I pursued a PhD in literature and faced challenges while writing my academic thesis. To improve my writing skills, I sought help on various online platforms. Eventually, I came across DoMyPaper, a website that had many positive reviews. I decided to use https://domypaper.com/ services, and after my experience, my issues were resolved. I plan to utilize them for my upcoming projects as well. They have experienced writers who create personalized essays tailored to fit your budget.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!