[IfcSverchok] IFC Read File Does Not Read IFC Objects

Hello everyone,
I am trying to make sense of IfcSverchok. I love the concept and I think it's set out to be an amazing tool. But I can't get the hang of it. As can be seen below, I am trying to open the infamous Clothing Boutique IFC file and list IfcWall objects, but it just gets the file as an object. When I look into the old discussions people have successfully achieved this, but the node seems to have changed. Is there something that I am missing?

Sverchok Nodes

Tagged:
Ace

Comments

  • @atomkarinca I think this is not possible yet. It works mainly to create an IFC File, not to read. I'm guessing this because "IFC Read File" is not mentioned here as one of the nodes that has been tested

  • @bruno_perdigao thanks for the heads up. Indeed IFC Read File node is not mentioned in the link. The reason I thought it might be possible is that, @Moult seemed to achieve exactly this in the link that I shared. I looked at the earlier revisions of the node but I could not get a version with this feature. I guess I could achieve the same result with the API node, or write a node just to do that.

  • edited June 2023

    I have modified the "IFC Read File" node, this brings all the IfcProduct elements. This can be directly executed in Blender.

    import bpy
    import ifcopenshell
    import ifcsverchok.helper
    from sverchok.node_tree import SverchCustomTreeNode
    from sverchok.data_structure import updateNode
    
    class SvIfcReadObjects(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
        bl_idname = "SvIfcReadObjects"
        bl_label = "IFC Read Objects"
    
        def sv_init(self, context):
            self.inputs.new("SvStringsSocket", "path").prop_name = "path"
            self.outputs.new("SvStringsSocket", "objects")
    
        def process(self):
            self.sv_input_names = ["path"]
            super().process()
    
        def process_ifc(self, path):
            objects = ifcopenshell.open(path).by_type("IfcProduct")
            self.outputs["objects"].sv_set([[objects]])
    
    def register():
        bpy.utils.register_class(SvIfcReadObjects)
    
    def unregister():
        bpy.utils.unregister_class(SvIfcReadObjects)
    
    if __name__ == "__main__":
        cls = bpy.types.Node.bl_rna_get_subclass_py("SvIfcReadObjects")
        if cls:
            bpy.utils.unregister_class(cls)
        register()
        try:
            tree = next(t for t in bpy.data.node_groups if t.bl_idname == "SverchCustomTreeType")
        except StopIteration:
            raise LookupError("You should create Sverchok tree first")
        else:
            tree.nodes.new(SvIfcReadObjects.bl_idname)
    

    This is the result:

    I am trying to get it to sort according to IfcClass, if anyone else is interested.

Sign In or Register to comment.