Setting up a project with the VS code extension
While the Reference App has a one-click project setup for convenience, you can also experiment with setting up a project with the VS code extension, which requires you to manually run each script and select any required config files.
Note: For more information on the automated project setup initiated from the user interface, see User interface project setup.
Pre-requisite: Install and setup the VS code extension, then sign in. For more information, see Visual Studio Code Extension.
Extension logs#
You can view status updates and script error feedback in the log view. To toggle the log view, from the extension menu, click Toggle Log View.
Creating a new project#
To create a new project, do the following:
- In VS Code, click the Explorer icon, then expand the extension.
- Right-click Reference App, then click New Project.
- Enter a name for your project in the Project Name dialog, then press the Enter key.
- Enter a description for your project in the Project Description dialog, then press the Enter key.
- Enter a short name for your project in the Project Short Name dialog, then press the Enter key.
Result: The extension reloads and your project appears nested under the Reference App drop-down. If it does not automatically reload, click the menu at the top of the extension tree, then click Refresh Tree.
Uploading the setup script#
To upload the setup script, do the following:
Expand your new project in the tree to view the Scripts, User Configs, API Configs folders.
Right-click the Scripts folder, then click Create New Script.
In the Script Name dialog, enter a name for your script, such as
Project Setup, then press the Enter key.In the Script Description dialog, enter a description for your script, such as
Project XYZ setup scriptthen press the Enter key.In the Script Description dialog, enter a description for your script, such as
Project XYZ setup scriptthen press the Enter key.In the Script Short Name dialog, enter a short name for your script, such as
Proj setupthen press the Enter key.In the Script User Type dialog, enter a custom identifying underscore-separated string for your script, such as
iaf_ext_proj_setupthen press the Enter key.Expand the Scripts folder to confirm your script now appears in the folder.
Right-click the script, then click Open. The script contains the following boilerplate script content:
let scriptModule = { async sampleScript(input, libraries, ctx, callback){ }} export default scriptModuleCopy the script content in
vscode-setup.mjsfrom the project root folder and paste it into your new script, overwriting the boilerplate content.Save the file locally and confirm that the script in the extension tree has a warning icon. This means there are local changes that haven't been committed.
To commit your script changes, in the tree, right-click the script, then click Commit to Current Version.
Note: Additional dialogs may appear to warn you about incorrect script syntax. It is advised to fix your script based on feedback in the extension logs but you can override this by clicking Commit Anyways.
Result: In the tree, the warning icon beside your script changes to a cloud icon, signifying the script is committed to the Item Service.
Uploading the project's scripts#
To upload the project's scripts, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select uploadScripts.
- When prompted, your local system's file browser appears. Select all the scripts in
scripts/NextScriptEngine/scripts/js.
Result: Upon refresh, the scripts are now in the Scripts folder and stored in the Item Service as Script items for your project.
For more information on the uploadScripts script, see uploadScripts.
Uploading UserConfigs and UserGroups for a project#
To upload UserConfigs and UserGroups, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select userConfigImports.
- When prompted, your local system's file browser appears. Select all the user configs in
scripts/NextScriptEngine/userconfigs.
Result: The defined UserConfigs are uploaded to the Item Service for your project and linked to the created UserGroups.
For more information on the userConfigImports script, see userConfigImports.
Uploading the project's Bimpk file#
To upload the project's Bimpk file, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select bimpkOperations.
- When prompted, your local system's file browser appears. Either select the Bimpk file named
1801KS-INV-01-ZZ-M3-Z-0001_Federated.bimpkin thescriptsfolder or select your own.bimpkfile. To upload multiple models, select up to five bimpk files. For more information on multiple models, see Multi-model support.
Result: Upon refresh, the Bimpk file is uploaded to the File Service as a File type for your project.
For more information on the bimpkOperations script, see bimpkOperations.
Importing the model#
To import the model, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select importModel.
Result: An orchestrator is created and run to import the model from the Bimpk file. You can view the status updates in the extension logs
For more information on the importModel script, see importModel.
Creating collection search indexes and uploading the Revit type map#
Do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select createCollections.
- When prompted, your local system's file browser appears. Select the type map file named
TypeMap.xlsxinscripts/xlsx.
Result: The collections have now been indexed and the Revit types collection and related data object uploaded to the platform.
For more information on the createCollections script, see createCollections.
Uploading a file attribution set#
These are attributions can be added to a file upload, such as the information about individuals or companies that contribute to design or engineering documents.
To upload a file attribution set, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select fileAttributesImport.
- When prompted, your local system's file browser appears. Select the type map file named
Kingspan_FileAttributes.xlsxinscripts/xlsx.
For more information on the fileAttributesImport script, see fileAttributesImport.
Mapping the Revit types to model elements#
To map the Revit type to model elements, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select mapRevitTypeCollection.
Result: An orchestrator is created and run to map the type elements to the model elements. You can view the status updates in the extension logs.
For more information on the mapRevitTypeCollection script, see mapRevitTypeCollection.
Creating other collections#
This process creates telemetry, IoT, warranty, and file collections as well as a permission profile.
To create other collections, do the following:
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select createOtherCollections.
Result: The collections have now been created in the Item Service and the permission profile in the Passport Service.
For more information on the createOtherCollections script, see createOtherCollections.
Uploading an ApiConfig file#
To upload an ApiConfig file, do the following
- In the extension tree, right-click your project setup script, then click Run Script.
- In the Select a Script to Run dialog, type or select apiConfigImport.
- When prompted, your local system's file browser appears. Select
apiconfig.jsoninapps/scripts/NextScriptEngine/userconfigs.
Result: The ApiConfig is created in the ObjectModelAPI Service.
For more information on the apiConfigImport script, see apiConfigImport.