27 Oct 2021
Viewing 3D Models on Node-RED platforms
This blog post is extension of https://forge.autodesk.com/blog/forge-node-red-visual-programming-forge
In this post we will see how to view a 3D model using Forge nodes on Node-RED platform.
Setup
For Windows
Using cmd: node --version && npm --version
You should receive back output that looks similar to:
v14.15.1 6.14.8 npm install -g --unsafe-perm node-red
Once installed, the simple way to run Node-RED is to use the `node-red` command in a command prompt: If you have installed Node-RED as a global npm package, you can use the node-red command:
C:>node-red
This will output the Node-RED log to the terminal. You must keep the terminal open in order to keep Node-RED running.
Open browser and run http://127.0.0.1:1880
You will see this window.
Note that running Node-RED will create a new folder in your %USERPROFILE%
folder called .node-red
. This is your userDir
folder, think of it as the home folder for Node-RED configuration for the current user. You will often see this referred to as ~/.node-red
in documentation. ~
is shorthand for the user home folder on Unix-like systems. You can use the same reference if using PowerShell as your command line as recommended. If you are using the older cmd
shell, that won’t work.
Setup Node-Forge
Close the browser or cancel Node server if it is running.
cd %USERPROFILE%\.node-red npm install node-red-node-forge --save
Viewing The Model
-
Download https://github.com/cyrillef/node-red-node-forge/blob/master/examples/ViewerFlow.json
-
Copy to
%USERPROFILE%\.node-red\lib\flows
-
Download https://github.com/cyrillef/node-red-node-forge/blob/master/testFiles/Hook.stp
-
Copy to any local folder and note the full path
- Example
C:\Temp\Hook.stp
- Example
-
Launch the node-red
node-red
-
Open browser and run
http://127.0.0.1:1880
-
Click on the Hamburger Button on the UI
-
Click on the Import
-
Go to Lib\Flows and Select
ViewerFlow.json
-
After importing the flow, you should see
Select Dev Credentials
-
Select the
Hook Model
, and editmsg.payload
with following
bucket
name of your bucketkey
object keylocalFilename
valid path of the model file that you would like to view."bucket": "node-red-bucket-viewer",
"key": "Hook.stp",
"localFilename": "C:/Users/Madhukar/Documents/Hook.stp",
"region": "US"
- Edit all the
Hook Model
Nodes, andTranslate and Wait
make sure you select the SVF 2D and 3D view in theMD Translate
node. - Update all other Nodes with
forge-node-viewer-test
Follow this video tutorial for interactive steps.