Many industries use this viewer to render the model data in the browser but that needs the model data to be converted into SVF format (a generic format used by forge viewer to render the model data).
Fig. 1: Flowchart describing the flow of conversion
Get started with these quick steps to convert any CAD model Forge viewer compatible
Fig. 2: List of API selection used by the app
Once your app is created successfully it will look like this, note down the client-id and client-secret for the next step
Fig. 3: App information available after successful app creation
2. Generate access-token from client-id and client-secret
To generate access token you will need to use Authentication API of Forge
Fig. 4: Successful access token generation for client_id and client_secret
This access-token will be used by all the operation related to bucket creation, reading bucket, reading bucket’s object data and writing bucket’s object data.
Set this access token in Authorization attribute of header
Fig. 5: Setting up access token in Authorization attribute of header
Access token is set as environment variable in Postman.
3.Create a bucket in forge server
Fig. 6: Successful bucket creation using access-token
4. Upload the model in the Forge bucket
Here I have used .rvt file to upload in Forge bucket you can use any.
Programmatically you can convert the .rvt file content into a byte array and send it in the request body. (You need to set Content-Type as application/octet-stream)
Fig. 7: Successful upload of object(a .rvt file) in forge bucket
After successful upload of the object in the Forge bucket, you need to get the objectId from its response
This objectId needs to be encoded into the Base-64 string.
You can refer to this link https://www.base64encode.org/
This process uses model-derivative API of forge
Fig. 8: Successful creation of translation of object into SVF
After the conversion process is started it continues to run on Forge server. You can track the progress of the conversion as below
Fig. 9: Successful translated CAD model data into SVF
For visualizing the CAD model in Forge viewer I have integrated Forge Extension in Visual Studio Code. You can refer this link https://forge.autodesk.com/blog/forge-visual-studio-code
Fig. 10: Visualising the CAD model data in forge viewer
So we see how simple it is to convert any 3D CAD model Forge viewer renderable. You can integrate Forge viewer in your application and can use language-specific SDK as well for your application.
You can use the POSTMAN import file from here, and don’t forget to set your client-id and client-secret.
Author: V. Bhandari
ProtoTech Solutions Pvt Ltd.