简述
fractal 3D支持若干种测量功能,包括壁厚、棱边长度、距离、半径、平面夹角、体积,表面积。
关闭测量功能
可直接使用代码控制关闭部分测量功能
监听测量事件
不同的测量类型会有不同的测量数据产生,具体测量数据在此处可以获得。
示例代码:
// 在 api 中添加了一个测量
instance.on('addMeasure', (data)=> {
console.log(data)
});
// 在 api 中删除了一个测量
instance.on('removeMeasure', (data)=> {
console.log(data)
})
// 一个测量被更新
instance.on('updateMeasure', (data)=> {
console.log(data)
})
测量相关事件在> 此处可以获得。
获取测量所有数据
instance.getMeasureList()
完整示例
请参考Demos中的measure.html
测量值数据结构
壁厚
{
"measuretype": "thickness",
"point1": {
"x": -233.33166687497376,
"y": -27.820770107593724,
"z": 34.13326525238699
},
"point2": {
"x": -193.331666874974,
"y": -27.820770107593734,
"z": 34.13326525238699
},
"value": 39.99999999999977
}
棱边长度
- point1, point2 为棱边端点
- point 为点击处(导引线引出点)
{
"measuretype": "length",
"point1": {
"x": -233.33166687497408,
"y": -195.86718326875666,
"z": 199.99999999999997
},
"point2": {
"x": -233.33166687497396,
"y": 204.13281673124334,
"z": 199.99999999999997
},
"point": {
"x": -233.33166687497408,
"y": -61.47215610811213,
"z": 388.93382263183594
},
"edgeType": "curve",
"value": 628.289285968155,
"targets": [{
"object": "1-0-3-1-0",
"groupIndex": 0
}]
}
其中,edgeType 为:
- line,直线
- arc,圆弧
- curve,曲线
距离
{
"measuretype": "distance",
"point1": {
"x": 113.331666874974,
"y": -95.86718326875668,
"z": 300.0000000000001,
"isVertex": true
},
"point2": {
"x": -86.668333125026,
"y": -95.86718326875668,
"z": 300.0000000000001,
"isVertex": true
},
"value": 200
}
半径
直接获取获取圆弧信息时:
{
"measuretype": "radius",
"point": {
"x": -233.33166687497408,
"y": -164.44564396211604,
"z": 307.61647033691406
},
"center": {
"x": 4.263256414560601e-14,
"y": 4.263256414560601e-14,
"z": 40
},
"radius": 200,
"targets": [{
"object": "1-0-3-1-0",
"groupIndex": 0
}]
}
平面夹角
- point1: 夹角第一条边的点
- point2: 夹角第二条边的点
- point3: 第二个点击处的点
- cross: 夹角交点
- plane: 夹角所在面
{
"measuretype": "angle",
"targets": [{
"object": "0-0-0-0",
"groupIndex": 2
}, {
"object": "0-0-0-0",
"groupIndex": 1
}],
"point1": {
"x": 20.207392137945398,
"y": -26.907778971347412,
"z": 300.0000000000001
},
"point2": {
"x": 20.207392137945398,
"y": -95.86718326875668,
"z": 231.04059570259085
},
"point3": {
"x": 1.5733223212994663,
"y": -95.86718326875668,
"z": 265.83019377444464
},
"cross": {
"x": 20.207392137945398,
"y": -95.86718326875668,
"z": 300.0000000000001
},
"value": 1.5707963267948966,
"plane": {
"normal": {
"x": 1,
"y": 0,
"z": 0
},
"constant": -20.207392137945398
}
}
体积/表面积
{
"volume": 1284188.3542226937,
"area": 149706.83588513362,
"point": {
"x": 2.2264744374143675,
"y": -163.83816678279697,
"z": -32.35727778158173
},
"measuretype": "entity",
"targets": [{
"object": "0-0-37"
}]
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。