Skip to content

autodesk-platform-services/aps-revit.ifc.scheduler

Repository files navigation

Revit to IFC Scheduler

Platforms .NET node.js License

OAuth2 Data-Management Model-Derivative ACC Account-Admin

Advanced

Contents

Description

This code sample demonstrates the usage of Model Derivative API, which allows you to convert a Revit .rvt file stored in ACC/BIM360 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 ACC/BIM360 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 APS Pricing page.

Thumbnail

Main Page

Limitations

  • This application will only work on Revit files that are uploaded directly to ACC/BIM360 Docs / Autodesk Docs, or published models from cloud worksharing.

Setup

Prerequisites

Running locally

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-platform-services/aps-revit.ifc.scheduler.git

Visual Studio

  • Visual Studio Code (Windows, MacOS):

    Open the folder, at the bottom-right, select Yes and Restore. This restores the packages (e.g. Autodesk.SdkManager, Autodesk.Authentication, Autodesk.DataManagement, Autodesk.ModelDerivative, Autodesk.Oss, etc.) and creates the launch.json file.

    Afterward, find appsettings.template.json in the explore window, copy and rename it to appsettings.Development.json.

Visual Studio Code

Edit the appsettings.Development.json file, adding your APS Client ID, Secret, emails for Application Admins, and your database connection string.

For SQL Server (default):

{
  "ClientId": "your id here",
  "ClientSecret": "your secret here",
  "AdminEmails": "your admin user emails here",
  "ConnectionStrings": {
    "SqlDB": "Server=localhost;Database=RevitIFCScheduler;User=sa;Password=...;TrustServerCertificate=True;"
  }
}

For PostgreSQL, set the DatabaseProviderConfiguration.ProviderType to PostgreSQL and supply a Npgsql-format connection string:

{
  "ClientId": "your id here",
  "ClientSecret": "your secret here",
  "AdminEmails": "your admin user emails here",
  "ConnectionStrings": {
    "SqlDB": "Host=localhost;Database=RevitIFCScheduler;Username=postgres;Password=..."
  },
  "DatabaseProviderConfiguration": {
    "ProviderType": "PostgreSQL"
  }
}

When the DatabaseProviderConfiguration section is omitted, the application defaults to SqlServer. Both Entity Framework Core (application schema) and Hangfire (job storage) honor the selected provider. On startup, the appropriate migration set is applied automatically — SQL Server migrations live in Migrations/ and PostgreSQL migrations in Migrations/PostgreSQL/.

Run the app. Open http://localhost:3000 in your browser to view the application.

App Settings Variables

Name Description Example Value
ClientId From the APS App created during Setup CL35ag54e6aghsaf4cacwe
ClientSecret From the APS App created during Setup aa46asffaws
AdminEmails Semicolon-separated list of email addresses admin@mycompany.com;bimmanager@mycompany.com
ConnectionStrings.SqlDB Database connection string. Format depends on DatabaseProviderConfiguration.ProviderType. SQL Server: Server=MY-SERVER;Database=revit-to-ifc-scheduler;Trusted_Connection=True;ConnectRetryCount=0 || PostgreSQL: Host=MY-SERVER;Database=revit-to-ifc-scheduler;Username=postgres;Password=...

Optional App Settings

Name Description Default Value
DatabaseProviderConfiguration.ProviderType Which database engine to use. Supported values: SqlServer, PostgreSQL. When the entire DatabaseProviderConfiguration section is omitted, SqlServer is used. SqlServer
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 ACC/BIM360 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 APS scopes used by two legged tokens data:read data:create account:read
ThreeLegScope The APS scopes used by three legged tokens user:read data:read

Deployment Steps

Please see the Deployment Guide.

Using the Application

Please see the User Guide.pdf for additional details.

Initial Setup

  1. Navigate to the tool using your browser.

  2. Log in using your ACC/BIM360 account (your email address must be included in the AdminEmails Environment Setting)

  3. Navigate to Settings by clicking Settings in the top right corner

  4. Toggle on the desired ACC/BIM360 accounts.

  5. 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.

Creating a one-off conversion to IFC

  1. Navigate to the tool using your browser.
  2. Log in using your ACC/BIM360 account.
  3. Choose a project on the left-hand side.
  4. Navigate through the folder tree until you see the desired folders or files.
  5. Select the checkboxes next to the desired folders or files.
  6. Press Convert Selected to IFC Now in the upper right-hand corner.
  7. Choose the desired IFC Settings Set Name, or type in a new name.
  8. The conversion will begin immediately, but may take several minutes to complete.
  9. To view the status of the conversion, press the Conversion History button to see all past conversions within this project.

Creating a scheduled conversion to IFC

  1. Navigate to the tool using your browser.
  2. Log in using your ACC/BIM360 account.
  3. Choose a project on the left-hand side.
  4. Navigate through the folder tree until you see the desired folders or files.
  5. Select the checkboxes next to the desired folders or files.
  6. Press Create Schedule Conversion in the upper right-hand corner.
  7. The application will automatically create a scheduled run on a daily schedule.
  8. You may change the following settings for the schedule:
    1. Schedule Name
    2. IFC Settings Set Name
    3. Frequency (Daily, Weekly, etc.)
    4. The days on which the schedule should repeat
    5. The time at which the schedule should repeat
    6. The time zone at which the schedule should repeat
  9. The conversion will begin at the next scheduled event.
  10. To view the status of the conversion, press the Conversion History button to see all past conversions within this project.

Conversion Statuses

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 ACC/BIM360 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 APS Model Derivative service has returned a timeout error.

Further Reading

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 APS 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

Tips and Tricks:

Overriding the Vite Dev Server URL

By default, the Vite development server runs on http://localhost:5173. If port 5173 is already in use, or you want to use a different port, you need to update two places:

  1. ClientApp/vite.config.js — change the server.port value:

    server: {
      port: 5174,   // ← your preferred port
    },
  2. Startup.cs — pass the matching URL to ViteServerMiddleware.EnsureStarted via the optional viteServerUrl parameter:

    viteUrl = Utilities.ViteServerMiddleware.EnsureStarted(
        env.ContentRootPath,
        lifetime.ApplicationStopping,
        viteServerUrl: "http://localhost:5174"   // ← must match vite.config.js
    );

EnsureStarted returns the URL it used, which is then passed directly to UseProxyToSpaDevelopmentServer, so only one string needs to change on the .NET side. If Vite is already listening on the specified URL when the .NET app starts (e.g. you ran npm start manually beforehand), startup detection is skipped and the existing server is used.

Sending Confirmation Emails

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.

Internationalization - Additional Language Support

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 aps-revit.ifc.scheduler/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.

Shallow Copies

When a file is 'shallow copied', and ACC/BIM360 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.

Modifying the Database

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.

When adding a migration, both the SQL Server and PostgreSQL migration sets must be regenerated so both providers stay in sync:

# SQL Server migration (default context, output to root Migrations/)
dotnet ef migrations add NameOfYourMigrationHere

# PostgreSQL migration (design-time-only context, output to Migrations/PostgreSQL/)
dotnet ef migrations add NameOfYourMigrationHere --context PostgreSQLRevitIfcContext --output-dir Migrations/PostgreSQL
Hangfire 1.8 upgrade

To enable the PostgreSQL storage provider, the Hangfire packages (Hangfire.Core, Hangfire.SqlServer, Hangfire.AspNetCore) were upgraded from 1.7.28 to 1.8.14. Microsoft.EntityFrameworkCore* was bumped from 8.0.4 to 8.0.11 to match the transitive minimum of Npgsql.EntityFrameworkCore.PostgreSQL 8.0.11.

Breaking Changes when upgrading from .NET 8 to .NET 10

If you are upgrading an existing deployment from .NET 8 to .NET 10, be aware of the following breaking changes and required migration steps:

  1. EF Core 9 — application fails to start after upgrade. EF Core 9+ throws PendingModelChangesException from Database.Migrate() if the compiled model differs from the snapshot. After upgrading, add a new empty migration for both database providers before first launch:

    # SQL Server
    dotnet ef migrations add PostNet10Upgrade --context RevitIfcContext
    
    # PostgreSQL
    dotnet ef migrations add PostNet10Upgrade --context PostgreSQLRevitIfcContext --output-dir Migrations/PostgreSQL

    This repo already ships with the PostNet10Upgrade migrations, so no action is required for a fresh clone — this note applies to forks or branches that upgraded independently.

  2. Flurl.Http 3.x → 4.x — breaking HTTP API change. The AllowHttpStatus(string) overload (e.g. AllowHttpStatus("4xx")) was removed in Flurl.Http 4.0. Utilities/APS.cs has been updated to use AllowAnyHttpStatus(). If you maintain a fork with additional Flurl HTTP call sites, review them for the same pattern.

  3. Serilog 2.x → 4.x — minor breaking changes. Serilog was bumped from 2.10.0 to 4.3.1. Review the Serilog changelog if you experience unexpected logging behavior after upgrading.

  4. .NET SDK 10 — NuGet transitive package audit enabled by default. dotnet restore now audits transitive dependencies for known CVEs and may surface NU1903/NU1904 warnings. Review any warnings that appear and address them, or explicitly acknowledge accepted risk in your build configuration.

Troubleshooting

  1. Cannot see my ACC/BIM360 projects:

    • Make sure to provision the APS App Client ID within the ACC/BIM360 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.
  2. 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:

    • 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.
  3. 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 the AdminEmails of the App Settings Variables.

License

This application is licensed under Apache 2.0. For details, please see LICENSE.md.

Written By

About

This code sample demonstrates the usage of Model Derivative API, which allows you to convert a Revit `.rvt` file stored in Autodesk Forma Data Management to `.ifc` format.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages