16 Mar 2018
Custom properties on Viewer: .NET & Lambda & DynamoDB

I've been playing with AWS Lambda for a while now, it's an impressive tool with several benefits that fits this specific sample: quick query data from a database and show on Viewer (custom property panel). As this is not used every time the Viewer loads, just eventually, and for a short task, Lambda fits the bill. And to store the data we can use managed DynamoDB, no worries about managing server, just store the data.
You can try it now:
- Make sure you have a model on any BIM 360 hub with BIMDATA - ObjectCode property
- Go to this Data Management sample, sign-in with your Autodesk account and navigate to the file
- Once you select the object, the "Object Code" button will appear on the toolbar
- You may edit the database at this online editor
This sample is composed of 3 modules (and everything is on Github)
- lambda.dynamo: server-side REST API written in C# .NET and hosted on AWS Lambda, using an Amazon DynamoDB No-SQL database to the data. The basic structure came from this previous sample and blog post.
- static.database.editor: jQuery static UI where the user can navigate on a tree of hierarchical codes (jsTree) and view properties on the panel. Why static? So it can be hosted on any CDN provider, like Amazon Cloud Front.
- viewer.extension: Viewer extension that shows a toolbar button and a docking panel toolbar. It uses the extension skeleton from this older post.
The deployment requires some steps:
1. Deploy the AWS Lambda project, see instruction here.
2. Upload the static.database.editor module to an Amazon S3 bucket then serve it via Cloud Front.
3. On an existing Viewer-base app, load the extension with the property name that will be used to link (see code)
viewer.loadExtension('ObjectCodeExtension', { objectCodeProperty: 'BIMDATA - ObjectCode' });
Interesting, isn't it?