admin管理员组文章数量:1332377
I am using Autodesk.Viewing.ModelBuilder to add a clickable model in the Autodesk Viewer. While attempting to modify the shape of the added model, I used the changeGeometry method. Although the shape was successfully updated, I encountered an issue where the highlight indicating the selected state of the model does not disappear after clicking on it.
Code Example
if (hit) {
let geom = new THREE.BufferGeometry().fromGeometry(
new THREE.BoxGeometry(10, 10, 60)
);
const material = new THREE.MeshBasicMaterial({
color: 0xff0000,
transparent: true,
opacity: 0.5
});
const pillarMesh = new THREE.Mesh(geom, material);
pillarMesh.matrix = new THREE.Matrix4()pose(
new THREE.Vector3(hit.point.x, hit.point.y, hit.point.z),
new THREE.Quaternion(0, 0, 0, 1),
new THREE.Vector3(1, 1, 1)
);
//model add
await viewer3D.loadExtension('Autodesk.Viewing.SceneBuilder');
const ext = viewer3D.getExtension('Autodesk.Viewing.SceneBuilder');
const modelBuilder = await ext.addNewModel({
conserveMemory: false,
modelNameOverride: 'My Model Name'
});
modelBuilder.addMesh(pillarMesh);
let newGeom = new THREE.BufferGeometry().fromGeometry(
new THREE.CylinderGeometry(5, 5, 60, 50)
);
console.log("changeGeometry", modelBuilder.changeGeometry(pillarMesh.geometry, newGeom));
}
Problem Description Once the geometry is changed, the highlight persists, even after attempting to deselect the model.
What I Have Tried Attempted to clear the selection using these methods:
viewer.clearSelection();
viewer.select([]);
viewer.toggleSelect(dbid, ModelBuilder.model);
None of these methods resolved the issue. The highlight remains.
Used changeFragmentGeometry instead: I replaced changeGeometry with changeFragmentGeometry to modify the geometry. However, the same issue persists, where the highlight does not disappear.
Expected Outcome I want to modify the geometry of the model dynamically and ensure that the selection state behaves correctly. The highlight should disappear when the selection is cleared or toggled off.
本文标签: javascriptAutodeskViewingModelBuilder changeGeometry Freezes the Model SelectionStack Overflow
版权声明:本文标题:javascript - Autodesk.Viewing.ModelBuilder changeGeometry Freezes the Model Selection - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742306349a2449992.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论