xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
255 stars 128 forks source link

Where can I get the code that create a sample house using xbim library? #428

Open SerafinaM opened 1 year ago

SerafinaM commented 1 year ago

Hello everyone! I just started using greatest tool, xbim library, but there are lack of manual. So I attempt to find sample code but I can't find completed code anywhere. Is there anyone who has project I need? I want to create a house including wall, door, window, roof from scratch. Screenshot 2023-06-13 025856 I hope you can help me. Thanks in advance! Serafina.M

mathieuwybrecht commented 1 year ago

Hi,

In order to get what you want, you'll need few things to know :

How to create an empty IfcStore

How to create root entities : IfcProject (maybe IfcSite if you want to place your house on a site) IfcBuilding

Then, maybe you should describe the levels of the building IfcBuildingStorey

Then you can start to create physical products that make a building. Basically : IfcWall IfcSlab IfcRoof

And create the openings and their fillings : IfcOpeningElement IfcDoor IfcWindow

Now, you'll have to build the relations objects between those elements and, finally, in order to get a beautiful 3D representation of the house, you'll have to create the body representations of each object you need to see :

representations for slabs / roofs / walls / openings / doors / windows Slabs and roofs and walls are most of the time surface extrusions along the vertical axis. Openings are most of the time extrusions along their local Y axis, with should go through the wall they pierce. Doors and windows are frequently 3D meshes, or sometimes they are decomposed in IfcMembers and IfcPlates like if they were curtainwalls.

That's pretty much it :)

I did that, few years ago, that may take some time to achieve.

andyward commented 1 year ago

The 'Proper Wall' example is probably a good starting point

That example builds from first principles, and includes lots of different ways of writing properties etc, so it can be greatly simplified, and some helper methods would make it simpler. But there's quite a bit of complexity in the IFC domain, so building a whole house is not going to be trivial.

IfcOpenShell did a nice demo of building a house in their C++ library - called IfcOpenHouse - it would be nice to have an equivalent in xbim.

But you'll note there's still lots of Implementors Agreements you need to be aware of when building a model yourself.

SerafinaM commented 1 year ago

Thank you so much for reply. Your comments helped me understand how to creating project using xbim toolkit. I know it's difficult and take some time to implement and I already checked a little examples. So I would like to solve following problem as first step.