I am trying to develop website that can extract length ,width,and height and volume of the model which is in step and stl extention format with autodesk forge apis . I successfully make program to convert step file into svf and set the model on 3d viewer but i am not able to get measures that i need. Thank you in advance.
-
Did you try the measure tool on the viewer toolbar? The button with the ruler icon in the middle of this picture: `https://developer.doc.autodesk.com/bPlouYTd/48/_images/overview1.jpg`. Or, you want to do this programmatically via accessing the mesh info.? – Eason Kang Jul 13 '17 at 15:10
-
i want to get it by programmatically . Because i need to develop other logic as per this measures. – Apurva Bhavsar Jul 13 '17 at 15:14
2 Answers
For extracting data you mentioned above, you might need to retrieve the mesh info. firstly as I know. Here is a similar question for accessing mesh data and converting it from the Forge fragment info: how to calculate area and volume using svf file in forge viewer
After obtaining the THREE.Mesh
from the Forge fragment, you could calculate what you want from the vertices or faces of the mesh programmatically in my experience.
In addition, the web worker might be helpful in this case because model iterating might hurt the performance of your app. JavaScript is running in the single thread on the modern browser, UIs of your app might hang on during the calculation. So, it's recommended to use the web work to run calculation script for the script executing in the separated thread.
Hope this help.

- 6,155
- 1
- 7
- 24
-
Thank you for your reply . I have got the idea about volume . But can you give me brief explanation about how can i get area of three.mesh. – Apurva Bhavsar Jul 13 '17 at 17:09
-
Just like Philippe says, there is no direct way or API for calculating those things you mentioned in the Forge viewer, that is not the specification of the viewer unfortunately. However, you could make your own workaround for this and calculate by yourself. The key point for calculating area is to rebuild 'THREE.Face3' during converting mesh data from Forge fragments to 'THREE.Mesh' together. After this, you could calculate area by the link provided by Philippe. Hope this helps. – Eason Kang Jul 14 '17 at 00:36
-
BTW, the link I provided (https://stackoverflow.com/a/44415211/7745569) has illustrated the way how to rebuild 'THREE.Face3' during 'THREE.Mesh' conversion. Please check it. – Eason Kang Jul 14 '17 at 00:40
-
Thank you Eason Kang and Philippe Leefsma. I got all the parameters from three.mesh and three.face as per your instructions. Thank you for your help. I appreciate it. – Apurva Bhavsar Jul 18 '17 at 14:06
Computing area from a three mesh is not forge-specific, so you can just look for general three.js topics such as this one. It's important to bring to your attention that your approach requires loading the model in the viewer before performing any computation so it cannot be automated, I'm not sure if this is the workflow you are looking for...
... step and stl are pretty general formats, so you may be able to find 3rd party libraries that allow you to perform the same computation directly on those original files and therefore implement the logic server side so the info is directly available upon loading the model or even without. Another way to achieve it could be exporting the model to .obj using Forge Model Derivatives API, but that export cost you 1 cloud credit each time. Hope that helps

- 4,325
- 1
- 14
- 19
-
Thank you for your reply. But can you give me some reference library for python ,java or javascript any language. – Apurva Bhavsar Jul 14 '17 at 15:52
-
I don't know a specific one myself, you need to do your own research for that... just start by googling it. – Felipe Jul 17 '17 at 02:58