2024-01-11 08:48 AM - last edited on 2024-09-26 01:24 PM by Doreena Deng
Hi
I'm creating a label that shows the dimensions of an opening (created with the opening tool). This works fine for rectangular opening (width + height). But for circular openings the diameter must be shown (or just ∅ width).
Is there a way to find out what the shape of the opening is in a label?
For now i'm using a boolean in the label properties, I hope I can do it automaticly.
Solved! Go to Solution.
2024-01-25 02:29 AM - edited 2024-01-25 02:30 AM
A workaround is to test the area and perimeter. The only downside in the unlikely event a polygon opening could have the same perimeter as a circle with the same overall width and height. But unlikely the case.
eps = 0.0001
!if a opening
if GLOB_ELEM_TYPE = 26 then
n = REQUEST ( "Property_Value_Of_Parent", "Builtin.General_Area", type, dim1, dim2, elementArea)
n = REQUEST ( "Property_Value_Of_Parent", "Builtin.General_3DPerimeter", type, dim1, dim2, elementPerimeter)
!if length x width is the correct area, then a rectangle
if abs( (opening_width * opening_height) - elementArea) < eps then
text2 0, -1, "rectangle " + str(opening_width,4,3) + " x " + str(opening_height,4,3)
else
!if circle then diameter should match
if abs ( (2 * PI * (opening_width/2)) - elementPerimeter ) < eps then
text2 0, -1, "circle diameter " + str(opening_width,4,3)
else
text2 0, -1, "polygon " + str(opening_width,4,3) + " x " + str(opening_height,4,3)
endif
endif
endif
2024-01-12 12:54 PM
There seems to be no way, sadly. The "OPENING_SYMBOL_GEOMETRY" dict is not accessible from a label, so I don't know how to deduce it otherwise.
2024-01-25 02:29 AM - edited 2024-01-25 02:30 AM
A workaround is to test the area and perimeter. The only downside in the unlikely event a polygon opening could have the same perimeter as a circle with the same overall width and height. But unlikely the case.
eps = 0.0001
!if a opening
if GLOB_ELEM_TYPE = 26 then
n = REQUEST ( "Property_Value_Of_Parent", "Builtin.General_Area", type, dim1, dim2, elementArea)
n = REQUEST ( "Property_Value_Of_Parent", "Builtin.General_3DPerimeter", type, dim1, dim2, elementPerimeter)
!if length x width is the correct area, then a rectangle
if abs( (opening_width * opening_height) - elementArea) < eps then
text2 0, -1, "rectangle " + str(opening_width,4,3) + " x " + str(opening_height,4,3)
else
!if circle then diameter should match
if abs ( (2 * PI * (opening_width/2)) - elementPerimeter ) < eps then
text2 0, -1, "circle diameter " + str(opening_width,4,3)
else
text2 0, -1, "polygon " + str(opening_width,4,3) + " x " + str(opening_height,4,3)
endif
endif
endif
2024-01-25 08:58 AM
Thanks Mark!
This works perfect!
gr
Dries