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.
Windows
machines, please see Microsoft's SQL Server installation guideLinux
machines, please see Microsoft's Installation Guidance for SQL ServerCloud-hosted
SQL, options include: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;TrustedConnection=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.
Settings
in the top right cornerAdd 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.
Convert Selected to IFC Now
in the upper right-hand corner.Conversion History
button to see all past conversions within this project.Create Schedule Conversion
in the upper right-hand corner.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:
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:
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 in appsetings.json
is not empty. You can fix it by doing either of the below ways:
dbContext.Database.Migrate();
in Startup.cs, then restart the app.DROP DATABASE
command in the SQL Server Management Studio, and then restart the app.See 401 Unauthorized error after logging in:
Application Admins
, ensure that your user email is specified in the AdminEmails
of the App Settings Variables.This application is licensed under Apache 2.0. For details, please see LICENSE.md.