cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

GDL
About building parametric objects with GDL.
SOLVED!

# GLD scripts for Ellipse and curved line

Contributor

Hello All,

Pretty new here to GDL scripting and could use some help with ellipses and irregular curved lines. I have been creating/editing objects for my firm for the last two years, and consistently get hung up on these curves. I believe I understand the trigonometry involved (theta/arcTan/Cos/etc.) in forming these curves, but I don't know fully how to implement them correctly in a script/command.

I assume for 2D shapes one would just use one of the POLY_ commands? Does anyone have any super simple scripts they may have done (ellipse or curved line) to view as an example?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Legend

@Mike Rosado For ellipse creation you can generate a circle / arc and then apply the MUL2 function from the centre point to distort the shape. Not sure if that is mathematically perfect but you did want a simple script!

Irregular curves are likely to be a bit more complex...

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
10 REPLIES 10
Solution
Legend

@Mike Rosado For ellipse creation you can generate a circle / arc and then apply the MUL2 function from the centre point to distort the shape. Not sure if that is mathematically perfect but you did want a simple script!

Irregular curves are likely to be a bit more complex...

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Legend

Most commands in GDL support arc segments (aka curved edges/lines).

Really old ones like POLY might not, but they have newer version (i.e. POLY_) which allow it.

In general arc segments are done by changing their status codes accordingly. Some nodes do not even generate any geometry, like the "900"s flag, which signalises a midpoint for further usage.

Sometimes it is not easy to generate all the necessary curve points, because it involves a fair bit of math and the need to construct it in your head.

DGSketchers tip is nice, but if you need only parts to be elliptic, well, then this will fail and you will need to resolve it manually. Fortunately most of these kind of problems have already solved by some mathematicians, like how to construct an ellipsis from arcs only.

If you have a specific issue in mind it might be easier to help and guide.

Good luck!

Lucas Becker | AC 27 on Mac | 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 |

«Furthermore, I consider that Carth... yearly releases must be destroyed»
Moderator

Another good tip is to draw lines, curves, ellipses, fills in plan and save them as an object.

Have a look at the script and see how they are done.

Draw them on the Project Origin so it is easier to understand the co-ordinates.

They won't be parametric of course but it will show you at least one way how to script them.

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

If you break down your object into parts that are elliptical and those that are not, you could SEO them together?

Ling.

 AC22-23 AUS 7000 Help Those Help You - Add a Signature Self-taught, bend it till it breaks Creating a Thread Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Oh sure! But one has to keep performance in mind.

Never couple SEO groups with a hotspots 😄 Always draw dummy geometry during GLOB_FEEDBACK_MODE. Learned the hard way, but I digress.

For me it looked like the OP also wanted to do it in 2D, where we only have the BasicGeometry (nèe BasicGeometricCalc) macro. But you have to input the real construction points into it and that sometimes means you still have to do everything by hand, since 2D has no GROUP equivalent.

Lucas Becker | AC 27 on Mac | 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 |

«Furthermore, I consider that Carth... yearly releases must be destroyed»
Contributor

@DGSketcher I forgot all about the MUL2 capability of modifying/stretching the object. This ended up working just fine for this object. Thanks for the help!

For Some Context: I was working on an existing Fan Propellor object that needed to ideally fit within varying wall thicknesses and varying widths (window openings). The object was already setup in 3D showing all components in plan, but I've been asked to add an optional 2D symbol (for contractors) to match the size of the Fan.

Contributor

Thank you all for the rapid responses! I appreciate all the help. A simple MUL2 transformation did the trick on this particular object. Although, I will eventually need to explore those additional status codes for some more complex objects with curves/partial ellipses. I don't currently have time at the moment, but when I do I'll surely be posting in the forums for some advice/assistance.

Not to sidebar or detract from the forum topic, but has anyone here used the new PARAM-O plug in for Archicad? We are interested in exploring this as a way to create simple/faster objects.. I've played around with this a tad, but cant seem to find any in-depth information on how to use this software (an equivalent of the GDL reference guide would be great).

Personally I think Param-o is a disaster. It is limited in functionality and further troubled by a shortage of basic information. If you have got the basics of GDL you are already way ahead of Param-O. If you want to learn GDL find a copy of the GDL Cookbook by David Nicholson-Cole on the 'net. It is old but the basics are still relevant.

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Expert

mul2 works well and I used it in the early days but most of my objects involve tubes so the 2D and 3D scripts don't translate (use the same code structure) so that is why I now map each point in the ellipse using:

``````for n = 0 to 360 step resol

put widthEllipse*cos(n), heightEllipse*sin(n), 0

next n

poly2_b nsp/3, 7, fill_pen, background_pen,

get(nsp)``````

I can then use this same code in the 3D but switch the "poly2" out for a "prism" or a "tube".

With the "for n = 0 to 360 step resol" the "resol" part refers to the resolution, however if your total degrees (0 to 360 = 360 total) is not perfectly divisible by the resolution value then you get funny results.

you need "step totalDegress/ceil(totalDegress/resol)"

which for the above would be "step 360/ceil(360/resol)"

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend