Blender objects w/modifiers or Sverchok to BlenderBIM

edited October 2023 in General

Hi All,
I am doing some tests from Blender to BlenderBIM without using the native BB tools with an aim to have more parametric setups.

As a first I am using a mesh object edge outline that is fed into another object and made into a slab via a simple geometry nodes setup. The same outline is also fed into another object with geometry nodes made into a wall via another geonodes modifier. The BlenderBIM setup is uses IFC, building, storey, project settings. I then try to create some drawings and I get the following error:

Python: Traceback (most recent call last):
  File "C:\Users\dimit\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\drawing\operator.py", line 203, in invoke
    return self.execute(context)
  File "C:\Users\dimit\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\drawing\operator.py", line 226, in execute
    self.drawing = self.file.by_id(drawing_id)
  File "C:\Users\dimit\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 388, in by_id
    return self[id]
  File "C:\Users\dimit\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 376, in __getitem__
    return entity_instance(self.wrapped_data.by_id(key), self)
  File "C:\Users\dimit\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\ifcopenshell_wrapper.py", line 4571, in by_id
    return _ifcopenshell_wrapper.file_by_id(self, id)
RuntimeError: Instance #0 not found

It seems that the Wall and Slab objects that contain geometry nodes modifiers, may not work properly as IFC objects . Furthermore, making a wall with a different modifier-based setup, I can see that there is not outline cut unless the modifiers are applied.
Below is a file with a view and walls with a modifier

If I apply the modifier, then there is a clear cut line and the drawing exports properly

What's interesting is that if I re-open the the saved IFC file, since it's pure IFC, I can export the drawing. While at the same time the saved blender file contains the parametric information. That's my sort of workaround at the moment.

I am curious though, is it possible to have an IFC representation with modifiers? Or more specifically creating drawings? Since it seems that under the hood, the correct version of the geometry with all modifiers applied is being saved in the IFC, I am wondering whether that temporary "apply all modifiers" geometry could also be used within the .blend file for output of drawings.

On a separate note, I have been looking for resources on using Sverchok with BB, but I am not finding much. Does any one have some resources on how to get started, how the linking works? Or is it along the lines of creating solids and then converting them into IFC? I found a page for something called IFC Sverchok https://blenderbim.org/docs-python/ifcsverchok/installation.html, but a link on the page points me to the main blenderbim.org page.

theoryshawAceOwura_qu

Comments

  • Interesting topic! For IfcSverchok, maybe have a look at the readme in the main repo:
    https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcsverchok

    dimitar
  • @dimitar, I'm also interested in this topic, but didn't have the time to make more experiments. From what I understand, there are two possible approaches, one is to create a whole IFC file from a Sverchok setup, the other is to use a Sverchok modifier, but you can only create a single object with it.
    I'm attaching two files, one for each approach. The first one is a parametric tower in a blend file, with the full IfcSverchok setup. The second one is a JSON file for a parametric column that you can import using the Sverchok modifier inside BB Parametric Geometry. Let me know if it helps. Feel free to ask any questions.

    theoryshawbrunopostleAcecvillagrasadimitar
  • @cvillagrasa said:
    Interesting topic! For IfcSverchok, maybe have a look at the readme in the main repo:
    https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcsverchok

    Thanks for the link! @Moult perhaps the links can get updated in this page? https://blenderbim.org/docs-python/ifcsverchok/installation.html

    @bruno_perdigao said:
    @dimitar, I'm also interested in this topic, but didn't have the time to make more experiments. From what I understand, there are two possible approaches, one is to create a whole IFC file from a Sverchok setup, the other is to use a Sverchok modifier, but you can only create a single object with it.
    I'm attaching two files, one for each approach. The first one is a parametric tower in a blend file, with the full IfcSverchok setup. The second one is a JSON file for a parametric column that you can import using the Sverchok modifier inside BB Parametric Geometry. Let me know if it helps. Feel free to ask any questions.

    Thanks for the files! I had to read up a little on IFC Sverchok to understand what's happening. It seems to work in a very similar way to GeometryGYM, and Grasshopper components with Rhino Inside Revit, so it makes sense. As for the UI, as noted in the link above, i exported an IFC file via the Sverchok sidebar IFC tab. Then opened the IFC with a very nice structure. Is it not possible to have the sverchok definition and the IFC within the same Blender File?

    Then I tried to place a camera view by first setting up a camera and exporting it with your model, but I am getting an error.

    I use Blender from the Windows Store, which is not 3.6.4 and I had to install the latest BB daily in order for BB to work, which is v 231002, so it could be come kind of bug with the daily, but this is what I get:

    Python: Traceback (most recent call last):
      File "E:\docs\blender assets large\addons\blenderbim\bim\module\drawing\operator.py", line 202, in invoke
        return self.execute(context)
      File "E:\docs\blender assets large\addons\blenderbim\bim\module\drawing\operator.py", line 225, in execute
        self.drawing = self.file.by_id(drawing_id)
      File "E:\docs\blender assets large\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 388, in by_id
        return self[id]
      File "E:\docs\blender assets large\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 376, in __getitem__
        return entity_instance(self.wrapped_data.by_id(key), self)
      File "E:\docs\blender assets large\addons\blenderbim\libs\site\packages\ifcopenshell\ifcopenshell_wrapper.py", line 4571, in by_id
        return _ifcopenshell_wrapper.file_by_id(self, id)
    RuntimeError: Instance #0 not found
    

    And just in case, checking with the latest BB whether my original walls work without the modifier applied - they don't. The view generates only with the modifier applied

  • Is it not possible to have the sverchok definition and the IFC within the same Blender File?

    No, I don't think it's possible yet.

    I'm not having any trouble creating the drawings for the tower file, I tried with two different setups. Maybe try with another blender version, or a fresh reinstallation.

    And just in case, checking with the latest BB whether my original walls work without the modifier applied - they don't.

    I think it's not possible to use blender modifiers to generate IFC geometry (unless applied). That's why there are BB "modifiers", in Geometry and Materials Tab -> Parametric Geometry. Basically, these parametric tools create data that can be stored in IFC Psets. Since BB is working with native IFC, not all Blender tools are possible to use with BB.

  • Thanks for the link! @Moult perhaps the links can get updated in this page? https://blenderbim.org/docs-python/ifcsverchok/installation.html

    Updated urls in the github repo.

    Is it not possible to have the sverchok definition and the IFC within the same Blender File?

    Have you tried Sverchok section from Parametric Geometry? Haven't used it for awhile now but the idea was that you can link your IFC object to some Sverchok graph and update IFC geometry from it.

    cvillagrasaAcedimitartheoryshaw
  • edited October 2023

    @bruno_perdigao said:
    I think it's not possible to use blender modifiers to generate IFC geometry (unless applied). That's why there are BB "modifiers", in Geometry and Materials Tab -> Parametric Geometry. Basically, these parametric tools create data that can be stored in IFC Psets. Since BB is working with native IFC, not all Blender tools are possible to use with BB.

    What's interesting is the modifiers seem to be applied under the hood, as when opening the save IFC file, it has the same geometrical representation (without the modifiers), from which point, all typical IFC workflows can continue. While, opening the blender file preserves the original Blender geometry with modifiers as well. So, in essence, I assume that BB "bakes" the geometry for saving into the IFC.

    Wondering whether it may be possible to temporarily apply modifiers and use a synced and applied duplicate behind the scenes. Or, if there is a way for BB to access the final mesh representation into IFC. This process can certainly be done manually for the time being. However, I believe that being able to work with modifiers and BlenderBIM easily and seamlessly is crucial to fill in the gaps beyond BB for more parametric setups.

    I know that IFC also allows for some parametric relationships, yet Blender's modifiers provide excellent further parametric capabilities that can then be "dumbed down" do more standard IFC components, or automatically generated and kept in sync.

    @Andrej730 said:
    Have you tried Sverchok section from Parametric Geometry? Haven't used it for awhile now but the idea was that you can link your IFC object to some Sverchok graph and update IFC geometry from it.

    Thanks for pointing that out. Will experiment and take a look.

    Sverchok is great, but the continuing tighter integration between Geometry Nodes and the rest of Blender suggests that it would add much more value to be able to work with Modifiers and Geometry Nodes and BlenderBIM without needing to apply all modifiers. For example, in the upcoming v4.0 new tools will be able to created without scripting, directly with Geonodes.

    The asset library already works quite well with geometry nodes, and also in 4.0, the Modifiers menu will include geometry nodes instances.

    For AECO, being able to have a large library of natively created assets with Geometry Nodes and being able use them as IFC components without applying the geometry would be a huge win, as we can have various parametric setups for everything that can work more natively with vanilla Blender. (And also, BagaPie already does a pretty good job walls and door/window openings https://abaga.gumroad.com/l/BbGVh). This would save valuable developer where there should be no need to reinvent everything, but instead being able to port any object with modifiers to IFC without applying the modifiers. I imagine non coding users would quickly get on board and share their general assets with the community with their own setups.

    theoryshawOwura_quBedsoncvillagrasaAce
  • I absolutely agree with Dimitar. I was alluding to this in a recent post when I asked if we could have the equivalent of Revit's IfcSaveAs so that we are free to model in whatever way we choose.

  • Have you seen the scripts for generating libraries with pure python? There are also some that generate them based on blender geometry, so that is basically what you need for content generation with geonodes.
    For the building itself, there are good reasons why things are only partially parametric, mostly because geometry is not the biggest concern in bim - it's the data bound to it.
    But you could always use the ifcsverchok for the "save as ifc", that way don't have to apply the modifiers and you can add the classification dynamically.

    Bedsonaaron
  • Have you seen the scripts for generating libraries with pure python? There are also some that generate them based on blender geometry, so that is basically what you need for content generation with geonodes.

    Are these how the windows and doors are created in blender bim?
    Where can these be found? :)

  • Ifc sverchok makes things easy. Is there a way to append a plan|Bodyview using sverchok nodes.

    Bedson
Sign In or Register to comment.