/forge-sketchit-revit

SketchIt is web application that creates walls and floors in a SVG Canvas to later create & visualize the result RVT file.

Primary LanguageJavaScript

Sketch on the browser and generate Revit models

Node.js npm Platforms Design-Automation

Viewer

Windows .NET Revit-2019

Advanced MIT

Description

This NodeJS app demonstrates an end to end use case for external developers using Design Automation for Revit. In addition to using Design Automation for Revit REST APIs, this app also leverages other Autodesk Forge services like Data Management API (OSS), Viewer API and Model Derivative services.

The sketcher is built using Redux with React and makes use of Flux architecture extensively.

How does it work?

thumbnail

Main Parts of The Work

  1. Create a Revit Plugin to be used within AppBundle of Design Automation for Revit. Please check PlugIn

  2. Create your App, upload the AppBundle, define your Activity and test the workitem with Insomnia Rest workflow.

  3. Create the Web App to call the workitem.

Web App Setup

Prerequisites

For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app. For this new app, use http://localhost:3000/api/forge/callback/oauth as Callback URL, although is not used on 2-legged flow. Finally take note of the Client ID and Client Secret.

  1. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
  2. Visual Code: Visual Code (Windows or MacOS).
  3. ngrok: Routing tool, download here
  4. Revit 2019: required to compile changes into the plugin
  5. JavaScript ES6 syntax for server-side.
  6. JavaScript basic knowledge with jQuery
  7. React & Redux & Flux framework architecture

Running locally

Install NodeJS, version 8 or newer.

Clone this project or download it (this nodejs branch only). It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):

git clone https://github.com/autodesk-forge/design.automation-nodejs-sketchIt.git

To run it, install the required packages, set the enviroment variables with your Client ID, Secret, Bucket Key and Nickname value and finally start it. Via command line, navigate to the folder where this repository was cloned and use the following:

Mac OSX/Linux (Terminal)

npm install
export FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
export FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
export FORGE_BUCKET_KEY=<<YOUR UNIQUE BUCKET KEY>>
export FORGE_ACTIVITY_ID=<<YOUR DESIGN AUTOMATION ACTIVITY ID>>
export FORGE_WEBHOOK_URL=<<YOUR DESIGN AUTOMATION FOR REVIT CALLBACK URL>>
npm start

Windows (use Node.js command line from Start menu)

npm install
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
set FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
set FORGE_BUCKET_KEY=<<YOUR UNIQUE BUCKET KEY>>
set FORGE_ACTIVITY_ID=<<YOUR DESIGN AUTOMATION ACTIVITY ID>>
set FORGE_WEBHOOK_URL=<<YOUR DESIGN AUTOMATION FOR REVIT CALLBACK URL>>
npm start

Start the app

Open the browser: http://localhost:3000. Select the element to create (top-right buttons). Click on Generate Revit Model, wait until is ready to view.

Further Reading

Documentation:

Desktop APIs:

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Jaime Rosales D. Twitter Follow

Forge Partner Development