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