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

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

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.
SOLVED!

Create a polyroof with variable number of nodes?

Kaj_AL
Booster

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

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator

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.

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

View solution in original post

2 REPLIES 2
Solution
Barry Kelly
Moderator

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.

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

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!

Archicad 24-27 SWE
Dell Precision 5560, Windows 11 Pro
11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz 2.61 GHz

Setup info provided by author