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!

20 comments:

  1. This is freaky! I havent looked at this site for months and then I look today and a new update came in the same day! :D Great work btw. I really hope in the future these releases will help create a versatile open source BIM modelling tool. Freecad? or an addition to Blender?

    ReplyDelete
    Replies
    1. Haha yeah quite the coincidence. The focus for IfcOpenShell will probably still be on providing a core library for a while, but I suspect the commenter below you knows a lot more about open source BIM authoring tools :)

      Delete
  2. Note that obj (and I think collada too) supports ngons (faces made of more than 3 or 4 vertices). Those are used a lot in architecture modeling, they reduce a lot the complexity of models. Maybe at some point you could think of supporting that... Not sure if OCC tessellation allows it, though. Just food for thought :)

    ReplyDelete
    Replies
    1. Hi Yorik, yeah you're right actually, it's more of a limitation imposed by the way IfcOpenShell writes the files rather than the actual file format specs. I think Wavefront OBJ even supports nurbs and Collada has a BRep specification, I guess support for these in importing applications is limited though.

      I think a problem of n-gons is that they don't really help in faces with holes, also common in arch. modelling due to all the openings. Since tesselation in Open Cascade is on a face basis, I don;t think it is that hard though to merge adjacent coplanar triangles again after tesselation. Cool suggestion. In fact, the 3ds Max importer already uses something similar to hide these types of edges between the tesselation triangles.

      Delete
  3. First tests were OK, I was surprised. But after trying more I found out that some European (e.g. UNP profiles) are not recognised. So those profiles do fail in STP. When we're able to have those inside the STP I would be very satisfied. Tekla Structures IFC was the source for the STP conversion.

    ReplyDelete
    Replies
    1. Hi Maic, thanks for your reaction. It's true that not all parameterized profile definitions are currently implemented. The good news is that these are fairly trivial to implement. I'd happily work with you to iron out these issues.

      Delete
    2. Hello Thomas, Used 0.5 version and all the profiles in my IFC are converted. I only have a scaling problem now. Profiles are 1000 times too small and I don't know how to solve this. Once this is working we can make a lot of people happy. Regards, Maic

      Delete
    3. Hi Maic,

      Feel free to send a small test model to models@ifcopenshell.org that has this problem so that I can look into it.

      Kind regards,
      Thomas

      Delete
  4. Can someone enlighten me pls ... are .STEP and .IFC files the same xml data under the surface? Can I just rename the fileExtn and tweak a couple of tags to change it from one to the other??

    ReplyDelete
    Replies
    1. Hi,

      STEP and IFC files share the same format, also called STEP, or ISO-10303. However, the schemas are completely different, except for similarities in the geometry definitions. Especially for the conversion from STEP to IFC you will need additional information because of the semantics required for a meaningful IFC file. For example: a building decomposition structure with storeys and spaces, multiple representation for elements such as walls to retain them as parametric elements, etc. Long story short: changing the file extension and some string replacement is not enough, but there are many similarities.

      Hope that helps,

      Best,
      Thomas

      Delete
  5. The importer has the ability to import into the blender the geometry of the IFC , have you thought of import IFC information to the blender ? will be very difficult ?

    ReplyDelete
    Replies
    1. Hi Leandro,

      Thanks for you suggestion, it would not be very difficult to implement. However, the focus of IfcOpenShell is to provide a software module that others can build upon, not so much to provide fully functional end-user applications. If we get more requests like this I will certainly keep it in mind. It's an open source projects, improvements, patches and contributions from the community are always welcome. Thanks.

      Best,
      Thomas

      Delete
  6. Could you explain how to use the software?? I´m trying to translate an IFc file to STEP to make the file readable by a software that just read STEP.

    ReplyDelete
    Replies
    1. It is a command line executable. You can run IfcConvert <path_to_ifc_file.ifc> <path_to_step_file.stp> to convert the file. Replace the paths, including < and > with the file you want to convert and the destination file name.

      Delete
  7. How to provide the options in command line
    ?

    ReplyDelete
    Replies
    1. There are a lot of resources for this online, e.g: http://www.digitalcitizen.life/command-prompt-how-use-basic-commands.

      To simplify things, you can put the IFC file and IfcConvert in the same folder. Navigate to that folder using the command prompt and type something like: IfcConvert my_ifc_file.ifc my_result.stp with `my_ifc_file.ifc` being the file you want to convert.

      Hope that helps,

      Kind regards,
      Thomas

      Delete
  8. Appreciate your reply Thomas, But I was looking for providing the advanced options in particular. E.g. --sew-shells, --merge-boolean-operands etc.

    I am able to convert the ifc to stp. But the step file when imported to solidworks seems to be missing some faces and has incorrect geometry.
    So I just wanted to try out the advanced options. But, when I provide these options in command line nothing gets executed. Turns out these options cannot be provided via command line.

    I have written simple C# program which invokes the IFCConvert.exe using Process.Start. Here I can now try the advanced options.

    Thanks,
    Ivy

    ReplyDelete
  9. Hello Thomas,

    I am having one issue with the step file created. When I import it in Solidworks, some of the faces are lost.
    Some cut features are preserved while others seem to be weird. I am working with a Round tube.

    I tried the advanced options in combinations just to try if it could give better results.
    Alas! Didn't help.Is the .err file generated able to confirm if the ifc to step conversion was without any geometry loss?

    Have you come across this type issue wherein some faces are lost in the transit? Any available solution?

    Thanks and Regards,
    Ivy

    ReplyDelete
    Replies
    1. Hi Ivy,

      What version of IfcConvert are you using? Best would be to build from source yourself to stay up to date with recent changes, but at the very least try with the 0.5.0-preview2 release.

      There aren't options for STP files specifically and none of the options should have such a big impact to introduce missing geometry.

      Usually IfcOpenShell is quite verbose, so errors interpreting geometry should typically be written to the log.

      Several options:
      - Does a conversion to DAE/OBJ result in any missing geometry?
      - Does another STP viewer show the same missing faces?

      Feel free to send the model to models@ifcopenshell.org confidentially. Or better, create a public issue: https://github.com/IfcOpenShell/IfcOpenShell/issues

      Kind regards,
      Thomas

      Delete
  10. Thank you Thomas for your quick reply.

    I was using 0.4.0.

    I am so glad you made a suggestion to try 0.5.0. Just downloaded the 0.5.0 preview 2.
    The files get converted perfectly using 0.5.0. Really appreciate your help.

    Thanks and Regards,
    Ivy


    ReplyDelete