[Sverchok] Update on development of IfcSverchok nodes - GSoC 2022

edited November 2022 in General

Hi!
A couple of months ago I posted about beginning the work on IfcSverchok nodes as part of this years Google Summer of Code.
GSoC is now finished, and while the nodes definitely are not, there are now around 15 basic, core nodes to play around with and test.

They are still WIP and may lead to Blender crashes, especially if undoing (ctrl/cmd-Z).

TL;DR

There is an example model, kindly provided by Erindale Woodford https://twitter.com/erindale_xyz, and a walk-through of how it can be turned into an IFC model with the nodes. For now, it can be seen on my fork of the project https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok.

The overview and general logic is as follows:

So there are two ways of creating geometry right now; 1) from Blender objects or 2) from Sverchok geometry (verts, edges and faces).

And the created IFC model imported with BlenderBIM:

A more detailed description and some other small examples are in the projects readme.

Nodes

List of nodes that have been tested to the best of ability (nodes not listed here are not considered ready for use).

Most nodes have a help description, and input tooltips, that show show up when hovering over the "?"-icon and socket input respectively.

Node name Inputs Outputs Description
IFC Create Entity - Names
- Descriptions
- IfcClass
- Representations
- Locations
- Properties
- Entities Ids Create IFC Entity. Takes one or multiple inputs.
If 'Representation(s)' is given, that determines number of output entities. Otherwise, 'Names' is used.
IFC Read Entity - Entity Id - Id
- is_a
- Other entity attributes (dynamic)
Decompose an IfcEntity into its attributes. Takes one entity id as input, returns attribute values.
IFC BMesh to IFC Repr - Context type
- Context identifier
- Target View
- Blender Objects
- Representations
- Locations
Blender mesh to IfcShapeRepresentation. Takes one or multiple geometries.
Deconstructs joined geometries and creates a separate representation for each.
IFC Sverchok to IFC Repr - Context type
- Context identifier
- Target View
- Vertices
- Edges
- Faces
- Representations Sverchok geometry to IfcShapeRepresentation. Takes one or multiple nested lists of inputs.
IFC Create Blender Shape - Entity Id(s) - Blender Object(s) Create Blender shape from IfcEntity Id. Takes one or multiple IfcEntity Ids.
Creates shapes in scene and returns them in output socket.
IFC Add Spatial Element - Names
- IfcClass
- Elements
- Entity Id(s) Add IfcElements to an IfcSpatialElement. Takes one or multiple nested lists of inputs.
Input can also be a (list of) spacial elements to be aggregated.
IFC Write File - path Writes active Ifc model to path.
N.B.! It's recommended to use the 'Write File' panel under the "IfcSverchok" tab instead.
IFC Class Picker - IfcProduct (from drop-down)
- IfcClass (from drop-down)
- IfcClass Pick an IfcClass from drop-down list.
IFC By Id - Id - Entities Get IfcElement by step id. Takes one or multiple step ids.
IFC By Guid - Guid - Entities Get IfcElement by guid. Takes one or multiple guids.
IFC By Type - IfcProduct (from drop-down)
- IfcClass (from drop-down)
- Custom IfcClass
- Entities
- Entity Ids
Get IFC element(s) in file by type. Pick an IfcProduct and an IfcClass or give a custom IfcClass.
IFC Add Pset - Name
- Properties
- Element Ids
- (Pset) Entities Add a property set and corresponding properties, in a JSON key:value format, to IfcElements.
IFC Generate Guid - Guid Generate a unique GUID.
IFC Get Property - Entity Ids
- Pset name
- Prop name
- Value Get the value of a property of an IfcEntity. Can take multiple entity ids.
IFC Get Attribute - Entity Ids
- Attribute Name
- Value Get the value of an attribute of an IfcEntity. Can take multiple entities.

IfcSverchok panel

IfcSverchok creates a "IfcSverchok" tab in the Nodes panel. It includes a "Re-run all nodes" button that creates a fresh IFC File and a "Write File" button. It's recommended to re-run all nodes before saving the file either through the panel or the "Write File" node. Re-running creates a fresh IFC model, and removes all the duplicated/unneeded IfcElements that were created while building the model.

I'd love to hear it if anybody decides to give them a go or any other comments. :)
Thanks again to @Moult and @aothms for the help and support throughout.

NigelJanFAceaothmsJesusbillRaphaëlVouillozpeperiberaCoentheoryshawbitacovirand 8 others.

Comments

  • All, I encourage you to do try it out. This will be or is an excellent tool in your workflows. Use it as BlenderBIM's best friend to streamline repetitive tasks or bringing conceptual parametric designs right into other tools by the power of IFC. Let us know your thoughts and feedback.

    @mdjska it has been fun to see this project unfold. Best of luck in the future!

    AceJesusbillCoenmdjskapeperibera
  • I have to say I am very excited by this ! I'd be thrilled to test it out but I can't enable the addon. I don't know if this message fits better here or on the github tracker but I am experienced with blender addons and I still can't use it after half an hour of poking around, so I guess this is a feedback on the installation process. :)

    I followed the installation notice in the github readme.
    The link to download the ifcsverchok as a packaged addon links to the blenderbim addon download page, and the sverchok module isn't part of the lib/site/packages that are included in this download. (at least for windows). Even if it was, I think it would be more straightforward if the ifcsverchok addon was available for download directly as a .zip standalone.

    Also, the blenderbim installation docs leads to a 404.

    So I managed to install the blenderbim addon and sverchok addons alright, but then if I try to enable ifcsverchok I get an error :

    from sverchok.menu import SverchNodeItem, SverchNodeCategory, register_node_panels
    ModuleNotFoundError: No module named 'sverchok.menu'
    

    After digging a bit in the sverchok files, there appears to be no "menu" submodule in there, so I think it's referring to a different version from what I downloaded ?

    I would of course be happy to help streamline this process in any way if need be. Cheers

    Acemdjska
  • Hi, thanks for testing. The project isn't merged yet, and yea, the information about packaged installation isn't updated yet. It will soon, maybe @Moult has to help me with that.
    I looked into the other issue, and yes, Sverchok did some refactoring of the node menu and removed the menu.py module 3 weeks ago (https://github.com/nortikin/sverchok/commit/c9f47009929ea4f3addb881cd760ae4112c6e78c#diff-9633182b5bc44116a1dad564c96a21924ed7c84ac01a1ef272575d164a3a4703). I'll take a look at updating IfcSverchok to fit the new version later today or tomorrow.

    Ace
  • So happy to see this and will test it out as soon as possible!

    mdjska
  • This is awesome! I'll be testing it soon.

    mdjska
  • edited November 2022

    @Gorgious @kaiaurelienzh @brunopostle Hi, on a second look, the changes made in Sverchok are not part of any release yet, and the official Sverchok 1.1.0 release uses the menu.py method. So I think, I'll be good to wait with the changes until the official Sverchok 1.2 release?
    Anyway, I tried installing IfcSverchok normally as a .zip (I just zipped the project from github) on Blender 3.0.0 and 3.2.0 with Sv 1.1.0 and it worked fine. Could you try and tell me if you get any issues? :)

    kaiaurelienzh
  • @mdjska Congratulations! Great tool!
    But, with the attached zip it installs but does not activate.

    Too bad, I really want to try it. :(
    Windows11
    Python 3.10
    Blender 3.3
    sverchock 1.1

  • @mdjska It makes sense. :) In the meantime I think it would be nice to tweak the readme to not redirect to the sverchok installation guide which points to the development branch on github. @walpa Just to be clear you should download this version of sverchok :

    https://github.com/nortikin/sverchok/releases/download/v1.1.0/sverchok-1_1_0.zip

    I you installed a previous version, disable it. Close and open blender, remove the addon. Close and open blender, install the 1.1.0 version. I managed to install it on V.3.3 and it seems to work.

    A "Hello World" node tree would be nice to get newcomers started I guess :)

  • @Gorgious I corrected the links in the readme. The idea was that the example project could be used as a "hello world". Or what do you think would be nice to show apart from that?
    @walpa Yea, this looks like the error you get when trying to install with Sverchok 1.2

  • @mdjska Hehe well the idea of a hello world is like "what's the simplest most basic thing you can make the program do ?". Just to get a feeling of how it works and how things are tied together on the surface. I think bbim's Creating an IFC model docs which takes the user by hand to make an IfcWall shaped like a cube is nice, it would (IMHO) be great to have the same for ifcsverchok.

    I know some people who might be interested in visual programming but run away when they see a full-on node tree with nodes and noodles evrywhere.

    Nonetheless the example file looks like it will be invaluable when the user wants to dig a little deeper.

  • Great! Working! Thanks @Gorgious and @mdjska
    I agree, a little tutorial would be welcome. I'm having a little trouble understanding how to assign to the project and save the ifc file, but I'll keep trying. :)

    peperibera
  • Ok, thanks for the feedback, I'll look into making a simpler tutorial. :)
    The project is automatically created in the background and is assigned when the file is saved. So is a default building and site if you haven't created them. You can create your own building and site with the "add spatial element" node, but it's right now not possible to create your own project (since it would create two IfcProjects in the file and give errors on import). To save you can just use the "Write File" button in the "IfcSverchok" panel shown here https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#saving-the-model. I hope you'll get it to work :)

  • @mdjska Ok, I got it.
    Hehe, I'm moving forward...
    Some points I managed to achieve:

    1 - Creating the project with the nodes didn't work the way I tried

    I'm doing something wrong...

    2 - The elements do not appear in the outliner panel or updated in the properties panel, but the IFC file is created (with 'WRITE FILE') with the correct assignments
    IFCBUILDINGSTOREY --> IFCBUILDING --> IFCSITE --> IFCPROJECT

    3 - If an IFCPROJECT is created by the property panel method and then "updated" with WRITE FILE with the same name, the ifc file is overwritten

    4 - I did not identify a way to create the relationship between an entity (slab_test) and the IFCBUILDINGSTOREY

    Thanks

  • @walpa thanks for testing :)
    1. I should probably make it clearer but Ifc create file and Ifc create project nodes are not part of this release/shouldn't be used. Only the nodes listed in the table above (or here https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#nodes) are. I just didn't want to delete them before the project is merged.
    2. Elements appearing in the outliner panel or in the properties panel are BlenerBIM functionalities. The IFC file created by IfcSverchok is not automatically connected with BlenerBIM, so you'd have to actually load the file in the BlenderBIM panel for it to show up.
    3. Yes, writing a new file will overwrite it. The "write file" node has a warning about it, I should add one to the panel also. Or have some logic that makes a new one with added number at the end.
    4. IfcBuildingStorey is a spatial container and should be added with a "add spatial element" node like shown here https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#create-storeys-and-building and then the entities (eg. IfcSlab) goes into the "Elements" socket.
    Hope it helps!

  • @mdjska Thanks for the quick response! It's helping a lot! :)
    Sorry for the newbie questions... I'm a bit lazy and didn't look closely at the example.
    To make it a little clearer for new users who are also going to try it, I'd like to suggest a few changes to the README:

    Nodes
    https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#nodes
    "WARNING : Only the above nodes are functional, nodes A, B, C... in the IfcSverchok list should not be used (yet)."

    Opening The Created IFC Model
    https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#opening-the-created-ifc-model
    To see the project reflected in the outliner load or import the ifc file, as shown in https://youtube.com/watch?v=NmKCKTe2XnI

    Saving the model
    https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok#saving-the-model
    I didn't explicitly see any warnings about overwriting the file. Either using the button on the side panel or using the "write file" node.
    WARNING : "Write File" overwrites the ifc file with the current node network parameters. Any parameter changes in the outliner or in the properties panel, even if saved in the file, will be lost when "Write File" is used.

  • Some thoughts...
    The workflow with automatic creation of IFProject/IfcSite is a good solution for most use cases, but it may have some limitations, e.g.:
    1 - rename these elements
    2 - create other IfcSite's (I tried with the Add Spatial Element node, but I couldn't make it work)
    3 - Assigning elements to IfcProject, such as element type libraries, IfcWorkPlan's, etc..

  • Yes, there are changes in menu!!!
    Sorry for silent chnages, guys. Shame for us

  • edited November 2022

    Great! Got it working, I'm very excited.
    A question: is it possible to add more representations to an Element? I managed to create an Element with a Model and one with a Plan rep correctly, but since the number of reps dictates the number of elements it just generates two separate elements.

    Edit: Never mind, figured it out, I just had to join the lists correctly. I just really didn't expect this to work, brilliant!

  • edited March 2023

    A little late to the party, but I got the chance to test IfcSverchok and it looks awesome! It is already very powerful. I managed to get every element in its respective ifc storey.
    Here I used a model I created from one of @victorklixto's tutorials
    I hope I can do some more testing in the next few days

    nikitronAceCoenvictorklixtomdjskaOwura_qubitacovir
  • edited July 2023

    I want to try my hands on IfcSverchok seeing the promise it holds but when I click the download link "Download IfcSverchok here" on GitHub page https://github.com/mdjska/IfcOpenShell/tree/v0.7.0/src/ifcsverchok it downloads file ifcsverchok-230107.zip of a file size of 49KB.
    Then I saw this post;

    @Gorgious said:

    @walpa Just to be clear you should download this version of sverchok :

    But when I tried to install this version this is the error I get below;

    What am I not doing right, or is there a bug in the 'sverchok.core'. Thanking you in anticipation.

  • Have you tried with the latest version of Sverchok?

  • edited July 2023

    @Moult said:
    Have you tried with the latest version of Sverchok?

    Yes downloaded it yesterday and tried both sverchok-1_2_0.zip and sverchok-master.zip of file size 7.9MB aand 8MB respectively but same error.

  • edited July 2023

    Hi @Owura_qu
    I got a similar result, is that a coincidence or the start of a trend? (version 1.2.0)
    Traceback (most recent call last):
    File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\modules\addon_utils.py", line 333, in enable
    mod = import(module_name)
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0__init__.py", line 113, in
    imported_modules, node_modules, core = import_sverchok()
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0__init__.py", line 100, in import_sverchok
    imported_modules_ = core.init_architecture()
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0\core__init__.py", line 128, in init_architecture
    import_all_modules(imported_modules, mods_bases)
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0\core__init__.py", line 100, in import_all_modules
    import_modules(mods, base, imported_modules)
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0\core__init__.py", line 63, in import_modules
    im = importlib.import_module('.{}'.format(m), base)
    File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\importlib__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "C:\Users############\Blender\3.6\scripts\addons\sverchok-1_2_0\dependencies.py", line 167, in
    import numba
    File "C:\Users############\Python\Python310\site-packages\numba__init__.py", line 42, in
    from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
    File "C:\Users############\Python\Python310\site-packages\numba\np\ufunc__init__.py", line 3, in
    from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
    File "C:\Users############\Python\Python310\site-packages\numba\np\ufunc\decorators.py", line 3, in
    from numba.np.ufunc import _internal
    SystemError: initialization of _internal failed without raising an exception

    Owura_qu
  • The following worked for me:
    1. Update Sverchok:

    1. Don't use the release from ifcsverchok, but make a zipfile from: https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifcsverchok
    bruno_perdigaoGorgiousbitacovir
  • Trying to install with the configuration: sverchok-1_2_0 + ifcsverchok-230704
    displays the error:

  • edited August 2023

    @walpa I think it's some problem with the build "ifcsverchok-230704" - it was using some older WIP version...
    I've created a new build from the last commit, the error is fixed there (we also updated the latest build on the ifc sverchok page).

  • @Andrej730 Works fine! Thanks

Sign In or Register to comment.