[英]How do I enable text selection in Autodesk Forge Viewer with DWG as document
查看器沒有專門的“文本選擇”功能,但您可以:
通過訂閱SELECTION_CHANGED_EVENT ,在選擇2D 或 3D 設計的某個元素時收到通知
使用viewer.getProperties方法提取任何單個設計元素的元數據,並查看它是否可能包含任何屬性及其文本內容
你可以嘗試這樣的事情:
viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT, function () {
const selectedIds = viewer.getSelection();
if (selectedIds.length === 1) {
viewer.getProperties(selectedIds[0], function (result) {
for (const prop of result.properties) {
console.log(prop.displayName, prop.displayValue);
// see if any of the properties of the element contains its text content
}
});
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.