We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.

Dynamic Polyline base code object

sinceV6
Advocate
Hello everyone.

In the past couple of months I've been in a GDL streak creating, updating and fixing lots of little self made parts... and the code just seemed to flow; so I tackled my wish to have (make, to learn, in my case) a dynamic polyline. A few months ago, I sketched a new "parking place" object that I wanted, but just didn't have the time to do; and didn't really need because I've just been adding stuff and parameters to the GS parking place object for years.

I did some research a few years ago, but just kept the links for reference. Now that I was naturally digging into GDL again, I though I could make it possible.

The basic code for a Dynamic Polyline is useful for me; and I thought many people here could benefit from it. I tried several approaches for two weeks trying to make it work the way I wanted (I'm really no expert in GDL). It solves a few issues and serves as learning resource too, as it dynamically adds points to the polyline between segments, adds points at the end, dynamically removes points and dynamically grows and shrinks arrays.

I already have other ideas for this, like a 3D railing (the code already has Z for each point). I'm not putting it in BIMcomponents (this is for AC15+) or the Depository as it is not a final product.

I hope you find it useful, if you do, leave a comment; the only condition is that if you use it for something, you must post back the developed object with the code unlocked so other people can see how to implement it in new objects. (so please, no locked commercial derivatives... this is for the community)

Thanks to the plethora of information found in this community.
 

Enjoy.

The "Dynamic Polyline ER" base code object:

EDIT: new version: added a few things, like length of the segments, and a visual constraint for the first segment to keep at least 2 points.
47 REPLIES 47
alemanda
Advocate
Thank you very much for sharing!
At that time (I had time) I studied this problem to write an object for claddings. So I needed a closed dynamic polygone to be used to define a slab to be oriented anyhow in the space ...
I see that your dynamic polyline cannot be closed. Right?
AC27 latest hotfix

Win 10 Pro 64bit

Double XEON 14 CORES (tot 28 physical cores)

32GB RAM - SSD 256GB - Nvidia Quadro K620

Display DELL 25'' 2560x1440

www.almadw.it
Hmooslechner
Moderator
to alemanda:

Its german but its what You need i think..

http://www.youtube.com/watch?v=d1gVAqX6vhc&feature=youtu.be

And on the Bim-portal You can Download the Part (2 Parts) by searching for:

Fliesenteilungen12_2012 a1

and

Fliesenteilungen12_2012 b1

the difference is - You can usw on for the bottoms - one for the walls
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
sinceV6
Advocate
That base code is to be used with an open polyline/path. You can "close" it in the sense that you can drag the last point to the object's origin, but it won't stay closed.

But, the code is simple enough that with only a few modifications, it can do what you want.

Here it is, modified for you.
I included the area calculation based on:
http://www.wikihow.com/Calculate-the-Area-of-a-Polygon

The script won't check for overlapping segments... so it will give you the area based on clockwise or counterclockwise coordinates (so, some area polygons will have positive area, others negative area). It is the same result if you use the measure tool and trace over all the segments (following their order) including the overlapping segments.

The 3D script will do nothing more than lift the points.

You can extend it to show whatever you need. If you do, share what you accomplish!

Best regards.
Pertti Paasky
Expert
Hi sinceV6. Nice job. Is it possible to move the first point too? Makes it more useful.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
sinceV6
Advocate
Pertti wrote:
Hi sinceV6. Nice job. Is it possible to move the first point too? Makes it more useful.
Hi.

Sure thing. There's already an option for that. Just turn on the "make first hotspot movable" option.

Best regards.
Pertti Paasky
Expert
OK, I got it. thanks.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
Hmooslechner
Moderator

Now i had time to look at Your code.. and i am sure not to understand the half of it.- Wow!

I wish this would have existed when i made my own little steps in this topic. This seems to be exact the "base" for what i was looking for to make a functioning 3D-Railing, a much easier GDL für sewer than i tried to make and so on..


I have to learn much! That's for sure.

I will try to adapt this für my existing sewer-Part.

https://community.graphisoft.com/t5/Libraries-objects/Sewer-Library-part/td-p/133353?start=10&t=4211...

 

AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
Hi out there!

I took Your polygon-code and programmd my sewer object complete new:

https://www.dropbox.com/s/eme47bhjzfwj13d/Kanal_K.pln

Its in german till now but i'll try to translate it later.

I cheated with the growing polygone - and made it for just 50 Points, that should do it anyway, but Your functionality is still working.

Enjoy and feel free..

Greetings from Austria - Salzburg
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
sinceV6
Advocate
Hey! That's great work right there!
I'm glad you found it useful. I would like to see the finished object though... and translated. My german is practically non-existent.

Is it finished? I see numbers change when adding or removing points, and I assume they should remain constant.

Let us now when you finish! Would like to see the complete code.

Best regards.