Create BIM-like data structure in Grasshopper

Hi all,

I’m currently working on building a BIM-like data model (to be converted to IFC later). But I’m having some struggles doing this in Grasshopper.

First of all, using the Speckle GH components (create collection, speckle data model and properties) I cannot build a nested data model that mirrors the IFC import functionality. I cannot give a collection properties.
Also, when receiving the IFC imported speckle model I can’t access the ‘collection’ properties like IfcType, name, etc.

I’m now going to try to do this in python3 components using Base objects, but I was wondering if there is any other method or that I’m missing something.

The Ifc Importer also follows these same restrictions

e.g. IfcBuilding is a collection which has a child DataObject-IfcBuilding with the properties for the IfcBuilding in its elements alongside the child collections appropriate for the Ifc Schema.

So in essence you should be able to both create structures in GH equivalent to our importer and also use the same pattern to extract this data.

I can add the ability to read/write collection properties, but these are not a widely used pattern in connectors/integrations.

cc: @Jedd and @bjoern for visibility / expansion

The Ifc Object Model docs are here, but having just re-read them now I think we are incomplete on that description of Collection properties:

The docs provide some direction, but I’m still confused. I need an example of how to do this in GH.

I can nest:

  • collections
  • properties

cannot nest:

  • speckle data object
  • speckle geometry

So if I want to mimic the hierarchy: how would I do that?
I could create SDO, and nest all the properties of each level (project > site > building > storey > element like ifcwall or ifcspace)? But I cannot add either SDO or SG components to the nested properties.

Now I’m thinking I could create the entire structure and in the nested properties save a reference to the speckle geometry objects… so make it detached/proxy? So two collections; one with the hierarchy and one with the flat SG objects? Thinking out loud here

edit: would adding read/write to the collection properties make it behave more like a Data Object?

DataObjects aren’t intended to be nested

However, geometry objects can be added to a list on the displayValue property if a DataObject

Or they can be part of a collection in their own right.

There is no specific concept of nested geometry that’s is commonly supported

Block definitions and instances might be a solution: Nested Geometry Object in Data Objects

It might solve @Wes use-case it may not - it will depend on what success looks like

1 Like

Starting to get the gist of it. Pretty happy where I’m at right now.

@alex-d-richards , thanks for your reply. It got me on the right track. I started with the blocks but at some point switched to the dataobject + subcollection setup for my purpose.



This is where I’m at right now. Looks and feels similar to imported IFC model, but can’t get the underlying json structure to match exactly.

Next step would be to use speckle automate to take any model and build an actual ifc. But for that I need to dive a little bit deeper into the data structure in python. tbc

1 Like

Just a recap, as for the past three months I’ve been working with a more flat structure as it drastically simplified things in GH and in the code that takes speckle data to turn into IFC. But also in speckle itself.

Basically create collections for each ifc ‘level’ and fill it with data objects (or geometry objects). Each data object has a parent_id property that contains the guid of its parent.

This way I can just chuck all data objects into one collection without needing to create the full hierarchy per object. Makes iterating easy, and since each objects knows it parents and nested data depth is fixed for all objects, querying is also not an issue.

Importing an IFC in speckle however creates a hierarchial data model. I’m wondering what the pros and cons are of flatish vs hierarchial data structure for IFC’s

Hey @Wes,

I am not an IFC expert, and I don’t know what are the pros and cons of IFC data structure.

In IFC, there is a spatial hierarchy, but it is not limited to Site > Building > Level, and that’s only one part of the overall data model.

The canonical spatial structure is typically:

  • Project
    • Site (optional in IFC4 and later)
      • Building
        • Building Storey (Level)
          • Space (optional)
            • Elements (walls, doors, slabs, etc.)

What we do when we import an IFC is to convert this structure to Collections and Objects following the same hierarchy.

Did you by any chance had a look at the Automate functions that convert GH to IFC?

automate repo: GitHub - specklesystems/IFC-Exporter-Grasshopper · GitHub

Hey @Nikos ,

No, not yet! Me and my good friend LLM wrote an exporter in Python using IfcOpenShell. I’ll check it out.

Yes, exactly. And I’m wondering what the reason is for converting it to this structure, and not a simpler structure that works with relationships as a property. I guess similar to proxies?

Watch this space…

1 Like