Comments

  • 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.

    MaoZerhouni
  • 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:

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

  • @brunopostle that's very cool! Can you update the readme showing some examples of how to use it? Then we should definitely add it to the Wiki AEC software directory! (or, since it's a wiki, you should add it yourself!) https://wiki.osarch.org/index.php?title=AEC_Free_Software_directory

  • @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();

  • Very cool! Thanks for adding it to the wiki!

  • You can add also the Stepcode project

    https://www.continuum.codes/stepcode/

    haven't seen in the list

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

  • will register soon :)

  • For anyone dropping by 2 years later ... there is now a page on the wiki trying to list IFC related software libraries
    https://wiki.osarch.org/index.php?title=IFC_-_Industry_Foundation_Classes/Software_Libraries_for_IFC

    @mko or @Moult could you explain what https://stepcode.github.io/ is?
    @bruno_perdigao could you add your project to the page of IFC libraries?

  • @duncan said:
    For anyone dropping by 2 years later ... there is now a page on the wiki trying to list IFC related software libraries
    https://wiki.osarch.org/index.php?title=IFC_-_Industry_Foundation_Classes/Software_Libraries_for_IFC

    @mko or @Moult could you explain what https://stepcode.github.io/ is?
    @bruno_perdigao could you add your project to the page of IFC libraries?

    none of you understand what stepcode is? I find that hard to believe :-)

  • mkomko
    edited October 2022

    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/

    duncan
  • the list misses https://ifcquery.com/
    It is C++ and works on all three major systems.

  • Great info. Thanks @mko & @bernd - hopefully someone can add that to the wiki page https://wiki.osarch.org/index.php?title=IFC_-_Industry_Foundation_Classes/Software_Libraries_for_IFC
    ... otherwise I'll just add it to my list for "someday maybe". Now the information is here where people have a better chance to find it.

Sign In or Register to comment.