OSArch Community

[IFC] List of tools for programming for IFC

  1. B
  2. M

    I find this stack incredibly Windows-centric. Part of the reason I prefer IfcOpenShell, apart from the Python bindings which are a huge time-saver for rapid prototyping, is that it is much easier to build platform agnostic with.

  3. B

    I should share my Perl module for reading and writing IFC files, it is very much limited to functionality that I specifically need, but somebody may find this useful:

    BitbucketIt also includes a vim syntax highlighting file for IFC files which makes them much easier to read

  4. M
  5. B

    @Moult I'll add a wiki entry for File::IFC. The documentation is in perl pod format, so I don't duplicate it in the README. Here's the documentaiton for the base class should anyone be interested:

    NAME

    File::IFC - Industry Foundation Classes

    SYNOPSIS

    A tool for writing IFC STEP files for Building Information Modelling (BIM)

    DESCRIPTION

    File::IFC contains basic methods for reading and writing IFC files. To write real-world IFC files you probably want to use the sub-class File::IFC::Helpers, which contains methods for assembling headers, components etc...

    METHODS

    new Create a File::IFC project like so:

         use File::IFC;

         $ifc = File::IFC->new;

    FILE_XXXX

    Add a header item to the project, these methods are created on the fly:

         $ifc->FILE_FOP ('Some text', ['a', 'sub', 'list']);

    IFCXXXXX

    Add entities to the project, these methods are created on the fly:

         $foo = $ifc->IFCFOO;

         $foo->Add ('Some text', undef, 12.0);

         $bar = $ifc->IFCBAR ('Some other text', undef, 12.03, '.ELEMENT.', 1.0E-05);

         $ifc->IFCBAZ (undef, 'More text', $foo, $bar);

         $ifc->IFCNOO ($foo, [0.0,1.0,0.0], undef, [$foo, $bar]);

    Note, to force a number to be interpreted as a string, prefix it with 'STRING:'

         $ifc->IFCNAR ('Year', 'STRING:2013');

    Note, this library does no entity validation, you can create any method name you like, say $ifc->IFCWHATEVER(undef), and #123=IFCWHATEVER($); will be written to the file.

    Parse

    Alternatively, parse existing IFC data (this expects an array of lines):

         $ifc->Parse (@lines);

    Dump Text

    Generate a IFC formatted data as an array of lines:

         @list = $ifc->Dump;

    ..or join it all together as a single text blob:

         print $ifc->Text;

    This results in text output like so:

         ISO-10303-21;

         HEADER;

         FILE_FOP('Some text',('a','sub','list'));

         ENDSEC;

         DATA;

         #1=IFCFOO('Some text',$,12);

         #2=IFCBAR('Some other text',$,12.03,.ELEMENT.,1.E-05);

         #3=IFCBAZ($,'More text',#1,#2);

         #4=IFCNOO(#1,(0,1,0),$,(#1,#2));

         #5=IFCNAR('Year','2013');

         ENDSEC;

         END-ISO-10303-21;

    Cache_Ids

    Build a lookup table of entity ids (optional, this just speeds up the Get_Id() method):

         $ifc->Cache_Ids;

    Renumber Merge_Ifcrel

    Go through list of entities and renumber without changing order (the data is stored as a big list, this just deletes empty list entries):

         $ifc->Renumber;

    Merge entities that specify a relationship such as IFCRELASSOCIATESMATERIAL, IFCRELCONTAINEDINSPATIALSTRUCTURE and IFCRELAGGREGATES:

         $ifc->Merge_Ifcrel;

    i.e. multiple entries like this get removed:

         #25=IFCRELAGGREGATES('0wsQ2vBzIYI3uTHLpG2INA',#5,$,$,#19,(#24));

         #30=IFCRELAGGREGATES('0dUwp9Ptxt608YBTVMwlQQ',#5,$,$,#19,(#29));

    ..and replaced by a single entry like this (note that as entries are removed, subsequent entries are renumbered):

         #1439=IFCRELAGGREGATES('2OknSXOQLN6pcUngENnLLw',#5,$,$,#19,(#24,#28));

    Refcount

    Count number of references to each entity, increments _refcount for each entity found:

         $ifc->Refcount;

    Get_Id

         $id = $ifc->Get_Id ($entity);

    Returns an integer id prefixed with a hash, e.g: #1234

    FUNCTIONS

    guid

    Create a random (probably) unique UID:

         $string = guid();

  6. M

    Very cool! Thanks for adding it to the wiki!

  7. M
  8. M

    @mko - great project! Would you like to add it? It is a wiki :)

  9. M

    will register soon :)

  10. D
  11. D
  12. M

    Hi Ducan,

    Yes sorry for the delay, still rather busy at the moment but I will try to anwser briefly. So, ... good question :) As I've mentioned here [1], Stepcode is a set of tools and a library that can parse Step files (and Ifc files by extension). As a C library, Stepcode is used to auto-generate custom C libraries from Step/Ifc file schemas with object definitions. These generated libraries are usefull if you what to build an application based on these specific Step/Ifc objects (being a C lib, you have very good performances with large objects). Thomas Paviot, the author of PythonOCC [2] is one of the maintainer of the library if I'm correct. Stepcode is, as far as I known, one of the oldest open source library that can do the job. Today, you'll find some more "modern" version of it. IfcOpenshell for example (which is written in C++) has implemented it's own parser. In the same domain there is xBim [3] also.

    Hope that can help,

    best.

    Milovann

    [1] https://www.continuum.codes/stepcode/

    [2] https://www.continuum.codes/pythonocc/

    [3] https://www.continuum.codes/xbim/

  13. B
  14. D

Login or Register to reply.