This repository has been deprecated and migrated to https://github.com/autodesk-platform-services/aps-revit.ifc.scheduler
This code sample demonstrates the usage of Model Derivative API, which allows you to convert a Revit .rvt
file stored in BIM 360 Docs to .ifc
format.
The IFC file format is a common transfer format used throughout the world, and consumed by a wide range of applications. You can use this tool to automate tasks to convert Revit Files hosted in BIM 360 Docs to IFC on a recurring basis.
Users choose either folders or specific files, then choose an IFC Settings Set name, and set a schedule on which the folders or files should be converted to IFC. At the scheduled time, the application creates model derivative jobs for each file, and uploads the IFC file into the same folder as the original Revit file. If the Revit file and IFC Settings Set name have not changed since the last conversion, no job will be created.
Note. Model Derivate API incurs cost. To view the current cost of the Model Derivative service, and to purchase Cloud Credits for file conversions, please view the Forge Pricing page.
- This application will only work on Revit files that are uploaded directly to BIM 360 Docs / Autodesk Docs, or published models from cloud worksharing.
- Visual Studio: Either Community 2019+ (Windows) or Code (Windows, MacOS).
- dotNET 5.0
- NodeJS (with NPM)
- SQL Server
- For installing SQL Server on
Windows
machines, please see Microsoft's SQL Server installation guide - For installing SQL Server on
Linux
machines, please see Microsoft's Installation Guidance for SQL Server - For
Cloud-hosted
SQL, options include:
- For installing SQL Server on
- Basic knowledge of C#
- Autodesk Forge App provisioned to your BIM 360 account
Clone this project or download it. 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/forge-revit.ifc.scheduler.git
-
Visual Studio (Windows):
Open the project RevitToIfcScheduler.csproj, find appsettings.template.json in the solution window, copy and rename it to
appsettings.Development.json
.
-
Visual Studio Code (Windows, MacOS):
Open the folder, at the bottom-right, select Yes and Restore. This restores the packages (e.g. Autodesk.Forge) and creates the launch.json file.
Afterward, find appsettings.template.json in the explore window, copy and rename it to
appsettings.Development.json
.
Edit the appsettings.Development.json
file, adding your Forge Client ID, Secret, emails for Application Admins, and your SQL Database connection string.
{
"ClientId": "your id here",
"ClientSecret": "your secret here",
"AdminEmails": "your admin user emails here",
"ConnectionStrings": {
"SqlDB": "your sql server connection string here: e.g. Server=localhost;Database=RevitIFCScheduler;User=sa;Password=...;"
}
}
Run the app. Open http://localhost:3000
in your browser to view the application.
Name | Description | Example Value |
---|---|---|
ForgeClientId | From the Forge App created during Setup | CL35ag54e6aghsaf4cacwe |
ForgeClientSecret | From the Forge App created during Setup | aa46asffaws |
AdminEmails | Semicolon-separated list of email addresses | admin@mycompany.com;bimmanager@mycompany.com |
ConnectionStrings.SqlDB | A SQL connection String | Server=MY-SERVER;Database=revit-to-ifc-scheduler;Trusted_Connection=True;ConnectRetryCount=0 |
Name | Description | Default Value |
---|---|---|
AppId | A name for the application, used when naming cookies and buckets | revit-to-ifc |
SendGridApiKey | If email notifications are desired, an API key from SendGrid should be provided | null |
FromEmail | The email address that SendGrid should attempt to put into the 'From' field | null |
ToEmail | The email address that SendGrid should attempt to put into the 'To' field | null |
LogPath | The specific path where log files should be stored | null |
IncludeShallowCopies | Copying a file in BIM 360 does not create a new file, only a reference to the original file, and cannot be passed to the model derivative service. Setting this to true will make a true copy of the file, and pass that to the model derivative service. | true |
TwoLegScope | The Forge scopes used by two legged tokens | data:read data:create account:read |
ThreeLegScope | The Forge scopes used by three legged tokens | user:read data:read |
ForgeBaseUrl | The root URL used to connect to the Forge platform | https://developer.api.autodesk.com |
Please see the Deployment Guide.
Please see the User Guide.pdf for additional details.
-
Navigate to the tool using your browser.
-
Log in using your BIM 360 account (your email address must be included in the AdminEmails Environment Setting)
-
Navigate to Settings by clicking
Settings
in the top right corner -
Toggle on the desired BIM 360 accounts.
-
Add an IFC Settings Set Name using the
Add IFC Settings Set Name
button.Note. Check out
What does an IFC Settings Set Contain?
in the Further Reading section, if you don't know what it is.
- Navigate to the tool using your browser.
- Log in using your BIM 360 account.
- Choose a project on the left-hand side.
- Navigate through the folder tree until you see the desired folders or files.
- Select the checkboxes next to the desired folders or files.
- Press
Convert Selected to IFC Now
in the upper right-hand corner. - Choose the desired IFC Settings Set Name, or type in a new name.
- The conversion will begin immediately, but may take several minutes to complete.
- To view the status of the conversion, press the
Conversion History
button to see all past conversions within this project.
- Navigate to the tool using your browser.
- Log in using your BIM 360 account.
- Choose a project on the left-hand side.
- Navigate through the folder tree until you see the desired folders or files.
- Select the checkboxes next to the desired folders or files.
- Press
Create Schedule Conversion
in the upper right-hand corner. - The application will automatically create a scheduled run on a daily schedule.
- You may change the following settings for the schedule:
- Schedule Name
- IFC Settings Set Name
- Frequency (Daily, Weekly, etc.)
- The days on which the schedule should repeat
- The time at which the schedule should repeat
- The time zone at which the schedule should repeat
- The conversion will begin at the next scheduled event.
- To view the status of the conversion, press the
Conversion History
button to see all past conversions within this project.
Name | Description |
---|---|
Created | The IFC conversion job is created and enqueued successfully. |
Processing | The Revit model has been sent to the Model Derivative service, and is being converted to IFC. |
Converted | The model has been converted to IFC, but has not yet been uploaded to BIM 360 Docs. |
Success | The status of the IFC conversion job is success and has been uploaded to the BIM360 Docs folder where the source Revit file is. |
Failed | The conversion or upload could not be completed. Please click the conversion record for more details. |
Unchanged | This model has previously been converted to IFC using the same IFC setting set. No additional conversion is required. |
ShallowCopy | The selected Revit file is a copy, rather than an uploaded file. To convert this file, set AllowShallowCopies to true in your App Settings Variables. |
TimeOut | The Forge Model Derivative service has returned a timeout error. |
Documentation:
Related knowledge:
- What is IFC?
- About Revit and IFC
- What does an IFC Settings Set Contain?
- The name list of Revit built-in IFC export settings (since Revit 2017) of Forge Model Derivative service:
- IFC2x3 Coordination View 2.0
- IFC2x3 Coordination View
- IFC2x3 GSA Concept Design BIM 2010
- IFC2x3 Basic FM Handover View
- IFC2x2 Coordination View
- IFC2x2 Singapore BCA e-Plan Check
- IFC2x3 Extended FM Handover View
- IFC4 Reference View
- IFC4 Design Transfer View
- The name list of Revit built-in IFC export settings (since Revit 2017) of Forge Model Derivative service:
This tool uses SendGrid to send a confirmation email on a successful conversion. This requires creating a free SendGrid account (for up to 25,000 emails/month), verifying a 'Single Sender' email address, and retrieving an API Key with 'Send' authorization. Three optional environment settings must be set: SendGridApiKey
, FromEmail
, and ToEmail
. If any one of these is left blank, no emails will be sent.
SendGrid can be setup by creating an account at www.sendgrid.com, or by creating a SendGrid Accounts
resource from the Azure Portal.
This application is capable of supporting multiple languages -- by default, English and Norwegian have been provided. To add additional languages, copy the folder located at BIM360 - Revit to IFC Converter/ClientApp/public/locales/en
, and rename it with the appropriate language code. Search for the file named i18next.ts
, and add the language code to the fallbackLng
array. Finally, edit the translation.json
and scheduler.json
files in the folder that you just copied, and set the values on the right hand side to the appropriate translation.
When this is done, an additional language code will be shown in the header bar of the application.
When a file is 'shallow copied', and BIM 360 makes a reference to a file that's already claimed by another BIM360 file, it can't be processed via the Model Derivative service. This happens within 'Shared' folders, and when a user makes use of the 'copy' function. The IncludeShallowCopies
optional environment setting allows us to get around this, by making a copy of the file on OSS, then translating that instead.
This tool uses Entity Framework Core in a code-first, migration based setup. Provide it with a connection string, and it will automatically create or update the database and tables as needed.
When the tables are modified in the Data project, you will need to create a new Migration. Do do this, navigate to the 'BIM360 - Revit to IFC Converter' project, and run the following command: dotnet ef migrations add NameOfYourMigrationHere
. The migration will be applied during the next application run.
-
Cannot see my BIM 360 projects:
- Make sure to provision the Forge App Client ID within the BIM 360 Account, learn more here. (This requires the Account Admin permission)
- Also, check section 2.1 Login and section 2.3.1 Enabling a BIM360 account of UserGuide.pdf for instructions.
-
Received Microsoft.Data.SqlClient.SqlException while starting this app: if it indicates that
there is already an object named 'XXXXX' in the database
, then this means the database you specified inappsetings.json
is not empty. You can fix it by doing either of the below ways:- Comment out the
dbContext.Database.Migrate();
in Startup.cs, then restart the app. - Backup your database, erase the database by executing
DROP DATABASE
command in the SQL Server Management Studio, and then restart the app.
- Comment out the
-
See 401 Unauthorized error after logging in:
- Check if the user level of the user account you logged in matches the listed roles of the section 2.1 Login of UserGuide.pdf.
- If the user level of your user account is
Application Admins
, ensure that your user email is specified in theAdminEmails
of the App Settings Variables.
This application is licensed under Apache 2.0. For details, please see LICENSE.md.
- Daniel Clayson, Global Consulting Delivery Team, Autodesk
- Reviewed and maintained by Eason Kang @yiskang, Forge Partner Development