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
Hmooslechner
Moderator
Its still buggy now and i have to make some restrictions in some parameters too. The numbers should change - thats a feature, the number of a point should be left out if there is no double-circle..

It will take som days to get it to work probberly an then there will be an english version.
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
https://www.dropbox.com/s/bjqpf7oqkfzspvp/Kanal_M.pln

This Edu-pln contains an english and the german version - so far as my english knowledge can make it possible.

i also ried to translate parts of the 2D-script - which is the complexer part..

When there is time, ill make an english tutorial for it.
Now You have to look at the german Youtube, but You can see the spirit..

www.youtube.com/watch?v=vfEBqExcyvY
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Hmooslechner
Moderator
Just another project with Your polygone-script..

I made this things with my try in this topic and put my code to Your polygon-code.. its sometimes a little buggy but now its possibel to draw "walls" with different bottomhights..

www.youtube.com/watch?v=-FFodVedw4U&feature=youtu.be

its in uplad for a few minutes..


To have a look at the code: /AC16EduAut.pln..)
https://www.dropbox.com/s/wcvwjz0owsbd4aj/Polygonzug_Wand.pln
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Anonymous
Not applicable
sinceV6,

Congrats for your Dynamic PolyLine. Thanks for sharing.
I like the cross sign at the end for adding a new segment.

I notice an unexpected behavior with Z coords when removing points. See attached image.
Is it intended to work this way?

Best regards,
z coords & removing points.png
sinceV6
Advocate
Hi Olivier.
It's a real honor to hear from you. Each of your objects is a masterpiece! I've learned a few tricks from them. Thank you for sharing all that work.

I'm aware of the issue. In its current version, for removing points, the script iterates from the first to the last point checking the next segment´s length, and always removes the next segment from the edited point regardless of where it is dropped (previous point or next one). This works OK for X and Y coordinates, but for Z does not, as you point out.

I was trying several approaches to solve that, but I had to move to other things, so I added the Z to that block in the script. It has that small caveat for now: in your example, moving point #4 will remove segment from #4 to #5, thus giving its Z value to point #5 even if you move it to the previous point.

The block in the Master script that controls this is
"!=== FOR REMOVING POINTS====
the bunch of code
========================"

I have a few unsuccessful options lying around. I tried to find a way within that block and the already set up parameters so that only that part would need to be changed (copied/pasted to other objects based on this), but I remember I found it might need a couple more of placeholder parameters just to move Z coordinates around, depending on the point being edited.

Before I paused its development, I realized I'd like to rewrite the parts that control adding and removing points and try to make them simpler. Those two blocks in the master script are the ones that control the basic functionality.

I'm afraid to say that I currently lack time to fully revise it. I'm open to ideas/solutions though. When I find some time, I will revise the Z coordinate or rewrite entirely those blocks; in the meantime, if you like to contribute to the code, it would be great. I think the code is clear and commented, each code block has a title indicating what it does, and variables' names are self-explanatory.

Best regards.
Anonymous
Not applicable
sinceV6 wrote:
if you like to contribute to the code, it would be great. I think the code is clear and commented, each code block has a title indicating what it does, and variables' names are self-explanatory.
Fully agree. Your code is clear and well commented. A pleasure.

I was trying your code on a tube object, when I realized this particular problem. Not a major issue.
I asked you because I did not find a quick solution . I will try again.

Attached two objects, in case somebody has an idea.

The first one uses Petri Leeskinen's code (free form window) for dynamic polyline.
Fine, but a bit complicated. Coords numbering is a mess.
Cons, you need to break the last segment to add a new one at the end.

The second object uses your dynamic polyline code, with minor changes.
Once this Z coord problem solved, it will be perfect for me.

Not sure if it works correctly with imperials, sorry.

Best regards,
sinceV6
Advocate
WOW Olivier. Sweet work as usual! I can see where you are going with those objects. How do you code that fast?!?

I also couldn't find a quick solution for the Z coord, at least not one that could be implemented and confined within that block and only with the available parameters.

I can see that Petri's code works as expected, albeit a tad complex, and I noticed the coords numbering problem. I thought modifying it to add a last hotspot (to add points, instead of breaking the last segment) would solve your issues, but I guess the numbering problem wouldn't be addressed and a good part would need to be rewritten or reorganized for this. Didn't take the full plunge into the code, but I can see that my approach is more direct (to adding and removing points) and Petri's is more indirect - by first checking what point or coords are moved/edited and then taking action accordingly. I think the two approaches would need to be combined to solve all issues.

As soon as I find time, I will review Petri's code to see how it works and try to solve (or rewrite) my code and publish a step by step on what to change if objects have been developed using this; but not being as proficient in GDL as you I'm afraid you'll beat me to the answer

Attached are some of the options I kept when looking for a solution. The part being tested -for removing points in master script- is not well formatted (I try to give code a good format so I can return to it later and pick it up as fast as possible), but I guess you won't have major issues with that.

They DON'T WORK entirely (to test them you would need to comment out some of the calculations), but might give you an idea on the approaches I took. Hell... the solution might be there and I made a mistake or just didn't see it.

I'm still amazed at how you write GDL.

Best regards.
Hmooslechner
Moderator
@ SinceV6: Just to inform You as You intendet:

I used the Your code to create a simple numbering (Text) - Object.

Its meant to number things in the plan "at the wild" - now just 2D.

Till i'l have time and its finnishd - its in german but the functionality should be clear

www.youtube.com/watch?v=4TuoHhQlAFE

until it is open on Bim:


https://www.dropbox.com/s/49440b1fb19r6n2/Nummerierungen%20Poly.pln



@ Olivier Dentan:

What would be a real challange: You made this very far developed object for "Garde Corps". Its full functionality applied to the new polygone-Code with Z-coords - that would be "it"!

What i tried to do so far was to calculate an offset to one side, so to make it possible to follow slabs or other contours and mount it on a Sideface - like its done here by us in Austria. But my my spirit is too weak..
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Mario Sacco
Expert
Here my contribution.
I created with my own code this editable polyline in 2d/3d with arcs.
Let me know if you have questions.

The use of the code is free.
MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27
https://www.archiradar.it/en/
Mario Sacco
Expert
Here a 3d view
MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27
https://www.archiradar.it/en/

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!