Creating IFC from scratch

edited October 2021 in General

Hi All,

I am looking for a way to create an IFC file from scratch in which I wish to add solids as IfcSpaces and planar surfaces as IfcDoor and IfcWindows. Here, a sample geometry that shows one solid and a coplanar surface that I would like to convert to an IfcSpace and IfcWindow.
I have looked that this post and it tells me that there should a straightforward way to achieve what I have in mind.

Where can I start? API documentation of ifcOpenShell would have been so useful in this case.

Tagged:

Comments

  • edited October 2021

    Halfway through this presentation (skip to a slide with code on it) gives some sample code of creating a file from scratch. It sets up a building and some elements in that building (slabs and walls). It uses the API which I highly recommend. However, the slideshow does not go into how to create geometry, which is slightly trickier.

    There are many forms of geometry in IFC. There are meshlike things, parametric solids and extrusions, nurby things, and so on. So it is a tricky topic as you need to make the choice on what geometry type best fits your purpose. I have written code which connects the IfcOpenShell API to Blender's geometry kernel. Assuming you are using Rhino from your screenshot, I think the best approach is to write a new IfcOpenShell API class that handles Rhino's geometry kernel. Covering meshes, planes, and a few extrusion types shouldn't take too long and will cover a good 99% of things you want to deal with. That said, it is not a beginner task, so I'm happy to do pair programming sessions with you to get started and cover a few geometry types, and when you get the hang of it you can cover any more obscure ones you like. How does that sound? If you're happy to spare an afternoon sometime, I'm happy to help.

    I would avoid the manual approach shown in the blog post. It's great for learning, not so great in practice when you're dealing with different units, relative coordinates, and switching between different geometry types.

    sceyefeye
  • Thanks @Moult,

    There are meshlike things, parametric solids and extrusions, nurby things, and so on. So it is a tricky topic as you need to make the choice on what geometry type best fits your purpose

    Can you point me to the API? I can start looking.

    I have written code which connects the IfcOpenShell API to Blender's geometry kernel. Assuming you are using Rhino from your screenshot, I think the best approach is to write a new IfcOpenShell API class that handles Rhino's geometry kernel.

    No. Nothing to do with Rhino's geometry kernel. I have been working on IFC > HBJSON workflow. I have made good progress on it and it already gives me the geometry that I need to convert to IFC elements.

  • edited October 2021

    Ah ok - in that case we should write a Usecase for adding representations from HBJSON. From what I recall HBJSON geometry is quite straightforward.

    This is the existing class that connects to Blender - you'll want to create an equivalent for HBJSON. I expect it to be significantly less complex and a fraction of the lines of code ... https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py - don't be intimidated, that code handles non body geometry, analytical geometry, parametric geometry, lighting geometry, etc, none of which you need to worry about.

    I assume you are converting https://github.com/ladybug-tools/honeybee-schema/blob/master/honeybee_schema/geometry.py - Mesh3D and Face3D. This is the relevant portion to start to get familiar with: https://github.com/IfcOpenShell/IfcOpenShell/blob/199be3363f8a7fdd4a3b12fa63559430089eca51/src/ifcopenshell-python/ifcopenshell/api/geometry/add_representation.py#L433

Sign In or Register to comment.