GDL
About building parametric objects with GDL.

Dynamic Polyline base code object - VERSION 2

sinceV6
Advocate
Hello everyone.

Almost seven years now from the polyline object. Wow. I've seen some awesome objects created with that. Congratulations to all of you who have taken a plunge into understanding GDL and that old object, and used it to create amazing things and shared them with the rest of us.

I've had these "version 2" objects for years now. Made them, thought of things to do with them, got busy living and working, used them in a couple of objects for me, and forgot about them.

I tried to simplify the main polyline functions as much as I could, so building upon them was easier. Still couldn't solve the "z" coordinate issue when removing points but it really is no big deal (i think).

The main goal at the time was to add arcs, but to be done over the simplified script. So... the library has a few objects:
* Two objects with the main functions. The difference with these is the way the script is written. One has separate x, y and z arrays, the other one has only one XYZ array. Would depend on your liking to use either one.
* A version 2 Dynamic Polyline, that includes arcs. This was a challenge and a nightmare. Dealing with the way GDL creates arcs is really something, and then realizing there would be ellipses, projected and rotated spherical and polar coordinates involved, was frightening. I just couldn't figure out some other arc examples on how they were done with simpler code. Mine was the result of extensive trigonometry research of long forgotten things. Has two type of arcs: based on floor plan projection (which yields helices in 3D) or based on the segment's 3D rotation (which yields ellipses in floor plan). It was not easy, but quite satisfying to achieve.
* A dynamic multi-polyline object. This one doesn't have arcs (my brain would have died), but has the ability to have many polylines in a single object. It is not using MACRO calls to load the basic functions. I saw this way of using the polyline object to have and use more than one poyline, and wanted to see if I could solve it within the same object. Perhaps you might find good use for this one, despite missing arc code.

I really hope you find these useful, either to build and share more objects, or just to learn a few things that might help you. They are shared using this license.

Thank you everyone.

Enjoy!
28 REPLIES 28
Anonymous
Not applicable
I was afraid of that. You were almost creating the perfect road tool for Archicad.
Roads need rotation along the axis to compensate centrifuge forces.
Yes. The Tube command needs this upgrade urgently.
Barry Kelly
Moderator
Hmooslechner wrote:
Thougt also about rotating at the nodes, but its not possible with the normal tube-command. Maybe Graphisoft could add an extension for the tube with the possibilities of rotating the profiles on nodes in the future?
TUBE already has the ability to rotate the cross-section at each point on the path.

Here is a quick example...
TUBE 4, 18, 16+32,
-2.0, 0.0, 0,
0.0, 0.0, 0,
0.0, 0.4, 0,
-2.0, 0.4, 0,

-1, 0, 0, 0,
0, 0, 0, 5,
4, 0, 0.1, 10,
6, 0, 0.15, 15,
6+4*sin(15), 4 - 4*cos(15), 0.2, 20,
6+4*sin(30), 4 - 4*cos(30), 0.25, 25,
6+4*sin(45), 4 - 4*cos(45), 0.3, 30,
6+4*sin(60), 4 - 4*cos(60), 0.35, 35,
6+4*sin(75), 4 - 4*cos(75), 0.4, 40,
10, 4, 0.45, 45,
6+4*sin(105), 4 - 4*cos(105), 0.5, 40,
6+4*sin(120), 4 - 4*cos(120), 0.55, 35,
6+4*sin(135), 4 - 4*cos(135), 0.6, 30,
6+4*sin(150), 4 - 4*cos(150), 0.65, 25,
6+4*sin(165), 4 - 4*cos(165), 0.7, 15,
6, 8, 0.75, 10,
0, 8, 1, 5,
-1, 8, 1, 0

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Hmooslechner
Moderator
Now- its getting interesting. Didnt know/understand that and ignored it until now. - thanks. Lets look what we can make with it..... stay tuned.
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Anonymous
Not applicable
Barry wrote:
TUBE already has the ability to rotate the cross-section at each point on the path.
Yes Barry. This is the thing! Perhaps this is a solution for Hmooslechner's object.
Hmooslechner wrote:
Now- its getting interesting. Didnt know/understand that and ignored it until now. - thanks. Lets look what we cam make with it..... stay tuned.
Thanks Hmooslechner... and may the force be with you.
Hmooslechner
Moderator
I dont know how i could miss this possibilities till now, but it seems to be a kind of ignorance..

May the 4th be with me - hope it doesnt take that long..

After some tries - It seems pretty simple, but for me it is hours of work already.


Whats to do:

2 possibilities:

to apply profile - rotations on each edge extra with editable hotspots
or
rotate profiles on each edge at once with one command at all.


Make it on each edge is a bit easier, because you don't have to proof on wich side is the smaller angle and the user has to apply it on each edge extra in 3D (maybe in 2D-projected sections? similar to the length- sectioning)

A step aside: in Austria, streets are build nearly without rotating the profiles to keep the driven speeds down...
They are rotated just to keep the water floating away but not for getting higher curve-speeds.

Normally, streets are constructed with clothoid for road curves and my bezier-solution is some kind of "nearby miss" already. So this logic of the bezier-curves could also be taken for raising-falling of the profile-rotation on the Edges.
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
Peter Baksa
Graphisoft
Graphisoft
The rotation of TUBE can become very hard to control when the path isn't close to planar.
This might not be a problem for a road, but be aware that's why you won't get the rotations exactly.
I wouldn't recommend it to make a tool that generates road sections for construction - only for visualisation.

We developed a macro called "gravity_tube" that allows easier control of the rotation by defining vectors that the rotations are relative to. An example is here: http://gdl.graphisoft.com/forums/topic/tube-twisting/#post-3848

For Grasshopper users there is a "Sweep" object on BIMComponents that allows extruding a profile along a space curve: https://helpcenter.graphisoft.com/knowledgebase/87306/ . It can be used without GH with a fixed number of four nodes, you can try it to get a feel of the geometry with the rotations. One important thing is that the sections at the nodes can be skewed, their x and y won't always be perpendicular.
Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest
Anonymous
Not applicable
Thanks Peter and Hmooslechner.

@ Peter Baksa
The node rotation reference plan is in the bisector of the angle defined by two segments axis, right?
I can see that the geometry gets much distortions with rotations. Does the "Gravity Tube" totally eliminates them?

I see the profile node rotation as a must, as in many practical situations, roads always have this characteristic. But perhaps someone here on the forum with solid background in civil engineer could give some feedback.
Peter Baksa
Graphisoft
Graphisoft
Braza wrote:
The node rotation reference plane is in the bisector of the angle defined by two segments axis, right?
I can see that the geometry gets much distortions with rotations. Does the "Gravity Tube" totally eliminates them?
Yes, the tricky part is the direction of the 0° direction on that plane. It is the projection of the Z axis to the plane, but sometimes is flipped 180° so the tube is less twisted. Sometimes this flipping is not needed for the model, but it can't be controlled intuitively.
gravity_tube solves this issue by letting you define the axis that is projected onto the plane, and never doing the extra flip.

The distortion of the TUBE remains the same if it is very twisted. That is because the faces between the nodes are planar, keeping a low polygon count.
Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest
Hmooslechner
Moderator
a little look in the recent tries to get it working:



https://www.youtube.com/watch?v=stNRlIlrldY

Its defenitly possible, but there is some cosmetic work to do..


There is another problem with streets: in curved sections, they usually are broader than in straigt directions - sections. Here the tube-command comes to its "boarders". The trailing-curve comes into the topic.
AC5.5-AC27EduAut, PC-Win10, MacbookAirM1, MacbookM1Max, Win-I7+Nvidia
runxel
Legend
Btw, there is an undocumented Registry Key under
HKEY_CURRENT_USER\Software\GRAPHISOFT\ARCHICAD\ARCHICAD <version>\GSModeler\Better GDL Tube Triangulation
Maybe Peter can shed some light onto this one 🙂
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»

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!