We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2024-07-05 09:14 AM - edited 2024-07-05 09:15 AM
Hi!
I'm creating an object where part of it is a POLYROOF. This object is a slab accessory, so the number of nodes controlling the shape of the polyroof can vary depending on slab.
Is there any way to be smart about this and use for example "FOR i TO nsp/3 STEP 1" or something similar within the object, or do I have to create a new polyroof command for each possible number of slab nodes? Any good ideas on how to avoid a a lot of code?
In the code below, NSP is the number of coordinates I have (tripled by 3), and the ac_coords[][] array are my x and y values. Note that the code below only works if the slab has 4 nodes.
Thank you!
/Kaj
POLYROOF 1, 1, NSP/3, NSP/3,
0, 4, 0,
0,
! Start of pivot polygon
ac_coords[1][2], ac_coords[1][3], 0, roofangle, 0, roofmaterial, roofmaterial,
ac_coords[2][2], ac_coords[2][3], 0, roofangle, 0, roofmaterial, roofmaterial,
ac_coords[3][2], ac_coords[3][3], 0, roofangle, 0, roofmaterial, roofmaterial,
ac_coords[4][2], ac_coords[4][3], 0, roofangle, 0, roofmaterial, roofmaterial,
ac_coords[5][2], ac_coords[5][3], -1, roofangle, 0, roofmaterial, roofmaterial,
! Start of contour polygon
ac_coords[1][2], ac_coords[1][3], 0, 2, 0, roofmaterial,
ac_coords[2][2], ac_coords[2][3], 0, 2, 0, roofmaterial,
ac_coords[3][2], ac_coords[3][3], 0, 2, 0, roofmaterial,
ac_coords[4][2], ac_coords[4][3], 0, 2, 0, roofmaterial,
ac_coords[5][2], ac_coords[5][3], -1, 2, 0, roofmaterial
Operating system used: Windows 11
Solved! Go to Solution.
2024-07-05 09:59 AM
I have not tested this, it is straight from my head.
The number of slab nodes is variable, so lets call it ... numb_slab_nodes
I am assuming the number of nodes in the pivot polygon will always be the same as the contour polygon.
You can PUT the coordinates and other info into a buffer.
First you need the pivot polygon info ...
FOR n = 1 to numb_slab_nodes
PUT ac_coords[n][2], ac_coords[n][3], 0, roofangle, 0, roofmaterial, roofmaterial
NEXT n
Then you need the contour polygon info ...
FOR n = 1 to numb_slab_nodes
PUT ac_coords[n][2], ac_coords[n][3], 0, 2, 0, roofmaterial
NEXT n
Now you can use the POLYROOF command and GET the values back ...
POLYROOF 1, 1, numb_slab_nodes, numb_slab_nodes,
0, 4, 0,
0,
GET(NSP)
Or something like that I think.
Barry.
2024-07-05 09:59 AM
I have not tested this, it is straight from my head.
The number of slab nodes is variable, so lets call it ... numb_slab_nodes
I am assuming the number of nodes in the pivot polygon will always be the same as the contour polygon.
You can PUT the coordinates and other info into a buffer.
First you need the pivot polygon info ...
FOR n = 1 to numb_slab_nodes
PUT ac_coords[n][2], ac_coords[n][3], 0, roofangle, 0, roofmaterial, roofmaterial
NEXT n
Then you need the contour polygon info ...
FOR n = 1 to numb_slab_nodes
PUT ac_coords[n][2], ac_coords[n][3], 0, 2, 0, roofmaterial
NEXT n
Now you can use the POLYROOF command and GET the values back ...
POLYROOF 1, 1, numb_slab_nodes, numb_slab_nodes,
0, 4, 0,
0,
GET(NSP)
Or something like that I think.
Barry.
2024-07-05 10:17 AM
Oh, wow, that was so simple, works like a charm!
If anyone winds up here and need this answer, I had to do "FOR n=1 TO numb_slab_nodes-1"
and then PUT a last line where I replace the 0 with a -1 to close the polygon, but other than that it works perfectly.
Thank you!