Choose your top Archicad wishes!

Read more
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
The same here..

Piotr
Nuge
Advocate
and here
AC27 i9 11900K / 128G ram / GTX 3090 / D5 Render
Hmooslechner
Rockstar
Try my dropboxfile?

https://www.dropbox.com/s/5u1z9iu4jwd9j0z/Archicad23%20GDL%20Freies%20Polygon%20mit%20Profil.pln?dl=...

AC23EduAut
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Barry Kelly
Moderator
Hmooslechner wrote:
Try my dropboxfile?

Thank you.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Nader Belal
Mentor
Hi every one,

I have been trying to write my own script based on the procedures that you all have provided in here (to which I'm thankful), but I'm having trouble as you can see in the following animation (click on image to activate gif)


So the idea is to create a close polygonal solid with a minimum of 3 vertices ... and as you can see, I have been successful of making the user able to delete any polygonal vertices in real time, but, when ever the user tries to move a mid-point hotspot to add an extra vertex to the polygon, in real time it's been added up, but the new midpoint hotspot (which by the way have the same index number of the unmodified polygon) gets to move, as if there is a hidden cursor that is moving it to, which at the end leads that the intended vertex doesn't gets to add up.

So using pseudocode, what do you expect that I have done wrong in my script ??
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Post your object so we can look and not have to guess
sinceV6
Advocate
Moonlight wrote:
Hi every one,

I have been trying to write my own script based on the procedures that you all have provided in here (to which I'm thankful), ......

So using pseudocode, what do you expect that I have done wrong in my script ??


Hi!
The most probable thing is that you missed updating some array with new points/coordinates. Happened to me too. Without knowing how you've scripted this, it would be hard to guess where is the problem.

Let me dig around my old stuff. I have a few stripped down second versions of this that you could use to build upon for your needs.

Best regards.
Nader Belal
Mentor
Hi everyone,

I think that I have pin pointed where did my script gone wrong, which is still giving me the headaches.

It's in the Graphical editing Hotspots (as much as I could tell, but take it with a pinch of salt) ....

As much I could observe, as long as I use the Midpoints Hotspots, it appears to create a feedback loop, between the old form and new form of the polygone.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

thank you Mario for sharing. very useful!

::rk
MADheikki
Contributor

Thanks for your contribution, since6V! Here's my minimal, stripped down version of a dynamic polygon for AC26. I've used it for a customer project that wasn't publicly available, so to keep in line with the spirit of this thread, I'll make it available here. It doesn't contain anything novel, but maybe it could be useful as a clean starting template. If memory serves, I think I adapted it from the original polyline code without noticing that there was a polygon version too. I copied the area calculation code from the polygon version. No guarantee of correct operation...

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!