Pushing GFA polygons to Forma

Pushing GFA polygons to Forma

ferenc_daniel
Explorer Explorer
633 Views
2 Replies
Message 1 of 3

Pushing GFA polygons to Forma

ferenc_daniel
Explorer
Explorer

Dear Forma Team,

 

I'm working on an extension for Codesign, an iPad-based concept design tool for architects. Our goal is to enable users to transfer building concept designs to Forma.

 

At this stage, I've successfully pushed building meshes from our app into Forma using an HTTP-based generator and the Integrate API, similar to the example described here: https://aps.autodesk.com/en/docs/forma/v1/developers_guide/generators/http-example-hello-world/. However, the geometry pushed in this manner lacks Area Metrics.

 

Ideally, I would like to include additional building data in Forma, such as GFA polygons, as specified in your documentation here: https://aps.autodesk.com/en/docs/forma/v1/developers_guide/background/element-system/#specifying-gfa....

 

I've attempted two different approaches, including pushing GFA polygons through the generator and utilizing methods from the Embedded View SDK. So far, I couldn't figure out the correct payload for these methods to achieve this goal. I'm currently in the process of exploring the most effective approach for this task.

 

Could you please provide guidance or suggestions on how to proceed in the right direction?

Thank you for your help.

 

Kind regards,
Daniel

0 Likes
Accepted solutions (1)
634 Views
2 Replies
Replies (2)
Message 2 of 3

trygve_aaberge
Autodesk
Autodesk
Accepted solution

Hi. The GFA polygons should be set on the element you create in the generator. So for an HTTP generator, this would be in the `properties` of the element when posting to the Integrate API.

 

Here is an example post body to Integrate API to create an element with GFA polygons: 

 

{
    rootElement: "element1",
    elements: {
      element1: {
        id: "element1",
        properties: {
          geometry: {
            type: "Inline",
            format: "Mesh",
            verts: Array.from(mesh.verts),
            faces: Array.from(mesh.faces),
          },
          generator: {
            generatorId: requestBody.generatorId,
            schemaVersion: requestBody.generatorSchemaVersion,
            values: requestBody.generatorValues,
          },
          areaStatsReps: {
            grossFloorPolygonsV2: [
              {
                grossFloorPolygon: [...],
                elevation: 0,
              },
            ],
          },
        },
      },
    },
  }

 

 

I've attached the full source code for an HTTP generator that creates an extruded polygon with GFA polygons. It works with the default "Localhost http generator" from the "local_testing" extension. (I had to rename the file extension to .txt as the forum doesn't allow .js files.)


Trygve Aaberge
Software Engineer
Message 3 of 3

ferenc_daniel
Explorer
Explorer

Hey Trygve,

 

Thank you for your response!
It appears I overlooked wrapping the array of polygon points within another array, as follows:

grossFloorPolygon: [[[x1, y1], [x2, y2], …]]


I appreciate the code snippet that helped me identify this issue.

Thanks,
Dani

0 Likes