<?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 Re: GetVolume25DCollection in Forma Site Design Developer Forum</title>
    <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13037682#M133</link>
    <description>&lt;P&gt;Hi Vilde, sorry for the late answer but I have just noticed that I have responded to myself accidentally &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thank you very much for your answer. At the moment my solution is to replace&amp;nbsp;&lt;SPAN&gt;GetVolume25DCollection with&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;GrossFloorAreaPolygons and then I apply the world transform. This seems to resolve most of my issues. The only thing is that in Volume25D.properties&amp;nbsp;I had height value and I don't have it here (in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;GrossFloorAreaPolygons)&lt;/SPAN&gt;&lt;SPAN&gt;. I understand that I can iterate through the elements and take the differences between the levels but it wont work for the last element because I have only the floors elevations. I will try to sort it out somehow - don't think it's a big issue. Also I see in your answer you use Volume25D and that also seems to be obsolete as I can not find it in the documentation anymore.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 23 Sep 2024 08:11:29 GMT</pubDate>
    <dc:creator>mjovic</dc:creator>
    <dc:date>2024-09-23T08:11:29Z</dc:date>
    <item>
      <title>GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13027949#M130</link>
      <description>&lt;P&gt;Hi Forma Team,&lt;/P&gt;&lt;P&gt;In the internal version of our Forma addin we use&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;getVolume25DCollection&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;that you have under&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Forma&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;experimental&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;geometry&lt;/SPAN&gt;&lt;SPAN&gt;. In the documentation you say: "&lt;SPAN&gt;Experimental APIs are subject to change at any time without notice&lt;/SPAN&gt;" so I presume we can not use it in the production version of the addin application. Today I have checked the documentation again and I could not find&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;getVolume25DCollection at all and we are a bit worried about that because this method is very useful for us.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I am wondering are you planning to move the method somewhere or to remove it completely from the SDK ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 09:54:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13027949#M130</guid>
      <dc:creator>mjovic</dc:creator>
      <dc:date>2024-09-18T09:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13028188#M131</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4702067"&gt;@mjovic&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right that this API under&amp;nbsp;&lt;SPAN&gt;Forma&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;experimental&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;geometry&lt;/SPAN&gt; is now deprecated, but there is another way to get the geometry that you are looking for.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;You need to fetch the element and load the&amp;nbsp;&lt;SPAN&gt;volume25DCollection&lt;/SPAN&gt; representation of the element.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;async function loadVolume25Collection(
  representation?: Representation&amp;lt;JsonRepresentations["volume25DCollection"]&amp;gt;,
): Promise&amp;lt;JsonRepresentations["volume25DCollection"] | undefined&amp;gt; {
  if (!representation) return undefined;
  switch (representation.type) {
    case "linked": {
      const data = await Forma.elements.blobs.get({ blobId: representation.blobId });
      return JSON.parse(
        new TextDecoder().decode(data.data),
      ) as JsonRepresentations["volume25DCollection"];
    }
    case "embedded-json":
      return representation.data;
    default:
      return;
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the deprecated API, the geometry was returned with the position relative to the root. For the new API, the raw representation is loaded, so if your use case care about the position of the geometry relative to the proposal, you will need to apply the transformations from the element tree. Here is a code example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;    const { element, elements } = await Forma.elements.get({ urn })    
    const volume25DCollectionRep = element.representations?.volume25DCollection;
    const volume25DCollection = await loadVolume25Collection(volume25DCollectionRep)!;
    if (!volume25DCollection) continue;

    const { transform } = await Forma.elements.getWorldTransform({ path });
    const selectionPredicate = createSelectionPredicate(volume25DCollectionRep?.selection);
    const filteredVolume25DCollection = volume25DCollection.features.filter((f) =&amp;gt;
      selectionPredicate(f.id),
    );

    const transformedVolume25DCollection = {
      type: "FeatureCollection" as const,
      features: filteredVolume25DCollection.map((feature: Volume25D) =&amp;gt; {
        return {
          ...feature,
          properties: {
            ...feature.properties,
            // Scale height by 3rd diagonal element in transform matrix
            height: feature.properties.height * transform[10],
            // Translate and scale elevation -- default untransformed elevation is zero
            elevation: (feature.properties.elevation ?? 0 * transform[10]) + transform[14],
          },
          geometry: {
            ...feature.geometry,
            coordinates: feature.geometry.coordinates.map((coordinates) =&amp;gt;
              transformCoordinates(transform, coordinates),
            ),
          },
        };
      }),
    };&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Using the helper functions:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;export function transformCoordinates(mat1: number[], coordinates: number[][]) {
  const res = Array&amp;lt;[number, number]&amp;gt;(coordinates.length);
  let i, j, k;
  for (k = 0; k &amp;lt; coordinates.length; k++) {
    const resItem: [number, number] = [0, 0];
    const point = [...(coordinates[k] as [number, number]), 0, 1];
    for (i = 0; i &amp;lt; 4; i++) {
      for (j = 0; j &amp;lt; 2; j++) {
        resItem[j] += mat1[i * 4 + j]! * point[i]!;
      }
    }
    res[k] = resItem;
  }
  return res;
}

function createSelectionPredicate(selection?: RepresentationSelection) {
  switch (selection?.type) {
    case undefined:
      return () =&amp;gt; true;
    case "equals":
      return (value: string) =&amp;gt; value === selection.value;
    case "startsWith":
      return (value: string) =&amp;gt; value.startsWith(selection.value);
    default:
      throw new Error(`Invalid selection: ${JSON.stringify(selection ?? {})}`);
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this solves your use case, if not, let me know!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Vilde from the Forma team&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 12:04:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13028188#M131</guid>
      <dc:creator>vilde.barth</dc:creator>
      <dc:date>2024-09-18T12:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13030213#M132</link>
      <description>&lt;P&gt;Hi Vilde thank you very much for your answer. At the moment my solution is to replace&amp;nbsp;&lt;SPAN&gt;GetVolume25DCollection with&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;GrossFloorAreaPolygons and then I apply the world transform. This seems to resolve most of my issues. The only thing is that in Volume25D.properties&amp;nbsp;I had height value and I don't have it here (in&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;GrossFloorAreaPolygons)&lt;/SPAN&gt;&lt;SPAN&gt;. I understand that I can iterate through the elements and take the differences between the levels but it wont work for the last element because I have only the floors elevations. I will try to sort it out somehow - don't think it's a big issue. Also I see in your answer you use Volume25D and that also seems to be obsolete as I can not find it in the documentation anymore.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 19 Sep 2024 07:49:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13030213#M132</guid>
      <dc:creator>mjovic</dc:creator>
      <dc:date>2024-09-19T07:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13037682#M133</link>
      <description>&lt;P&gt;Hi Vilde, sorry for the late answer but I have just noticed that I have responded to myself accidentally &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thank you very much for your answer. At the moment my solution is to replace&amp;nbsp;&lt;SPAN&gt;GetVolume25DCollection with&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;GrossFloorAreaPolygons and then I apply the world transform. This seems to resolve most of my issues. The only thing is that in Volume25D.properties&amp;nbsp;I had height value and I don't have it here (in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;GrossFloorAreaPolygons)&lt;/SPAN&gt;&lt;SPAN&gt;. I understand that I can iterate through the elements and take the differences between the levels but it wont work for the last element because I have only the floors elevations. I will try to sort it out somehow - don't think it's a big issue. Also I see in your answer you use Volume25D and that also seems to be obsolete as I can not find it in the documentation anymore.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 23 Sep 2024 08:11:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13037682#M133</guid>
      <dc:creator>mjovic</dc:creator>
      <dc:date>2024-09-23T08:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13050945#M134</link>
      <description>&lt;P&gt;Hi again!&lt;BR /&gt;I believe this is the type you are looking for is: &lt;A href="https://app.autodeskforma.com/forma-embedded-view-sdk/docs/interfaces/elements_types.Volume25DCollection.html" target="_blank" rel="noopener"&gt;Volume25DCollection&lt;/A&gt;?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is available under det element API, by fetching the &lt;A href="https://app.autodeskforma.com/forma-embedded-view-sdk/docs/interfaces/elements_types.Representations.html" target="_blank" rel="noopener"&gt;element representation&lt;/A&gt;: element.representations.volume25DCollection.&lt;/P&gt;
&lt;P&gt;Let me know if this does not solve your problem.&lt;/P&gt;
&lt;P&gt;Best, Vilde&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 21:16:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13050945#M134</guid>
      <dc:creator>vilde.barth</dc:creator>
      <dc:date>2024-09-27T21:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13124105#M135</link>
      <description>&lt;P&gt;Hi Vilde sorry I just see this message now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Yes I have solved that issue but there is one more thing. I have noticed that sometimes if I try to get gross flor area polygon I am getting this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mjovic_0-1730460251291.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1428440i209FFF0791DD0136/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mjovic_0-1730460251291.png" alt="mjovic_0-1730460251291.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any workaround for this? How to get that data if there is no representation or no gross floor are polygon? Many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 11:25:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13124105#M135</guid>
      <dc:creator>mjovic</dc:creator>
      <dc:date>2024-11-01T11:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: GetVolume25DCollection</title>
      <link>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13130674#M136</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4702067"&gt;@mjovic&lt;/a&gt;,&lt;BR /&gt;An element may have one or more representations, but not necessary all the representations described in the documentation. You can read more about the element system and representations &lt;A href="https://aps.autodesk.com/en/docs/forma/v1/working-with-forma/element-system/forma-element-specification/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;In order to see what representations that is available for an element, you can look into the keys in the representations part of the element (element.representations).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your use case require a certain representation, you might want to communicate to the user which elements that are supported and not.&lt;/P&gt;
&lt;P&gt;Hope this was helping!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards, Vilde&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 09:11:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/forma-site-design-developer/getvolume25dcollection/m-p/13130674#M136</guid>
      <dc:creator>vilde.barth</dc:creator>
      <dc:date>2024-11-05T09:11:09Z</dc:date>
    </item>
  </channel>
</rss>

