<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create a polyroof with variable number of nodes? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614250#M45404</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;/Kaj&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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​&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="grey"&gt;Operating system used: &lt;EM&gt;Windows 11&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jul 2025 08:27:58 GMT</pubDate>
    <dc:creator>Kaj_AL</dc:creator>
    <dc:date>2025-07-16T08:27:58Z</dc:date>
    <item>
      <title>Create a polyroof with variable number of nodes?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614250#M45404</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;/Kaj&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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​&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="grey"&gt;Operating system used: &lt;EM&gt;Windows 11&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 08:27:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614250#M45404</guid>
      <dc:creator>Kaj_AL</dc:creator>
      <dc:date>2025-07-16T08:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create a polyroof with variable number of nodes?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614254#M45405</link>
      <description>&lt;P&gt;I have not tested this, it is straight from my head.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The number of slab nodes is variable, so lets call it ... numb_slab_nodes&lt;/P&gt;
&lt;P&gt;I am assuming the number of nodes in the pivot polygon will always be the same as the contour polygon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can PUT the coordinates and other info into a buffer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First you need the pivot polygon info ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FOR n = 1 to numb_slab_nodes

PUT ac_coords[n][2], ac_coords[n][3], 0, roofangle, 0, roofmaterial, roofmaterial

NEXT n&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you need the contour polygon info ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FOR n = 1 to numb_slab_nodes

PUT ac_coords[n][2], ac_coords[n][3], 0, 2, 0, roofmaterial

NEXT n&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you can use the POLYROOF command and GET the values back ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;POLYROOF 1, 1, numb_slab_nodes, numb_slab_nodes,
0, 4, 0,
0,
GET(NSP)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or something like that I think.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Barry.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 07:59:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614254#M45405</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2024-07-05T07:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create a polyroof with variable number of nodes?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614255#M45406</link>
      <description>&lt;P&gt;Oh, wow, that was so simple, works like a charm!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone winds up here and need this answer, I had to do "FOR n=1 TO numb_slab_nodes-1"&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 08:17:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Create-a-polyroof-with-variable-number-of-nodes/m-p/614255#M45406</guid>
      <dc:creator>Kaj_AL</dc:creator>
      <dc:date>2024-07-05T08:17:09Z</dc:date>
    </item>
  </channel>
</rss>

