如何在Forge Viewer中使用svf文件计算面积和体积 [英] how to calculate area and volume using svf file in forge viewer

查看:251
本文介绍了如何在Forge Viewer中使用svf文件计算面积和体积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要计算3D文件表面的体积和面积.由于forge api可以将各种3D文件转换为svf格式,因此如果我可以根据svf格式文件计算面积和体积,那么我的程序就可以处理所有支持forge api的格式3D文件.但是伪造查看器没有用于计算面积和体积的api.因为伪造查看器基于THREE.js,所以我猜是否可以使用THREE.js的api来计算体积和面积.我已经阅读了Forge Viewer的api,但是没有任何API可以从forge视图中获取THREE.js的几何图形.

I need to calculate volume and area of surfaces of 3D file. Since forge api can convert all kinds of 3D file to svf format, so If I can calculate area and volume from svf format file , then my program can handle all format 3D file that forge api support. But forge viewer doesn't have the api to calculate area and volume. Because forge viewer is based on THREE.js, so I guess if I can use THREE.js's api to calculate volume and area. I read the api of forge viewer, but there is no api to get geometry of THREE.js from forge view.

var viewables = Autodesk.Viewing.Document.getSubItemsWithProperties(doc.getRootItem(), {'type':'geometry'},true);

var viewables = Autodesk.Viewing.Document.getSubItemsWithProperties(doc.getRootItem(), {'type':'geometry'}, true);

我尝试了这一步,它不是THREE.js的几何图形,而是伪造的查看器.它不能用于计算.

I try this one, It's not geometry of THREE.js , but forge viewer's. It can't be used to calculate.

推荐答案

很抱歉,我知道,在Forge Viewer中没有API可用于计算面积或体积,但是您可以自行解决.

Apologizing for the bad news, there is no API available for calculating area or volume in the Forge Viewer as I know, but you make some workaround by yourself.

要将Forge片段转换为THREE.Mesh,可以在此处

For converting Forge fragment into THREE.Mesh, you can check here, here and here. For area calculation, you can refer some codes of the Forge Viewer in the Autodesk.Viewing.Extensions.Measure.Snapper.prototype.snapping3D and Autodesk.Viewing.Extensions.Measure.MeasureTool.prototype.getFaceArea.

希望获得帮助.

这篇关于如何在Forge Viewer中使用svf文件计算面积和体积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆