Giter VIP home page Giter VIP logo

forge-revit-ifc-exporter-appbundle's Introduction

Revit IFC Exporter App bundle for Autodesk APS Design Automation

Design Automation

Revit .NET Revit

Advanced MIT

Description

This sample demonstrates how to implement Revit exporter that supports IFC export options of Autodesk Revit IFC

Development Setup

Prerequisites

  1. APS Account: Learn how to create a APS Account, activate subscription and create an app at this tutorial.
  2. Visual Studio 2019 and later (Windows).
  3. Revit 2021 and later: required to compile changes into the plugin

Design Automation Setup

Activity example

{
    "id": "RevitIfcExportorActivity",
    "commandLine": [
        "$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[RevitIfcExportor].path)\""
    ],
    "parameters": {
        "inputFile": {
            "verb": "get",
            "description": "Input Revit File",
            "required": true,
            "localName": "$(inputFile)"
        },
        "userPropertySetsFile": {
            "verb": "get",
            "description": "IFC user defined property set definition file",
            "localName": "userDefinedParameterSets.txt"
        },
        "userParameterMappingFile": {
            "verb": "get",
            "description": "IFC user defined parameter mapping file",
            "localName": "userDefinedParameterMapping.txt"
        },
        "inputJson": {
            "verb": "get",
            "description": "input Json parameters",
            "localName": "params.json"
        },
        "outputIFC": {
            "zip": true,
            "verb": "put",
            "description": "Exported IFC files",
            "localName": "ifc"
        }
    },
    "engine": "Autodesk.Revit+2022",
    "appbundles": [
        "Autodesk.RevitIfcExportor+dev"
    ],
    "description": "Activity of Revit IFC Exporter with Autodesk IFC export options support"
}

Workitem example

Use userPropertySets filename defined in the IFC export configuration sets and specify addin settings via inline json

{
    "activityId": "Autodesk.RevitIfcExportorActivity+dev",
    "arguments": {
        "inputFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US"
        },
        "userPropertySetsFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/97095bbc-1ce3-469f-99ba-0157bbcab73b?region=US"
        },
        "inputJson": {
            "url": "data:application/json,{\"exportSettingName\":\"IFC2x3 Coordination View 2.0\"}"
        },
        "outputIFC": {
            "verb": "put",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US",
            "headers": {
                "Content-Type": "application/octet-stream"
            }
        }
    }
}

Note. While providing inuptJSON by inline format, DA will save it as param.json after DA starts processing the workitem.

Use userPropertySets and userDefinedParameterMapping filename defined in the IFC export configuration sets, and specify addin settings via concrete JSON file

{
    "activityId": "Autodesk.RevitIfcExportorActivity+dev",
    "arguments": {
        "inputFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US"
        },
        "userPropertySetsFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/97095bbc-1ce3-469f-99ba-0157bbcab73b?region=US"
        },
        "userParameterMappingFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/f0ff99e0-75dc-4aa1-acd4-3933657013d6?region=US"
        },
        "inputJson": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/ab593357-6c6e-44dc-8308-8a7c92b25494?region=US"
        },
        "outputIFC": {
            "verb": "put",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US",
            "headers": {
                "Content-Type": "application/octet-stream"
            }
        }
    }
}

Use userPropertySets filename override and specify addin settings via inline json

{
    "activityId": "Autodesk.RevitIfcExportorActivity+dev",
    "arguments": {
        "inputFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US"
        },
        "userPropertySetsFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/97095bbc-1ce3-469f-99ba-0157bbcab73b?region=US",
            "localName": "FmUserDefinedPropSets.txt"
        },
        "inputJson": {
            "url": "data:application/json,{\"exportSettingName\":\"My IFC Export Setup\", \"userDefinedPropertySetsFilenameOverride\": \"FmUserDefinedPropSets.txt\"}"
        },
        "outputIFC": {
            "verb": "put",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US",
            "headers": {
                "Content-Type": "application/octet-stream"
            }
        }
    }
}

Export only elements visible in the given view unique id via inline JSON

{
    "activityId": "Autodesk.RevitIfcExportorActivity+dev",
    "arguments": {
        "inputFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US"
        },
        "inputJson": {
            "url": "data:application/json,{\"exportSettingName\":\"My IFC Export Setup\", \"viewId\": \"44745acb-ebea-4fb9-a091-88d28bd746c7-000ea86d\"}"
        },
        "outputIFC": {
            "verb": "put",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US",
            "headers": {
                "Content-Type": "application/octet-stream"
            }
        }
    }
}

What if the IFC expected setup hasn't checked the "Export only elements visible in view" option? No worry, we just need to specify "onlyExportVisibleElementsInView": true in the inputJson like below to turn it on on the fly.

{
    "activityId": "Autodesk.RevitIfcExportorActivity+dev",
    "arguments": {
        "inputFile": {
            "verb": "get",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US"
        },
        "inputJson": {
            "url": "data:application/json,{\"exportSettingName\":\"My IFC Export Setup\", \"viewId\": \"44745acb-ebea-4fb9-a091-88d28bd746c7-000ea86d\", \"onlyExportVisibleElementsInView\": \"true\"}"
        },
        "outputIFC": {
            "verb": "put",
            "url": "https://developer.api.autodesk.com/oss/v2/apptestbucket/9d3be632-a4fc-457d-bc5d-9e75cefc54b7?region=US",
            "headers": {
                "Content-Type": "application/octet-stream"
            }
        }
    }
}

Example of params.json

Here is an example of the available options in the params.json. Only exportSettingName is required.

{
    "exportSettingName": "My IFC Export Setup",
    "userDefinedPropertySetsFilenameOverride": "DasUserDefinedPropSets.txt",
    "userDefinedParameterMappingFilenameOverride": "DasUserDefinedParameterMapping.txt",
    "onlyExportVisibleElementsInView": true,
    "viewId": "44745acb-ebea-4fb9-a091-88d28bd746c7-000ea86d"
}

Example of userPropertySetsFile for IFC

#
# User Defined PropertySet Definition File
#
# Format:
#    PropertySet:	<Pset Name>	I[nstance]/T[ype]	<element list separated by ','>
#	<Property Name 1>	<Data type>	<[opt] Revit parameter name, if different from IFC>
#	<Property Name 2>	<Data type>	<[opt] Revit parameter name, if different from IFC>
#	...
#
# Data types supported: Area, Boolean, ClassificationReference, ColorTemperature, Count, Currency, 
#	ElectricalCurrent, ElectricalEfficacy, ElectricalVoltage, Force, Frequency, Identifier, 
#	Illuminance, Integer, Label, Length, Logical, LuminousFlux, LuminousIntensity, 
#	NormalisedRatio, PlaneAngle, PositiveLength, PositivePlaneAngle, PositiveRatio, Power, 
#	Pressure, Ratio, Real, Text, ThermalTransmittance, ThermodynamicTemperature, Volume, 
#	VolumetricFlowRate
# 
# Example property set definition for COBie:
#
#PropertySet:	COBie_Specification	T	IfcElementType
#	NominalLength	Real	COBie.Type.NominalLength
#	NominalWidth	Real	COBie.Type.NominalWidth
#	NominalHeight	Real	COBie.Type.NominalHeight
#	Shape		Text	COBie.Type.Shape
#	Size		Text	COBie.Type.Size
#	Color		Text	COBie.Type.Color
#	Finish		Text	COBie.Type.Finish
#	Grade		Text	COBie.Type.Grade
#	Material	Text	COBie.Type.Material
#	Constituents	Text	COBie.Type.Constituents
#	Features	Text	Cobie.Type.Features
#	AccessibilityPerformance	Text	COBie.Type.AccessibilityPerformance
#	CodePerformance	Text	COBie.Type.CodePerformance
#	SustainabilityPerformance	Text	COBie.Type.SustainabilityPerformance
# 

PropertySet:	DAS Parameters	I	IfcRoof
	FM ID	Text

Todo

  • Add compile options for multiple Revit versions (e.g. From Revit 2021 to Revit 2023)
  • Add pre-complied DLLs to repository releases.
  • Support specifying IFC export settings on the fly without pre-saved ones in RVT file.
  • Support exporting IFC from Revit links
  • Support site placement related options
  • Support IFCExchangeRequirements
  • Support exporting only elements visible in specified view

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Eason Kang @yiskang, Autodesk Developer Advocacy and Support

forge-revit-ifc-exporter-appbundle's People

Contributors

yiskang avatar jeremytammik avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.