Autodesk AEC Dev Camp 2012 Autodesk Revit IFC

  • Slides: 36
Download presentation
Autodesk AEC Dev. Camp 2012 Autodesk Revit IFC Export Open Source Customization Angel Velez

Autodesk AEC Dev. Camp 2012 Autodesk Revit IFC Export Open Source Customization Angel Velez Sr. Principal Engineer © 2012 Autodesk

Outline § Introduction (10 minutes) History of IFC in Revit § Why Open Source?

Outline § Introduction (10 minutes) History of IFC in Revit § Why Open Source? § § How the Code Works (45 minutes) Overall Structure of Code § Key points of interest (e. g. Element traversal, Property Sets) § Look at alternate UI § § Conclusion (5 minutes) § Questions (30 minutes): ask at any time! © 2012 Autodesk

Introduction © 2012 Autodesk

Introduction © 2012 Autodesk

What is IFC? § § § IFC = Industry Foundation Classes Maintained by building.

What is IFC? § § § IFC = Industry Foundation Classes Maintained by building. SMART (http: //www. buildingsmart. org) Primary file format based on STEP; XML and ZIP output versions also available. Current Version: IFC 2 x 3; IFC 2 x 2 files still around Next Version: IFC 4, still not finalized. © 2012 Autodesk

History of IFC in Revit § Revit Architecture has been fully certified since 2007:

History of IFC in Revit § Revit Architecture has been fully certified since 2007: Revit Building 9: Full Code Checking View § RAC 2008: Full Extended Coordination View (in June Web Update) § § Revit Structure and Revit MEP don’t have separate certification § Use same code as Revit Architecture § Currently working on Coordination View 2. 0 certification for RAC, RME and RST. § Committed to IFC 4 when it is ready. © 2012 Autodesk

History of IFC Open Source in Revit § First released on September 13, 2011,

History of IFC Open Source in Revit § First released on September 13, 2011, with R 2012 UR 2 § § § ~335 KB of. NET code Limited IFC entity creation functionality Much of the code still handled natively Can be entirely replaced by custom exporter Latest version: 1. 0. 4 R 2013 version released on March 28, 2012, with R 2013 RTM § § § ~1. 9 MB of. NET code Ability to create any IFC entity defined in an EXPRESS file schema Some code still handled natively, primarily legacy support Alternate UI available (also released March 28) Can be entirely replaced by custom exporter Latest version: 2. 1 © 2012 Autodesk

Why Open source? § Customer flexibility Add new properties, property sets and data §

Why Open source? § Customer flexibility Add new properties, property sets and data § Tweak output for improved interoperability with other systems § § Countrification GSA § Korean requirements § Other developing requirements § § Updates are decoupled from Revit’s release cycle IFC 4 (when finalized) § Other IFC standards extensions as they are introduced § © 2012 Autodesk

Open Source Updates, R 2012 changes § R 2012 changes: Support for exporting rooms

Open Source Updates, R 2012 changes § R 2012 changes: Support for exporting rooms (spaces) in IFC 2 x 3 in the same manner as IFC 2 x 2 to comply with some South Korean governmental requirements. § Fix for some objects not exporting in IFC 2 x 3 mode but succeeding in IFC 2 x 2 export. § Current View only export now correctly ignores filtered elements, and elements outside of scope boxes. § All changes occurred after Update Release 2 § Changes relatively minor but greatly helped some customers. § © 2012 Autodesk

Open Source Updates, R 2013 changes Exporter v 2. 0. 1 released with Revit

Open Source Updates, R 2013 changes Exporter v 2. 0. 1 released with Revit 2013, contained minor changes from shipped version. § Exporter v 2. 1/UI v 1. 1 released end of May: § § § § § Add Pset_Manufacturer. Type. Information for all Ifc. Elements Allow parts to be exported as separate entities, rather than as Building. Elementparts (requires Alternate UI v 1. 1 to set this option) Change the Detail Level of a view to be the level used in Current View Only, still be Fine if no current view. Merge all triangles of planar faces on export of faceted solids. Use Extrusion. Analyzer for some simple beams and floor slabs. (GSA) Allow e. Pset_Photovoltaic. Array for walls as well as roofs. (GSA) Exporting Classification for general elements. Intend to have monthly updates, more frequent updates for major milestones if necessary (such as Update Releases. ) © 2012 Autodesk

Autodesk commitment to IFC Revit ships with high-quality IFC implementation § Autodesk supports IFC

Autodesk commitment to IFC Revit ships with high-quality IFC implementation § Autodesk supports IFC interoperability § Full time team assigned to improvements and bug fixes § Support for new elements § Support for new workflows § © 2012 Autodesk

IFC Open Source Exporter: Where to get it § Source. Forge (http: //sourceforge. net/projects/ifcexporter)

IFC Open Source Exporter: Where to get it § Source. Forge (http: //sourceforge. net/projects/ifcexporter) Only public location containing source code § Contains R 2012, R 2013, and R 2013 UI installs § DLL Download statistics as of 30 May 2012: § c. 3175 downloads from 73 countries § Top 5 countries: Netherlands, US, Norway, Korea, China (~50% of total) § § Revit App Store (http: //apps. exchange. autodesk. com/RVT/Home/Index) § Contains R 2013 and R 2013 UI only § © 2012 Autodesk c. 150 downloads as of 30 May 2012

IFC Open Source Exporter: How to modify § Need SVN to download source code

IFC Open Source Exporter: How to modify § Need SVN to download source code Tortoise. SVN at http: //sourceforge. net/projects/tortoisesvn/files/ § All local modifications allowed, uploading is restricted § Contributions controlled by BIM Open Source Steering committee § Contributors can be “promoted” from Users to Developers to Committers, who have direct write access to the code. § All contributions are welcome! § § As of version 2. 1: ZIP file included for those without SVN © 2012 Autodesk

How it works © 2012 Autodesk

How it works © 2012 Autodesk

Exporter Setup § Exporter uses standard add-in code (from BIM. IFC. addin): <? xml

Exporter Setup § Exporter uses standard add-in code (from BIM. IFC. addin): <? xml version="1. 0" encoding="utf-8"? > <Revit. Add. Ins> <Add. In Type="DBApplication"> <Name>BIM IFC</Name> <Assembly>[TARGETDIR]BIM. IFC. dll</Assembly> <Client. Id>D 2 FE 9530 -A 191 -4 F 58 -B 3 C 4 -1653384 A 6286</Client. Id> <Full. Class. Name>BIM. IFC. Exporter</Full. Class. Name> <Vendor. Id>IFCX</Vendor. Id> <Vendor. Description>IFC Exporter for Revit, http: //sourceforge. net/projects/ifcexporter/</Vendor. Description> </Add. In> </Revit. Add. Ins> Exporter. UI uses same setup. § Can always revert by deleting/renaming addin file. § © 2012 Autodesk

Exporter Setup § Open Source exporter uses same UI by default as default Exporter.

Exporter Setup § Open Source exporter uses same UI by default as default Exporter. § Only changes are in the IFC file created, not in Revit UI. Default export UI can be modified by Alternate UI add-in. § Exporter and Exporter UI are independent. § © 2012 Autodesk

How it works: Top Level code resides entirely in Exporter. cs § Registers as

How it works: Top Level code resides entirely in Exporter. cs § Registers as an external application via IExternal. DBApplication § public External. DBApplication. Result On. Startup(Autodesk. Revit. Application. Services. Controlled. Application application) { Exporter. IFCRegistry. Register. IFCExporter(this); return External. DBApplication. Result. Succeeded; } § Only one exporter can be registered per Revit session. Exporter. IFCRegistry expects object of type IExporter. IFC § Entry point for export: § public void Export. IFC(Autodesk. Revit. DB. Document, Exporter. IFC, Autodesk. Revit. DB. View filter. View) § Filter. View argument is optional, and is used for “Current View Only” export. © 2012 Autodesk

How it works: Top Level § Exporter. IFC class No relation to IExporter. IFC

How it works: Top Level § Exporter. IFC class No relation to IExporter. IFC § Initialized in native code § Allows interaction between native code and. NET code § § Including access to EDM toolkit that reads and writes IFC files Needed for most Exporter. IFCUtils IFC-specific API functions Exporter. IFCUtils class § Allows access to utility functions in native code: Legacy element export § Element access functions needed for export not in standard API § § § Routines not yet converted to. NET (e. g. , some common property sets) § © 2012 Autodesk May be deprecated in future as some are moved to general Revit API May be deprecated in future as some are replaced with. NET code

How it works: Top Level § Begin. Export routine initializes export § Initializes IFCFile

How it works: Top Level § Begin. Export routine initializes export § Initializes IFCFile based on schema. § IFC 4 support would require adding option here. Initializes property sets and quantities to use. § Creates unique and top-level IFC entities § Project § Building Storeys § § § © 2012 Autodesk Building Storeys are a subset of Revit Levels, based on “Building Storey” parameter. Commonly used directions and Cartesian points

How it works: Element Traversal § List of potential elements comes from: Document (default)

How it works: Element Traversal § List of potential elements comes from: Document (default) § Current view, if a Filter. View is provided § A list of elements, if the option “Single. Element” or “Elements. For. Export” is used. § § Elements are filtered and exported in groups: § Spaces (Revit Rooms/MEP Spaces) § § Will export 1 st level, 2 nd level, or no space boundaries based on options All other elements All supported 3 D elements § Some 2 D elements in plan view, as supported by IFC 2 x 3, based on options § § Post-processing happens afterwards. § Relations, connections, containment © 2012 Autodesk

How it works: Element Processing Each element is handled as generically as possible. §

How it works: Element Processing Each element is handled as generically as possible. § An element may correspond to one or more Ifc. Building. Elements, and many entities. § In the cases where there is a 1 -to-1 correspondence, we can generate a consistent GUID. § In cases where there is a 1 -to-many correspondence, we may need to generate some random GUIDs for each export. § § Some information may be cached for later processing. © 2012 Autodesk

Element Processing, Simple example: exporting a Ceiling § Ceiling. Exporter contains two public export

Element Processing, Simple example: exporting a Ceiling § Ceiling. Exporter contains two public export methods: public static void Export. Ceiling. Element(Exporter. IFC, Ceiling, Geometry. Element, IFCProduct. Wrapper) public static void Export. Covering(Exporter. IFC, Element, Geometry. Element, string ifc. Enum. Type, IFCProduct. Wrapper) § First function is for real Revit ceilings Element and Geometry. Element are the element and its geometry. § The type of Ifc. Covering is determined by Category. Util. Get. IFCEnum. Type. Name § § § The IFCProduct. Wrapper class collects all of the Ifc. Products created § § § Uses IFC Export Layer Table and “Export. Type” shared parameter Allows us to set property sets for multiple IFC entities based on the element. Calls the second function with the appropriate type. Second function is for other elements with the Ceiling category Does the actual export work. § 28 lines of code (not including brackets and empty lines) § © 2012 Autodesk

Element Processing, Simple example: exporting a Ceiling § Export. Covering function does the actual

Element Processing, Simple example: exporting a Ceiling § Export. Covering function does the actual export. Key points: § Checks if element is being exported as a whole or as parts bool export. Parts = Part. Exporter. Can. Export. Parts(element); if (export. Parts && !Part. Exporter. Can. Export. Element. In. Part. Export(element, element. Level. Id, false)) return; § Starts an IFCTransaction block using (IFCTransaction transaction = new IFCTransaction(file)) Not a Revit transaction § Allows automatic deleting IFC entities from partially exported elements § § Starts an IFCPlacement. Setter block using (IFCPlacement. Setter setter = IFCPlacement. Setter. Create(exporter. IFC, element)) Creates the Ifc. Local. Placement for the element § Sets the transforms for the geometry to be in the correct coordinate system § © 2012 Autodesk

Element Processing, Simple example: exporting a Ceiling § Key points continued: § Exports geometry

Element Processing, Simple example: exporting a Ceiling § Key points continued: § Exports geometry as a surface model IFCAny. Handle prod. Rep = export. Parts ? null : Representation. Util. Create. Surface. Product. Definition. Shape(exporter. IFC, element, geom. Elem, false); § § Generic routine that works for any element exported as a surface model Gather generic Ifc. Object information string instance. GUID = Exporter. IFCUtils. Create. GUID(element); string orig. Instance. Name = exporter. IFC. Get. Name(); string instance. Name = Naming. Util. Get. Name. Override(element, orig. Instance. Name); string instance. Description = Naming. Util. Get. Description. Override(element, null); string instance. Object. Type = Naming. Util. Get. Object. Type. Override(element, exporter. IFC. Get. Family. Name()); string instance. Elem. Id = Naming. Util. Create. IFCElement. Id(element); Toolkit. IFCCovering. Type covering. Type = Get. IFCCovering. Type(element, ifc. Enum. Type); © 2012 Autodesk

Element Processing, Simple example: exporting a Ceiling § Key points continued: § Create Ifc.

Element Processing, Simple example: exporting a Ceiling § Key points continued: § Create Ifc. Covering and add to IFCProduct. Wrapper IFCAny. Handle covering = IFCInstance. Exporter. Create. Covering(file, instance. GUID, exporter. IFC. Get. Owner. History. Handle(), instance. Name, instance. Description, instance. Object. Type, setter. Get. Placement(), prod. Rep, instance. Elem. Id, covering. Type); product. Wrapper. Add. Element(covering, setter, null, Level. Util. Associate. Element. To. Level(element)); § Create parts if appropriate Part. Exporter. Export. Host. Part(exporter. IFC, element, covering, product. Wrapper, setter. Get. Placement(), null); § Determine materials for ceiling (if Ceiling and not exporting parts) Host. Object. Exporter. Export. Host. Object. Materials(exporter. IFC, ceiling, covering, geom. Elem, product. Wrapper, Element. Id. Invalid. Element. Id, Toolkit. IFCLayer. Set. Direction. Axis 3); § Export Revit property sets Property. Util. Create. Internal. Revit. Property. Sets(exporter. IFC, element, product. Wrapper); © 2012 Autodesk

Element Processing, More complicated examples § Some elements have multiple representations 2 D axis,

Element Processing, More complicated examples § Some elements have multiple representations 2 D axis, 3 D body, potentially 3 D bounding box § Examples: Wall, Beam, Many families § § Some elements have Type and Instance geometry Type contains mapped geometry § Instance contains local transform, potentially openings § § Most elements export Extrusion or Brep geometry § Need to convert Revit Brep geometry into extrusions May need to split geometry into separate solids § May need to identify openings and clippings § § Use Extrusion. Analyzer as “first pass” attempt to create extrusion § § Only used for some Beams and Slabs (so far) Use Export. Body (in Body. Exporter. cs) for other cases © 2012 Autodesk

How it works: Adding Property Sets § Parameter set definitions created at start of

How it works: Adding Property Sets § Parameter set definitions created at start of export public static void Init. Property. Sets(IFCVersion file. Version) § Exception #1: some common property sets not yet converted, go through API to native code § Exception #2: Revit internal parameter groups (Property. Util. Create. Internal. Revit. Property. Sets) § Creation can be conditional on export parameters § Quantities have a parallel construct § § All future mention of “properties” applies to quantities as well. © 2012 Autodesk

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Simple example: Pset_Manufacturer. Type. Information

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Simple example: Pset_Manufacturer. Type. Information § From http: //www. buildingsmart-tech. org/ifc/IFC 2 x 3/TC 1/html/index. htm Property Set Name Applicable Entities Pset_Manufacturer. Type. Information Ifc. Element Applicable Type Value Definition from IAI: Defines characteristics of manufactured products that may be given by the manufacturer. Note that the term 'manufactured' may also be used to refer to products that are supplied and identified by the supplier or that are assembled off site by a third party provider. This property set replaces the entity Ifc. Manufacturer. Information from previous IFC releases. Name Property Type Data Type Definition Article. Number Ifc. Property. Single. Value Ifc. Identifier Model. Reference Ifc. Property. Single. Value Ifc. Label Article number or reference that may be applied to a product according to a standard scheme for article number definition (e. g. UN, EAN) The name of the manufactured item as used by the manufacturer. Model. Label Ifc. Property. Single. Value Ifc. Label Manufacturer Ifc. Property. Single. Value Ifc. Label Production. Year Ifc. Property. Single. Value Ifc. Label Copyright (c) 2000 - 2007 International Alliance for Interoperability © 2012 Autodesk The model number and/or unit designator assigned by the manufacturer of the manufactured item. The organization that manufactured and/or assembled the item. The year of production of the manufactured item.

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Simple example: Pset_Manufacturer. Type. Information

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Simple example: Pset_Manufacturer. Type. Information private static void Init. Property. Set. Manufacturer. Type. Information(IList<Property. Set. Description> common. Property. Sets) { Property. Set. Description property. Set. Manufacturer = new Property. Set. Description(); property. Set. Manufacturer. Name = "Pset_Manufacturer. Type. Information"; property. Set. Manufacturer. Entity. Types. Add(IFCEntity. Type. Ifc. Element); Property. Set. Entry ifc. PSE = Property. Set. Entry. Create. Identifier("Article. Number"); property. Set. Manufacturer. Entries. Add(ifc. PSE); ifc. PSE = Property. Set. Entry. Create. Label("Model. Reference"); property. Set. Manufacturer. Entries. Add(ifc. PSE); ifc. PSE = Property. Set. Entry. Create. Label("Model. Label"); property. Set. Manufacturer. Entries. Add(ifc. PSE); ifc. PSE = Property. Set. Entry. Create. Label("Manufacturer"); ifc. PSE. Revit. Built. In. Parameter = Built. In. Parameter. ALL_MODEL_MANUFACTURER; property. Set. Manufacturer. Entries. Add(ifc. PSE); ifc. PSE = Property. Set. Entry. Create. Label("Production. Year"); property. Set. Manufacturer. Entries. Add(ifc. PSE); common. Property. Sets. Add(property. Set. Manufacturer); } © 2012 Autodesk

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Property. Set. Description contains the

Adding Property Sets, Simple Example: Pset_Manufacturer. Type. Information § Property. Set. Description contains the properties. § § Property sets are associated with one or more IFC entity types and their sub-types. § § Property. Set. Description property. Set. Manufacturer = new Property. Set. Description(); property. Set. Manufacturer. Entity. Types. Add(IFCEntity. Type. Ifc. Element); If the property is a shared parameter, add in one step. ifc. PSE = Property. Set. Entry. Create. Label("Model. Reference"); § ifc. PSE = Property. Set. Entry. Create. Label("Model. Label"); § ifc. PSE = Property. Set. Entry. Create. Label("Production. Year"); § Names are case and whitespace insensitive, also ignore underscores. § § Can also map built-in parameter to IFC property. ifc. PSE = Property. Set. Entry. Create. Label("Manufacturer"); § ifc. PSE. Revit. Built. In. Parameter = Built. In. Parameter. ALL_MODEL_MANUFACTURER; § © 2012 Autodesk

Adding Property Sets, Advanced § By default, Revit does not create consistent GUIDs for

Adding Property Sets, Advanced § By default, Revit does not create consistent GUIDs for Ifc. Property. Set. § Setting Property. Set. Description. Sub. Element. Index creates a consistent GUID. § § Example: property. Set. Wall. Common. Sub. Element. Index = (int)IFCWall. Sub. Elements. PSet. Wall. Common; Requirement: Sub. Element. Index must be a unique integer from 1 to 65535 for any IFC entity type that uses that property set. © 2012 Autodesk

Adding Property Sets, Advanced § Not all IFC Properties relate directly to Revit parameters.

Adding Property Sets, Advanced § Not all IFC Properties relate directly to Revit parameters. Property. Set. Entry. Property. Calculator allows a custom function to calculate value. § Example: § Property. Set. Entry ifc. PSE = Property. Set. Entry. Create. Identifier("Reference"); ifc. PSE. Property. Calculator = Reference. Calculator. Instance; § User can override calculator by providing a parameter of the correct name. © 2012 Autodesk

IFC Exporter Alternate UI Allows for addition of UI parameters used in export code

IFC Exporter Alternate UI Allows for addition of UI parameters used in export code § Not required to export but does contain extra functionality § UI to Export to XML, ifc. ZIP formats § UI to Export parts as building elements instead of Ifc. Building. Part § Toggle export of Revit internal parameter sets § New combinations of options can be saved as named configurations § § Uses XAML for UI setup Easily modifiable § Not localized § § Export options get passed to exporter via: bool result = doc. Export(path, file. Name, export. Options); © 2012 Autodesk

Conclusion © 2012 Autodesk

Conclusion © 2012 Autodesk

Goals achieved Ability to have rapid response to customer issues. § Allow users to

Goals achieved Ability to have rapid response to customer issues. § Allow users to customize IFC for their own needs. § Work towards requirements asynchronous to Revit’s release schedule § IFC 2 x 3 re-certification § GSA certification § © 2012 Autodesk

Future goals § § § Continue to move code to open source. Continue to

Future goals § § § Continue to move code to open source. Continue to provide support for new Revit functionality. Respond to customer issues about fidelity. Add new options for alternate workflows. Integrate community contributions. © 2012 Autodesk

Autodesk, Auto. CAD, and Revit are registered trademarks or trademarks of Autodesk, Inc. ,

Autodesk, Auto. CAD, and Revit are registered trademarks or trademarks of Autodesk, Inc. , and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2012 Autodesk, Inc. All rights reserved. © 2012 Autodesk