We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-08-17 10:46 AM - edited 2023-08-17 10:51 AM
Hi all,
I'm getting started with GDL, so please excuse me foe the dumb question!
To get the 3D length of the railing panel I can use RAILINGPANEL_GEOMETRY to get the coordinates of the points and subtract to get the length. But this one doesn't work in 2D. I tried the same trick with RAIL2D_FULL_POLYGON_GEOM but it doesn't work. Maybe I got lucky and have the 3D one working without thoroughly understand how it behaves. Can someone show me how I can get the panel's length in 2D script?
Thanks a lot in advance!
BIM Manager
DKO Architecture - HCMC
2023-09-06 09:38 AM
Hi,
sorry for the late reply.
For straight panels you have to use both coordinates with Pythagorean theorem.
Curved panels are not that easy, curves are described with the same format as the Polyoperations addon uses:
* x and y coordinates are the start point of the arc (the end is the next x, y, point)
* the third parameter is the signed central angle of the arc. Here are some illustrations.
The arc length, using trigonometry is: (PI / 180) * chordlength * ((alpha / 2) / sin (alpha / 2))
2023-09-06 10:56 AM - edited 2023-09-06 11:52 AM
@Peter Baksa wrote:.....
For straight panels you have to use both coordinates with Pythagorean theorem.
....
Hi Peter, no worries! Thanks for the information, this is really helpful! Let's focus on straight panel for now, as this was my problem anyway
Now I assume we need the coordinate of 2 points to calculate their distance using Pythagorean theorem
d = sqrt((x2-x1)^2+(y2-y1)^2)
But I can't seem to use RAIL2D_FULL_POLYGON_GEOM to get the coordinates of the 2 points:
- If I use RAIL2D_FULL_POLYGON_GEOM[2][1] - RAIL2D_FULL_POLYGON_GEOM[1][1], I have the following error
- With RAIL2D_FULL_POLYGON_GEOM[1][1] - RAIL2D_FULL_POLYGON_GEOM[1][2], the script is ok, but this is not the value we look for (which should be x2-x1)? And the result is 0.0000 anyway
- Last attempt: if I would consider the first point to be 0,0, and the second point is actually what can be pulled from RAIL2D_FULL_POLYGON_GEOM, then the result of this command
dummy = sqr(RAIL2D_FULL_POLYLINE_GEOM[1][1]^2 + RAIL2D_FULL_POLYLINE_GEOM[1][2]^2)
print dummy
is 0.0000 in Report dialog
Thank you once again!
BIM Manager
DKO Architecture - HCMC
2023-09-18 01:19 PM
Oh I see. During check script global variables might not be filled with sensible geometric data like they would when the object is placed in the plan.
Check with vardim1 whether the array size is good for your calculations.