如何让我的autodesk扩展出现?



一直有autodesk教程的这一步的问题,ForgeTree和ForgeViewer工作得很好,但我不能得到handleselectionextension工作在所有,没有菜单或工具栏显示只是一个空窗口

https://learnforge.autodesk.io//观众/扩展/选择

main.css

.handleSelectionExtensionIcon {
background-image: url(https://github.com/encharm/Font-Awesome-SVG-PNG/raw/master/white/png/24/object-group.png);
background-size: 24px;
background-repeat: no-repeat;
background-position: center;
}

index . html

<!-- this project files -->
<link href="css/main.css" rel="stylesheet" />
<script src="js/ForgeTree.js"></script>
<script src="js/ForgeViewer.js"></script>

<script src="js/handleselectionextension.js"></script>

扩展名只是教程

中显示的扩展名

您必须在Forge查看器中加载扩展。

viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'), { extensions: ['HandleSelectionExtension'] });

之后,您可以调用下面的代码单击按钮来隔离所选对象。

// Get current selection
const selection = this.viewer.getSelection();
this.viewer.clearSelection();
// Anything selected?
if (selection.length > 0) {
let isolated = [];
// Iterate through the list of selected dbIds
selection.forEach((dbId) => {
// Get properties of each dbId
this.viewer.getProperties(dbId, (props) => {
// Output properties to console
console.log(props);
// Ask if want to isolate
if (confirm(`Isolate ${props.name} (${props.externalId})?`)) {
isolated.push(dbId);
this.viewer.isolate(isolated);
}
});
});
} else {
// If nothing selected, restore
this.viewer.isolate(0);
}

最新更新