Community
Forma Developer Forum
Welcome to Autodesk Forma Developer Forum. Share your knowledge, ask questions, and explore popular Forma API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access to unit distribution

4 REPLIES 4
Reply
Message 1 of 5
helpBJ5T4
138 Views, 4 Replies

Access to unit distribution

Hi !

 

Is there a way to access the information contained in Area metrics > Units > Unit distribution ? I have checked the whole documentation about forma-embedded-view-sdk but I can't find a way to access this information.

 

helpBJ5T4_0-1718811876292.png

 



Thanks for your answer!

Labels (4)
4 REPLIES 4
Message 2 of 5

Hei @helpBJ5T4:

 

Thanks for your question.

 

I believe you can find them under the AreaMetrics API. For example:

 

const currentlySelected = await Forma.selection.getSelection()
const areaMetrics = await Forma.areaMetrics.calculate({
  paths: currentlySelected
})

console.log(areaMetrics.unitStatistics)

 

 



Md Amjad Hossain
Software Development Engineer
Message 3 of 5
helpBJ5T4
in reply to: helpBJ5T4

Hi !

Thanks a lot for your answer. However, I try it on the building or the floor element and I only have this result, whereas I have some units :
{id'unit_count'name'Number of units'unitOfMeasurement'COUNT'value0}

Do you have an idea ?

Thanks a lot !

Message 4 of 5
helpBJ5T4
in reply to: helpBJ5T4

Hi !

Thanks a lot for your answer. However, I try it on the building or the floor element and I only have this result, whereas I have some units :
{id: 'unit_count', name: 'Number of units', unitOfMeasurement: 'COUNT', value: 0}

Do you have an idea ?

Thanks a lot !

Lucas

Message 5 of 5

Hei @helpBJ5T4

 

I believe the whole point of API is to give you the information already available on the screen. So, If you want to produce/get the information regarding the unit distribution, I would recommend drawing a House Under Building tool. Now If I select that building and then perform the below operations - 
 

const currentlySelected = await Forma.selection.getSelection()

Then I would get something like ['root/12bdf6d'], the path of that selected building/element.

 

const areaMetrics = await Forma.areaMetrics.calculate({
  paths: currentlySelected
})

Now, this will give me an array of objects - 

{customMetrics: Array(3), builtInMetrics: {…}, unitStatistics: {…}, parkingStatistics: {…}}

And from that object, one can retrieve the `UnitStatistics`. 

And, the whole point here is, does the information available on the screen/proposal?

 



Md Amjad Hossain
Software Development Engineer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Technology Administrators