Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


	<title>Hello Viewer with Codepen</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="icon" href="data:,">
	<script src="*/viewer3D.min.js"></script>
	<link href="*/style.min.css" rel="stylesheet">

<body style="margin:0; overflow-y: hidden;">
	<div id="panel">
		<select id="folderList" onChange="comboBox.onChanged(this.selectedIndex)"></select>
		<a href="" target="_blank"> 
		&#8594; BLOG POST</a>&#9786;
	<div id="Viewer"></div>


                #panel {
	position: fixed;
	z-index: 2;
	margin: 10px;



                // add your accessToken and hub to the URL, ie
// See Blog for details:

const AV = Autodesk.Viewing;
const div = document.getElementById("Viewer");

// your extension code goes here.... 
class MyExtension extends AV.Extension {
	unload() { return true }
	load() {
		this.viewer.addEventListener(AV.SELECTION_CHANGED_EVENT, (e) => this.onSelect(e) );
		return true;
	onSelect(e) {
		const RED_COLOR = new THREE.Vector4(0, 1, 0, 1);
		if (e.dbIdArray.length>0)
			this.viewer.setThemingColor(e.dbIdArray[0], RED_COLOR );
AV.theExtensionManager.registerExtension("MyExtension", MyExtension);

function startViewer(urn) {
	AV.Initializer({ env: "AutodeskProduction" }, () => {
		const options = { extensions: ["MyExtension"] };
		const viewer = new AV.Private.GuiViewer3D(div, options);
		AV.Document.load(`urn:${urn}`, (doc) => {
			var viewables = doc.getRoot().getDefaultGeometry();
			viewer.loadDocumentNode(doc, viewables);

/// BIM 360 / ACC combo box

class comboBox {
	static onChanged(selectedIndex) {
		const URN = window.btoa(this.items[selectedIndex].id).replace(/=/g, "");

	static async load(div) {
		const { project_id, folder_id, token } = this.parseURL(;
		this.items = await this.fetchFolderContents(project_id, folder_id, token); => {
			div.appendChild(new Option(i.attributes.displayName)) });

	static async fetchFolderContents(project_id, folder_id, token) {
		const url = `${project_id}/folders/${folder_id}/contents`;
		const json = await ( await fetch(url, { headers: { Authorization: `Bearer ${token}` } }) ).json();
		return json.included;

	static parseURL(URL) {
		const params = new URLSearchParams(URL);
		let hub = params.get("hub");
		const isACC = (hub.indexOf('acc')>0);
		const hubACC = hub.slice(36).split("?");
		const hubBIM = hub.slice(31).split("/");
		return {
			project_id: (isACC) ? `b.${hubACC[0].split('/')[1]}` : `b.${hubBIM[1]}`,
			folder_id: (isACC) ? hubACC[1].split('=')[1] : hubBIM[3],
			token: params.get("accessToken")