当前位置: 首页 > news >正文

iTwin 几何属性获取

面积体积半径

获取几何属性,如面积,体积,半径,可以使用getMassProperties这个接口

async onGetMassProperty(){const vp = IModelApp.viewManager.selectedView;const iModel = vp?.iModel;if (!iModel) return;console.log("iModel.selectionSet.elements", iModel.selectionSet.elements);const volumeResult = await iModel.getMassProperties({operation: MassPropertiesOperation.AccumulateVolumes,candidates:  Array.from(iModel.selectionSet.elements),});const areaResult = await iModel.getMassProperties({operation: MassPropertiesOperation.AccumulateAreas,candidates: Array.from(iModel.selectionSet.elements),});const lengthResult = await iModel.getMassProperties({operation: MassPropertiesOperation.AccumulateLengths,candidates: Array.from(iModel.selectionSet.elements),});console.log("volumeResult", volumeResult);console.log("areaResult", areaResult);console.log("lengthResult", lengthResult);},

位置相关

range,origin,rotation等

async getPlacement(){const vp = IModelApp.viewManager.selectedView;const iModel = vp?.iModel;if (!iModel) return;      const placements = await iModel.elements.getPlacements(iModel.selectionSet.elements);console.log("placements", JSON.stringify(placements));},

placements [{"origin":[34.199960548813415,7.3376951500380025,0],"angles":{"roll":136.25855192488035,"yaw":-2.6355965215330106},"bbox":{"low":[-3.329577892100504,-3.329577892100506,-3.3295778921005064],"high":[3.3295778921005077,3.329577892100506,3.3295778921005064]},"elementId":"0x20000000047"}]

几何图元具体信息

GeometryStreamIterator

// 打开snapshot测试
import { IModelHost, SnapshotDb, StandaloneDb} from "@itwin/core-backend"
import { GeometryStreamIterator } from "@itwin/core-common";
IModelHost.startup();
const iModel = SnapshotDb.openFile("../assets/geometry.bim");
const value = iModel.elements.getElementProps({ id: '0x20000000049', wantGeometry: true });
console.log("ElementProps",JSON.stringify(value));
const it = new GeometryStreamIterator(value.geom, value.category);
const primitiveGeometry = [];for (const entry of it) {    primitiveGeometry.push(entry.primitive);
}
console.log("PrimitiveGeometry:", JSON.stringify(primitiveGeometry));

Tips:5.0后不可以直接用snapshot,上述仅为实例

http://www.dtcms.com/a/294873.html

相关文章:

  • RAG实战指南 Day 22:混合检索策略实现
  • 认识linux进程内存布局以及与命令行参数和环境变量的关系
  • java 位运算转换 bit operator convert
  • WTL 桌面开发入门
  • Medical | 批次 批号 批准文号
  • 直接偏好优化(DPO):原理、演进与大模型对齐新范式
  • git查看两个commit之间有哪些Pull Request
  • 【盘古100Pro+开发板实验例程】FPGA学习 | Modelsim 的使用和 do 文件编写
  • 如何通过内网穿透,访问公司内部服务器?
  • 企业选择将服务器放在IDC机房托管的优势
  • Python 程序设计讲义(7):Python 的基本数据类型——整数类型
  • 什么是HTTP长连接、短连接?谁更能抗DoS攻击?
  • Vue 中 :value 和 :value.sync 的区别
  • La Création du C++ : Une Épopée dans l‘Évolution de la Programmation
  • Encore.ts:下一代高性能 TypeScript 后端框架的崛起
  • 后仿之 SDF优先级和相关概念
  • Kubernetes 服务发布进阶
  • 大模型开发
  • 图的BFS和DFS
  • 优化 Elasticsearch JVM 参数配置指南
  • 网安-SQL注入-sqli-labs
  • 前端Web性能核心指标全解析与优化实战指南
  • Mermaid流程图
  • netstat -tunlp | grep的作用
  • day 33打卡
  • 位运算在算法竞赛中的应用(基于C++语言)_位运算优化
  • SAP亚太区借力Business AI加速云转型,第二季度客户扩展势头强劲
  • 【Lucene】leafreadercontext逻辑段与segment物理磁盘段的关系
  • 牛油果褐变的成因与食用安全
  • 天津大学陈亚楠教授团队 ACS AEM:焦耳热超快合成非平衡态能源材料——毫秒级制备与跨体系性能突破