19 Jan 2020

Walkthrough sample of Model Coordination API in NetCore

Follow @Xiaodong Liang

To get started with model coordination API of BIM 360 in .Net Core, you cannot miss this sample. It is written by Don Whittle who works on model coordination API in engineer team. 

 https://github.com/Autodesk-Forge/forge-bim360-modelcoordination-walkthrough

This is a walkthrough sample which demonstrates the following scenarios. They are commandline tests.
 
1. Create Model Set: upload local test files to BIM 360 folder, and create model set of model coordination. It will trigger the coordination process of this folder.

cms

 
 
2. Model Set Versions: query model set versions via version number and tip. It will return if the tip version has been successfully coordinated.

getms

 
3. Clash Results: export the clash data files of a specific model set version. These files are formatted in json. They can be opened by any tool that can read json. Check this tutorial for more details on these files. 

  • scope-version-clash.*.*.*
  • scope-version-clash-instance.*.*.*            
  • scope-version-document.*.*.*   

getclash

 
4. Assigned and Closed Clash: Query assigned/closed clash groups and present issue statistic. 

clashissue

 
5. Model Set Indexes: dump BIM property against a model set version by Index API of model coordination. This provides the way to get object properties on server side, instead of by the usual way that queries properties by Forge Viewer (client side). It is very useful to analyze the objects v.s. clashes at backend. The other blog (Clash Analysis by PowerBI) takes advantage of this API. The Index properties data is not a format as Json, 

getindex

 
6. Model Set Views: Create and query mode set custom views.

createv

     
7. Classify Clashing Objects: Use BIM property index to classify clashing objects. The code will get property index manifest (which contains map between documents and property index) firstly. Next, get clash groups, find out the corresponding documents of the clash, clash data and finally query the index property of the objects. The results of the clash objects information will be generated to the user's default profile directory.

classify

 

Great! If you have performed these tests, I believe you have got basic idea how the API works.  

These tests build on one another. The execution order above matters. Some testes will generate configuration files for use of later tests. e.g. the first step will create a file CreateModelSetSampleState.json, which the model set id and version number are enclosed. It is suggested to run from the first test, while the first test (Create Model Set) takes time (uploading and coordinating).  If you want to check existing model set, it is also possible to skip this test. However, you will need to ensure CreateModelSetSampleState.json is available and it contains model set id and version number.
 
Model coordination API requires 3 legged token, this sample provides 3 ways to specify the token. The 1 and 2 way are manual. It assumes the token has been got by other tool (such as Postman collection). Next, you input the token inline or configuration file. I recommend the 3rd way, which is AuthWeb ASP.NET Core Blazor WebApp. It provides a GUI for asking user to log in to generate token, and write to configuration file easily. This is based on the feature of NetCore 3.1.

token

 
 
 
 
 
 
 
 
 

Related Article