Friday, December 19, 2014

Combining IfcOpenShell and pythonOCC

One of the strengths of the IfcOpenShell library is the vast amount of shape analysis and healing tools that Open Cascade provides. This allows for transforming, validating, generating and analysing geometry in IFC files, for example, to compute missing IfcProperty values, validate geometrical constraints, implement clash- and interference checking and the generation of new geometry.

pythonOCC exposes the rich set of functionality that Open Cascade provides to a Python environment, which allows for intuitive rapid prototyping. Since IfcOpenShell also provides a Python wrapper, the two of them can be easility tied together to create a development environment for working with geometry in IFC files in an interactive, quick, but also, very powerful way.

To demonstrate the possibilities, or rather, the first baby steps towards a more interesting and meaningful demonstration, I put together a quick example here: The set of dependencies to get the system running is long, but it is worth it!

Tuesday, May 6, 2014

Updates on Geometry

Primarily IfcOpenShell focusses on the geometrical content of IFC files. This post provides an overview of some of the recent accomplishments related to our core business of processing IFC geometry.

Parametric profile definitions
IfcOpenShell already supported most parametric profile definitions, but until recently implementation for some of them remained. All parametric profile definitions are now supported. Contrary to many other implementations of the IFC format, IfcOpenShell takes special care of correctly converting all fillet radii and leg slope attributes.

One of the promising additions that IFC4 brings to the table is the support for b-spline surfaces. With support for this elementary example of a twisted cube defined using IfcBSplineSurfaceWithKnots, provided by GeometryGym, the first baby steps towards IfcOpenShell as a IFC4 compliant geometry engine have been made.

Constructive Solid Geometry
IfcOpenShell now supports all CSG primitives and boolean operand connectives.

BIMserver Render Engine improvements
The project reached an important milestone recently with its 1.3.0 release. IfcOpenShell contributed to this release by supplying a Render Engine that converts the IFC product representations into explicit triangular geometry. For example for use in their web-based viewer called BIMsurfer. In close collaboration with the BIMserver team we took special care of making sure that the engine is fault-tolerant and in the meantime took the time to implement initial support for surface styles and colors.

Apart from interpreting geometry, more and more so IfcOpenShell is stepping up to provide a framework for generating geometry as well. Recently the code to generate the IfcOpenHouse example, an IFC building model generated entirely from code, has been updated to conform a little bit better to the CoordinationView implementers agreements. You can read more on our struggle with actual parametric interoperability here.

Read more about IfcOpenShell as an IFC creation framework in the recent blog post by Yorik van Havre as he discusses the promising steps towards IFC support in FreeCAD.

Be sure to check how your favorite IFC viewer compares to IfcOpenShell by looking at the sample files here (just note that these developments are not yet part of the official built releases). Also note that some of these recent developments where funded by an generous external party and implemented by AECgeeks a company founded by Thomas, one of the principle IfcOpenShell developers.

Friday, February 7, 2014

Surface styles

Support for IfcSurfaceStyles, when importing geometry from IFC files, is a feature that has been requested much over the years. Starting with IfcOpenShell 0.4 surface styles are supported. Some refer to these styles as materials, but within the realms of IFC, surface styles and materials are actually two different beasts. Materials (IfcMaterialDefinition) describe metadata that pertain to the physically built structure. For example: the composite structure of an insulated brick wall can be described using an IfcMaterialLayerSet.

Surface styles on the other hand govern the way that surfaces or solids are visualised in IFC viewers. Often there is some correlation between the two: that the style of a surface is actually an indication of the material, but this is not necessarily the case. For example in MEP models, surface styles can also be used to colour code the contents or direction of flow segments, as can be seen above. In this post you find two images attached that derive their colouring straight from the IFC file: the Hitos HVAC model and an interior part of the Cobie Duplex Architectural model. In the image below you can also see how multiple distinct styles can be applied to different items within the same product.

Subsequent releases of IfcOpenShell will also account for surface styles linked to IfcMaterials and will provide an option to slice the geometric representation of elements according to their compound layer structure defined in the IfcMaterialLayerSet.

Sunday, January 12, 2014

IfcOpenShell 0.4.0 rc1 released!

It has been a while, but today the immediate availability of the first release candidate for the IfcOpenShell 0.4 release is announced! On this blog some of the new features of this release will be highlighted in detail. For example on file format conversion. Please report all issues found (by leaving a comment, starting a thread on the forums, a message on IRC, e-mail or a letter, you know where to find us)!

Changes since 0.3:
  • Introduction of IfcConvert 
    • A new utility that writes STEP, Collada, IGES and Wavefront OBJ files
  • Support for IfcSurfaceStyles when importing geometry
    • Surface styles govern the colours applied to elements in IFC viewers
  • More robust support for clipped representations
  • Blender IFC importer updated for 2.69
  • 3ds Max IFC importer updated for 3ds Max 2014
  • Improved performance and stability

The release can be downloaded from the website:

Enjoy! And remember that IfcOpenShell still needs your help!

Tuesday, January 7, 2014

Converting IFC files to STEP, IGES and Collada files

One of the brand new features in the upcoming IfcOpenShell 0.4 release is the ability to convert geometry in IFC files into three new file formats by using the new IfcConvert utility. The in total four supported output formats now are:
  • Wavefront OBJ (.obj)
  • Collada Digital Asset Exchange (.dae)
  • STEP (.stp)
  • IGES (.igs)
Wavefront OBJ conversion was already supported by the IfcObj utility. This utility is now obsolete. Both the Wavefront and Collada files, as created by IfcConvert, contain only tessellated geometry. More specifically: when using these formats all geometry is defined using explicit triangular polygons and curved surfaces would be approximated using these triangles. The great thing about these formats is that they can be imported by virtually any application, at the expense of some precision in the geometry definition.

For example consider the following statement:
#106 = IFCISHAPEPROFILEDEF(.AREA., $, #103, 302., 1008., 21., 40., 30.);
This defines an I-beam profile cross-section with a 302mm width, 1008mm height, a thickness of 21mm for the web, 40mm for the flanges and a fillet radius of 30mm. The left-most image depicts how such a beam, with a single opening added, would be defined using triangles. Notice how the fillet radius where the web and the flanges meet is approximated using planar surfaces and the round opening is in fact an n-gon.

Where STEP and IGES are different is that these formats allow the exporter to specify the surfaces using a boundary representation that supports curved surfaces and faces with holes. Therefore, no geometrical fidelity is lost in the conversion process. This can be useful in many of the engineering applications that do not natively support importing IFC files, but do provide support for either STEP or IGES files. After all, even though STEP and IFC(-SPF) share the same notation format (ISO 10303-21), STEP has been around for longer and is used in a variety of domains, where IFC is used only for describing building data. An illustration of the same beam without the triangular tessellation is provided on the right.

Stay posted for the first Release Candidate of the new IfcOpenShell 0.4, to be made available soon, which includes this new utility!

Monday, February 11, 2013

IfcOpenShell 0.3.0 released!

After another (rather lengthy) period of testing we proudly announce the immediate availability of IfcOpenShell 0.3.0, the latest stable release of this open source toolkit for working with IFC files.

Meanwhile several interesting new features have already been developed in anticipation of the following release: Support for writing IFC files is especially something to look forward to given the powerful geometry back-end based on Open Cascade. Note that these features will not be available in the 0.3.0 release though.

Thanks go out to everybody for reporting bugs and contributing to this release. Naturally this includes everybody using IfcOpenShell and those being involved in the discussion and adoption of IFC in the AEC industry as well.

Changes since 0.3.0-rc3

Parsing and geometry
  • Potentially faster processing of files that can not be parsed sequentially, i.e. that require many random access operations throughout the file
  • Fixed a bug that caused IfcCircleHollowProfileDefs to be processed incorrectly
  • More robust processing of IfcCompositeCurves if no plane angle unit is provided in the file
  • More robust processing of IfcTrimmedCurves with tolerances on trimming by IfcCartesianPoint and, if possible, falling back to trimming by IfcParameterValue
  • Updated for Blender 2.65
  • Allow opening of non-latin filenames on Windows (other platforms already supported this)
  • Use positive vertex indices for Wavefront OBJ files, which is more widely supported in importing applications
  • Updated for Autodesk 3ds Max 2013
  • Allow opening of unicode filenames (only in 3ds Max 2013)
BIMserver IfcEngine
  • No longer throws an exception if a building element's geometry is requested for an element that has not been processed by the IfcOpenShell binary

The release can be downloaded from the website:
Enjoy! And remember that IfcOpenShell still needs your help!

Sunday, November 4, 2012

Say Hi to IfcOpenHouse!

Up until now, most people have been using IfcOpenShell to read and import IFC files, but today we bring you a three-dimensional IFC building model that is entirely generated from lines of code, using IfcOpenShell. With the use of some of the helper classes that IfcOpenShell provides, some might even say that creating IFC files this way is easier than operating a full-fledged BIM authoring tool, but that would we somewhat of an overstatement.

IfcOpenHouse rests on a Nurbs-surface hilltop constructed in Open Cascade. The tight relation between IfcOpenShell and Open Cascade will in the future provide everything you need to write complex parametric shapes right to an IFC file. However, for now the surface had to be tessellated, as Ifc2x3 does not support Nurbs and IfcOpenShell is not yet smart enough to pick the correct way of representing arbitrary shapes from Open Cascade, therefore it resorts to a triangular surface model.

For the other building elements IfcExtrudedAreaSolids are used, IfcBooleanClippingResults with IfcHalfSpaceSolids are used for the walls under the slanted roof and IfcOpeningElements are used for the boolean subtractions for windows and door. The hierarchical structure of an IfcProject, IfcSite, IfcBuilding and IfcBuildingStorey is created as well. This way a model is obtained that can be directly imported into your favourite three-dimensional modelling package.

IfcOpenHouse rendered in Blender using IfcBlender, imported into Revit and opened in Solibri Model Viewer and Tekla BIMsight. 

If you know of an application that is unable to represent the generated model correctly, or have any other questions or remarks, drop us a line in the comments! You can download the generated IFC here (updated June, 2014), and take a look at the source code for generating the file over here.

Update November 10, 2012 IfcOpenHouse has been updated to import correctly into Autodesk AutoCAD Architecture 2013.