A Pen by Anon Ymous on CodePen.
Created
November 8, 2023 18:53
-
-
Save ancientstraits/b315311750e2f31924ee377a799c4dbb to your computer and use it in GitHub Desktop.
XWOMBBE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script> | |
<div id="viewer"></div> | |
<select id="models"></select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { initViewer, listModels, loadModel } from 'https://aps-codepen.autodesk.io/utils.js'; | |
const viewer = await initViewer(document.getElementById('viewer'), { extensions: ['Autodesk.DocumentBrowser'] }); | |
const models = await listModels(); | |
const dropdown = document.getElementById('models'); | |
dropdown.innerHTML = models.map(m => `<option value="${m.urn}">${m.name}</option>`).join(''); | |
dropdown.onchange = () => dropdown.value && loadModel(viewer, dropdown.value); | |
dropdown.onchange(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#viewer { | |
position: absolute; | |
inset: 0; | |
} | |
#models { | |
position: absolute; | |
left: 1em; | |
top: 1em; | |
z-index: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment