Access to unit distribution

Access to unit distribution

helpBJ5T4
Explorer Explorer
990 Views
4 Replies
Message 1 of 5

Access to unit distribution

helpBJ5T4
Explorer
Explorer

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!

991 Views
4 Replies
Replies (4)
Message 2 of 5

md_amjad_hossain
Alumni
Alumni

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
0 Likes
Message 3 of 5

helpBJ5T4
Explorer
Explorer

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 !

0 Likes
Message 4 of 5

helpBJ5T4
Explorer
Explorer

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

0 Likes
Message 5 of 5

md_amjad_hossain
Alumni
Alumni

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
0 Likes