Extension showing custom properties in the Properties palette, based on their dbId
.
Include the JS file on your page. This CDN is compatible with the lastest Viewer version (v7).
<script src="http://cdn.jsdelivr.net/gh/autodesk-forge/forge-extensions/public/extensions/CustomPropertiesExtension/contents/main.js"></script>
Load the extension passing the properties you want to add to various objects based on their dbId
.
viewer.loadExtension('CustomPropertiesExtension', {
"properties": {
"1": {
"My Group": {
"My Property": "My Property Value"
}
},
"3": {
"My Other Group": {
"My Other Property": "My Other Property Value"
}
}
}
})
The properties
contains the dbId's you assign custom properties to.
The custom properties will appear in the Properties palette.
The sample is based on this blog post.