Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot figure out how to get wall radius for label

Podolsky
Newcomer
I need to script a label, that would know radius (also coordinates of radius centre) of the wall. I looked how window knows about it - for that there is special global variable WIDO_ORIG_DIST. But wall's global variables do not have any information about it. Any ideas? Or it's just impossible?
1 ACCEPTED SOLUTION

Solution
Braza
Newcomer
Looks like AC25 has the solution.
New label parameter: LABEL_ASSOC_ELEM_GEOMETRY

radius_of_circle = Arc Length/Subtended Angle in Radians
r = s/θ

Does this now makes sense?
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

View solution in original post

21 REPLIES 21

I have never found the answer either.
I was hoping the radial dimension tool would be a GDL object I could explore, but sadly no.
So I think there is a way to do the math from other values but I haven't had time to look into yet. You would need start, end points (and center maybe) and then a length value.
Or perhaps there is a command I just haven't found it.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Podolsky
Newcomer
The only once way for solving this problem I found via using label coordinates. By placing label automatically it appears always in the middle of the wall. Then I have wall start point, wall arc middle point, chord direction and length of arc. This information would be enough to get formula finding radius and centre of radius.
But the only problem here - if I'm placing label manually (not in the middle of the wall arc) it will calculate wrong radius, also if I'm modifying wall radius, length or position of the end point - it will give me wrong radius.
But there is no another possibility, probably.

Barry Kelly
Moderator
The 'Moldings and Panel' wall accessory works on curved walls.
Having a quick look at the scripts, it uses 'ac_wall_radius'.

So 'ac_wall_radius' will read the radius of the wall for you if you can use that in your label.


Barry.

One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Podolsky
Newcomer
Barry wrote:
The 'Moldings and Panel' wall accessory works on curved walls.
Having a quick look at the scripts, it uses 'ac_wall_radius'.

So 'ac_wall_radius' will read the radius of the wall for you if you can use that in your label.


Barry.
No, I cannot. Wall accessory passing to the GDL object parameters values via Add-on (all information about wall geometry). There is no connection between label and Add-on. If I just set new parameter variable AC_wall_radius in label it will return me zero.

Braza
Newcomer
I noticed that WALL_POSITION[1] gives the chord length of the arc. That with WALL_DIRECTION gives us the real cord length. With this and WALL_LENGTH_A (Arc length) we can get the wall radius thru https://www.vcalc.com/wiki/vCalc/Circle+-+Chord+Length+from+Arc+Length+and+Radius.
Does this makes sense?
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

Podolsky
Newcomer
No. WALL_POSITION means wall position - coordinates x,y,z. Wall position cannot give arc chord length.

Lingwisyer
Virtuoso
Braza wrote:
WALL_POSITION[1]

Is that a new variable in AC24/25? It is not available in AC23...



Ling.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Podolsky
Newcomer
Screen shot from AC17 GDL manual.
Guys, what's wrong here is happening?

Braza
Newcomer
Yes. WALL_POSITION long exists.
But I did a test with a dummy label with WALL_POSITION[1] AND [2] text2.
Noticed that the arc is always counterclockwise although the origin straight wall was from left to right.
Perhaps it is just luck. But it gives you the chord length. Though if I move the wall to the negative side of the origin it will give a different value...
Just turning some rocks.

Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

Podolsky
Newcomer
I cannot comment this anymore.

Solution
Braza
Newcomer
Looks like AC25 has the solution.
New label parameter: LABEL_ASSOC_ELEM_GEOMETRY

radius_of_circle = Arc Length/Subtended Angle in Radians
r = s/θ

Does this now makes sense?
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

View solution in original post

Podolsky
Newcomer
Now it does. I was writing on ArchiCAD 21, so didn't know about this new variable. It's actually introduced in ArchiCAD 23. Thank you a lot - this very useful information.

Braza
Newcomer
You are welcome Podolsky.
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

Aaron Bourgoin
Booster
Podiolsky. I sense beer is coming your way soon. I've introduced your label to a couple of teams in the office to try. I really appreciate your efforts as well as Braza's! Thank you.
Think Like a Spec Writer
AC23-3003 USA / AC24-4018 USA
Rhino 7 Mac
OSX 10.14.6 & 11.3.1

Podolsky
Newcomer
Million of thanks. Soon I will include curve part too, as you can see - we figure it out how to make it.
Please let me know, do you need support for sections, or sections are not relevant.

Aaron Bourgoin
Booster
Hey Podolsky. Sections are less important. Plan cover the mandatory base information we need to submit. But thanks for asking.
Think Like a Spec Writer
AC23-3003 USA / AC24-4018 USA
Rhino 7 Mac
OSX 10.14.6 & 11.3.1

Braza
Newcomer
Hey Aaron,
I am glad my small contribution to Podolsky label could somehow help.
It looks like a proper Fire Rating Label is coming to reality.
Cheers,
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

Podolsky
Newcomer
Yes, I think to keep a label as it is for old ArchiCAD versions, but add ArchiCAD version check, that, if version is 23 and above - to use modified script with a new global. So the object itself then still available starting from AC 21.

Dominic Wyss
Booster
Here's my quick & dirty solution for wall radius:
dict geo, p

if haskey(LABEL_ASSOC_ELEM_GEOMETRY.referenceLine2D.contour.edges[1].ArcAngle) then
	geo.has = "yes"
	geo.ang = LABEL_ASSOC_ELEM_GEOMETRY.referenceLine2D.contour.edges[1].ArcAngle
	geo.num = vardim1(LABEL_ASSOC_ELEM_GEOMETRY.referenceLine2D.contour.edges)

	p = LABEL_ASSOC_ELEM_GEOMETRY.referenceLine2D.contour
	geo.dir.x = p.edges[2].begPoint.x - p.edges[1].begPoint.x
	geo.dir.y = p.edges[2].begPoint.y - p.edges[1].begPoint.y

	geo.chord = (geo.dir.x^2 + geo.dir.y^2)^0.5
	geo.rad = geo.chord/(2*sin(geo.ang/2))


else
	geo.has = "no"
	geo.ang = 0
	geo.num = 0
	geo.rad = 0

endif


hotspot2 0,0

if geo.num > 2 then
	text2 0,0, "poly"

else
	text2 0,0, "ang= " + str("%", geo.ang) + "\nrad= " + str("%", geo.rad)

endif
works for AC23 and younger
AC23 CHE - macOS Catalina

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!