OSArch Community

BlenderBIM spreadsheet writer for .xlsx and .ods

  1. G

    So if I understand correctly you can keep this file like this, remove your commented lines there and add a file named __init__.py in your subfolder spreadsheet_writer with this content :

    
    import bpy
    
    from . import ui, prop, operator
    
    
    classes = (
    
        prop.MyItem,
    
        prop.MyCollection,
    
        prop.BlenderBIMSpreadSheetProperties,
    
        operator.MyCollectionActions,
    
        operator.ConstructDataFrame,
    
        operator.WriteToXLSX,
    
        operator.WriteToODS,
    
        operator.FilterIFCElements,
    
        operator.UnhideIFCElements,
    
        ui.BlenderBIMSpreadSheet,
    
        ui.MyItem,
    
        ui.MyCollection,
    
        ui.MyCollectionActions
    
    )
    
    
    def register():
    
        # Here you can add your custom props to specific types eg bpy.types.Scene.my_custom_collection = bpy.props.PointerProperty(type=prop.MyCollection)
    
        pass
    
    
    def unregister():
    
        # Here you should delete your custom props eg del bpy.types.Scene.my_custom_collection
    
        pass
    

    Of course you'll need to populate ui.py, operator.py and prop.py inside your spreadhseet_writer subfolder

    -> Sidenote the convention is to write "spreadsheet_writer": None and not "spreadsheet_writer":None (notice the whitespace between : and None

  2. C

    @Gorgious

    Thanks for your help, still no succes so far.

    What I have done:

    in

    ..\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\bim\module\spreadsheet_writer module I have place the following scripts

    
     - __init__.py
    
    - operator.py 
    
    - prop.py
    
    - ui.py
    

    in this __init__.py I have placed the following code:

    
    import bpy 
    
    from . import ui, prop, operator 
    
    
    classes  = (
    
        prop.MyItem,
    
        prop.MyCollection,
    
        prop.BlenderBIMSpreadSheetProperties,
    
        operator.MyCollectionActions,
    
        operator.ConstructDataFrame,
    
        operator.WriteToXLSX,
    
        operator.WriteToODS,
    
        operator.FilterIFCElements,
    
        operator.UnhideIFCElements,
    
        ui.BlenderBIMSpreadSheet,
    
        ui.MyItem,
    
        ui.MyCollection,
    
        ui.MyCollectionActions
    
    )
    
    
    def register():
    
        pass
    
    
    
    def unregister(): 
    
        pass
    

    Then I went to:

    ..\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\bim modeule and opened the __init__.py there, I added the space after in "spreadsheet_writer": None,

    The file now looks this:

    
    # BlenderBIM Add-on - OpenBIM Blender Add-on
    
    # Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
    
    #
    
    # This file is part of BlenderBIM Add-on.
    
    #
    
    # BlenderBIM Add-on is free software: you can redistribute it and/or modify
    
    # it under the terms of the GNU General Public License as published by
    
    # the Free Software Foundation, either version 3 of the License, or
    
    # (at your option) any later version.
    
    #
    
    # BlenderBIM Add-on is distributed in the hope that it will be useful,
    
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    # GNU General Public License for more details.
    
    #
    
    # You should have received a copy of the GNU General Public License
    
    # along with BlenderBIM Add-on.  If not, see <http://www.gnu.org/licenses/>.
    
    
    import bpy
    
    import importlib
    
    from . import handler, ui, prop, operator, helper
    
    
    modules = {
    
        "project": None,
    
        "search": None,
    
        "bcf": None,
    
        "root": None,
    
        "unit": None,
    
        "model": None,
    
        "cad": None,
    
        "georeference": None,
    
        "context": None,
    
        "drawing": None,
    
        "misc": None,
    
        "attribute": None,
    
        "type": None,
    
        "spatial": None,
    
        "void": None,
    
        "aggregate": None,
    
        "geometry": None,
    
        "cobie": None,
    
        "resource": None,
    
        "cost": None,
    
        "sequence": None,
    
        "group": None,
    
        "system": None,
    
        "brick": None,
    
        "structural": None,
    
        "boundary": None,
    
        "profile": None,
    
        "material": None,
    
        "style": None,
    
        "layer": None,
    
        "owner": None,
    
        "pset": None,
    
        "qto": None,
    
        "classification": None,
    
        "library": None,
    
        "constraint": None,
    
        "document": None,
    
        "pset_template": None,
    
        "clash": None,
    
        "lca": None,
    
        "csv": None,
    
        "tester": None,
    
        "bimtester": None,
    
        "diff": None,
    
        "patch": None,
    
        "gis": None,
    
        "covetool": None,
    
        "augin": None,
    
        "debug": None,
    
        "spreadsheet_writer": None,
    
        # Uncomment this line to enable loading of the demo module. Happy hacking!
    
        # The name "demo" must correlate to a folder name in `bim/module/`.
    
        # "demo": None,
    
    }
    
    
    
    
    for name in modules.keys():
    
        modules[name] = importlib.import_module(f"blenderbim.bim.module.{name}")
    
    
    
    
    classes = [
    
        operator.AddIfcFile,
    
        operator.BIM_OT_add_section_plane,
    
        operator.BIM_OT_remove_section_plane,
    
        operator.ConfigureVisibility,
    
        operator.OpenUpstream,
    
        operator.OpenUri,
    
        operator.ReloadIfcFile,
    
        operator.RemoveIfcFile,
    
        operator.SelectDataDir,
    
        operator.SelectIfcFile,
    
        operator.SelectSchemaDir,
    
        operator.SelectURIAttribute,
    
        operator.EditBlenderCollection,
    
        operator.BIM_OT_open_webbrowser,
    
        operator.BIM_OT_show_description,
    
        prop.StrProperty,
    
        operator.BIM_OT_enum_property_search,  # /!\ Register AFTER prop.StrProperty
    
        prop.ObjProperty,
    
        prop.Attribute,
    
        prop.ModuleVisibility,
    
        prop.BIMProperties,
    
        prop.IfcParameter,
    
        prop.PsetQto,
    
        prop.GlobalId,
    
        prop.BIMObjectProperties,
    
        prop.BIMMaterialProperties,
    
        prop.BIMMeshProperties,
    
        ui.BIM_PT_section_plane,
    
        ui.BIM_UL_generic,
    
        ui.BIM_UL_topics,
    
        ui.BIM_ADDON_preferences,
    
        # Scene panel groups
    
        ui.BIM_PT_project_info,
    
        ui.BIM_PT_project_setup,
    
        ui.BIM_PT_collaboration,
    
        ui.BIM_PT_geometry,
    
        ui.BIM_PT_services,
    
        ui.BIM_PT_structural,
    
        ui.BIM_PT_4D5D,
    
        ui.BIM_PT_quality_control,
    
        ui.BIM_PT_integrations,
    
        # Object panel groups
    
        ui.BIM_PT_object_metadata,
    
        ui.BIM_PT_geometry_object,
    
        ui.BIM_PT_services_object,
    
        ui.BIM_PT_utilities_object,
    
        ui.BIM_PT_misc_object,
    
    
    
    ]
    
    
    for mod in modules.values():
    
        classes.extend(mod.classes)
    
    
    
    
    def on_register(scene):
    
        handler.setDefaultProperties(scene)
    
        if not bpy.app.background:
    
            bpy.app.handlers.depsgraph_update_post.remove(on_register)
    
    
    
    
    def register():
    
        for cls in classes:
    
            bpy.utils.register_class(cls)
    
        bpy.app.handlers.depsgraph_update_post.append(on_register)
    
        bpy.app.handlers.undo_pre.append(handler.undo_pre)
    
        bpy.app.handlers.undo_post.append(handler.undo_post)
    
        bpy.app.handlers.redo_pre.append(handler.redo_pre)
    
        bpy.app.handlers.redo_post.append(handler.redo_post)
    
        bpy.app.handlers.load_post.append(handler.setDefaultProperties)
    
        bpy.app.handlers.load_post.append(handler.loadIfcStore)
    
        bpy.app.handlers.save_pre.append(handler.ensureIfcExported)
    
        bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
    
        bpy.types.Object.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
    
        bpy.types.Material.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
    
        bpy.types.Material.BIMMaterialProperties = bpy.props.PointerProperty(type=prop.BIMMaterialProperties)
    
        bpy.types.Mesh.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
    
        bpy.types.Curve.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
    
        bpy.types.Camera.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
    
        bpy.types.PointLight.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
    
        bpy.types.SCENE_PT_unit.append(ui.ifc_units)
    
        if hasattr(bpy.types, "UI_MT_button_context_menu"):
    
            bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu)
    
    
        for mod in modules.values():
    
            mod.register()
    
    
    
    
    def unregister():
    
        for cls in reversed(classes):
    
            bpy.utils.unregister_class(cls)
    
        bpy.app.handlers.load_post.remove(handler.setDefaultProperties)
    
        bpy.app.handlers.load_post.remove(handler.loadIfcStore)
    
        bpy.app.handlers.save_pre.remove(handler.ensureIfcExported)
    
        del bpy.types.Scene.BIMProperties
    
        del bpy.types.Object.BIMObjectProperties
    
        del bpy.types.Material.BIMObjectProperties
    
        del bpy.types.Material.BIMMaterialProperties
    
        del bpy.types.Mesh.BIMMeshProperties
    
        del bpy.types.Curve.BIMMeshProperties
    
        del bpy.types.Camera.BIMMeshProperties
    
        del bpy.types.PointLight.BIMMeshProperties
    
        bpy.types.SCENE_PT_unit.remove(ui.ifc_units)
    
        if hasattr(bpy.types, "UI_MT_button_context_menu"):
    
            bpy.types.UI_MT_button_context_menu.remove(ui.draw_custom_context_menu)
    
    
        for mod in reversed(list(modules.values())):
    
            mod.unregister()
    

    But when restarting Blender I see BlenderBIM, but somehow I broke it.

    Can't make a new project

  3. G

    If you're on windows you can go to Window > Toggle System Console, there should be an error printed out there. You can copy / paste it here to troubleshoot it.

  4. C

    @Gorgious

    
    module changed on disk: 'C:\\Users\\cclaus\\AppData\\Roaming\\Blender Foundation\\Blender\\3.3\\scripts\\addons\\blenderbim\\__init__.py' reloading...
    
    Exception in module register(): C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\__init__.py
    
    Traceback (most recent call last):
    
      File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\scripts\modules\addon_utils.py", line 369, in enable
    
        mod.register()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\__init__.py", line 42, in register
    
        blenderbim.bim.register()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\bim\__init__.py", line 147, in register
    
        bpy.utils.register_class(cls)
    
    RuntimeError: register_class(...):, missing bl_rna attribute from 'type' instance (may not be registered)
    
    openpyxl 3.0.10 C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\openpyxl\__init__.py
    
    pandas 1.5.0 C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\pandas\__init__.py
    
    xlsxwriter 1.2.9 C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\libs\site\packages\xlsxwriter\__init__.py
    
    Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\bim\ui.py", line 260, in poll
    
        return tool.Ifc.get()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\tool\ifc.py", line 38, in get
    
        return IfcStore.get_file()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blenderbim\bim\ifc.py", line 78, in get_file
    
        IfcStore.path = bpy.context.scene.BIMProperties.ifc_file
    
    AttributeError: 'Scene' object has no attribute 'BIMProperties'
    
    Traceback (most recent call last):
    

    It's a cascade of errors, this is just a segment

  5. G

    I think you're missing registering the prop somewhere. depending on where you stored your props you may want something like

    
    bpy.types.Scene.bim_spreadsheet_properties = bpy.props.PointerProperty(type=prop.BlenderBIMSpreadSheetProperties)
    

    in register and

    
    del bpy.types.Scene.bim_spreadsheet_properties
    

    in unregister.

  6. C

    @Gorgious

    Many thanks! I managed to get it integrated locally with the BlenderBIM add-on on the BlenderBIM tab. I need to refactor the code a bit , clean the mess before making a pull request.

  7. G

    Hehe I'm glad you finally made it happen :) You can ping me on github for help in the process, or review when you manage to upload it.

    Cheers

  8. C
  9. A
  10. A

    Hey @Coen

    I am busy pulling some areas using your spreadsheet writer, brilliant again, but It's not getting the NetFloorArea, out of the Ifc Space? I tried to add it as a custom value as [Qto_SpaceBaseQuantities.NetFloorArea] but with no success:

    Blender:

    Spreadsheet (no area values except for the windows):

    Anything I'm getting wrong with he syntax here?

  11. C

    @Ace

    You should remove the brackets and add press the add button once more. Then it will export.

    also, on youtube someone asked me if these PropertySets could be saved as a searchset, but doesn't IFCCSV also does something similar?

  12. C
  13. P

    I was looking for something like this or to make something similair myself, just tested it on an ifc model and it works really good!

    Only thing I noticed is sometimes the values under base quantities are not the correct values, is there any way to extract the quantity from the element and not from a pset?

  14. C

    @Pahlawan

    You bumped this old thread, the new release is to be found here:

    https://github.com/C-Claus/blenderbim_spreadsheet

    The idea is this should be integrated with BlenderBIM one day...

    Only thing I noticed is sometimes the values under base quantities are not the correct values, is there any way to extract the quantity from the element and not from a pset?

    Do you have an example? Not the correct value or no value at all? If there is no value at all you could try this:

  15. P

    @Coen said:

    @Pahlawan

    You bumped this old thread, the new release is to be found here:

    https://github.com/C-Claus/blenderbim_spreadsheet

    The idea is this should be integrated with BlenderBIM one day...

    Only thing I noticed is sometimes the values under base quantities are not the correct values, is there any way to extract the quantity from the element and not from a pset?

    Do you have an example? Not the correct value or no value at all? If there is no value at all you could try this:

    Nice just tried it and it's working great.

    Here's an example:

    The NetArea value under BaseQuantities is 0,59m2

    The correct value is shown in the quantites tab, an Area of 3,28m2 (Solibri)

  16. C

    @Pahlawan

    Is it possible for you to share your IFC? Maybe @Massimo could shed some light on this...? I have no Solibri, so I can't validate.

  17. P

    @Coen said:

    @Pahlawan

    Is it possible for you to share your IFC? Maybe @Massimo could shed some light on this...? I have no Solibri, so I can't validate.

    Can't share the entire IFC, but I've extracted the object as an example.

  18. C

    @Pahlawan said:

    @Coen said:

    @Pahlawan

    Is it possible for you to share your IFC? Maybe @Massimo could shed some light on this...? I have no Solibri, so I can't validate.

    Can't share the entire IFC, but I've extracted the object as an example.

    Does not open in BlenderBIM for me:

    
    e 1293, in clean_mesh
    
        obj.select_set(True)
    
    RuntimeError: Error: Object 'IfcSlab/BORDES' can't be selected because it is not in View Layer 'ViewLayer'!
    
    Location: C:\Program Files\Blender Foundation\Blender 3.5\3.5\scripts\modules\bpy\ops.py:113
    

    nor in BIMVision:

  19. M

    Hello @Pahlawan i tried to open the ifc file you posted and i get this error

    Could you send me the entire ifc by email so i can check?

  20. M

    @Pahlawan Btw, if it helps, quantities are just another psets with attributes. The schema says that the pset name should be "Qto_Name BaseQuantities" so for a slab it should be "Qto_SlabBaseQuantites".

    BBim can calculate and assign automatically the quantities.

    So, regarding your example, is NetArea calculated automatically or is it given in another way (like typed or imported from another software)?

  21. P

    @Massimo said:

    @Pahlawan Btw, if it helps, quantities are just another psets with attributes. The schema says that the pset name should be "Qto_Name BaseQuantities" so for a slab it should be "Qto_SlabBaseQuantites".

    BBim can calculate and assign automatically the quantities.

    So, regarding your example, is NetArea calculated automatically or is it given in another way (like typed or imported from another software)?

    The basequantities are exported from Tekla.

    What's your e-mail?

  22. M

    @Pahlawan said:

    @Massimo said:

    @Pahlawan Btw, if it helps, quantities are just another psets with attributes. The schema says that the pset name should be "Qto_Name BaseQuantities" so for a slab it should be "Qto_SlabBaseQuantites".

    BBim can calculate and assign automatically the quantities.

    So, regarding your example, is NetArea calculated automatically or is it given in another way (like typed or imported from another software)?

    The basequantities are exported from Tekla.

    What's your e-mail?

    fabbro.massimo@gmail.com

    Are you in osarch chat?

  23. P

    @Massimo said:

    @Pahlawan said:

    @Massimo said:

    @Pahlawan Btw, if it helps, quantities are just another psets with attributes. The schema says that the pset name should be "Qto_Name BaseQuantities" so for a slab it should be "Qto_SlabBaseQuantites".

    BBim can calculate and assign automatically the quantities.

    So, regarding your example, is NetArea calculated automatically or is it given in another way (like typed or imported from another software)?

    The basequantities are exported from Tekla.

    What's your e-mail?

    fabbro.massimo@gmail.com

    Are you in osarch chat?

    Yes I am, using the same name, you?

  24. M

    @Pahlawan i managed to open your file from the console in BBim, without the graphical part (that seems to cause the problem).

    I saw that the IfcSlab element called 'BORDES' has a pset (typed as qto) assigned to it called "BaseQuantities".

    This pset has a property called 'NetArea' with the value '0.5854', that seems incorrect (or at least different from what BIMVision shows).

    I think this means that who created the model and assigned the quantities to it just have done it in a wrong way.

    With bbim you can correct these errors btw :-)

  25. P

    @Massimo said:

    @Pahlawan i managed to open your file from the console in BBim, without the graphical part (that seems to cause the problem).

    I saw that the IfcSlab element called 'BORDES' has a pset (typed as qto) assigned to it called "BaseQuantities".

    This pset has a property called 'NetArea' with the value '0.5854', that seems incorrect (or at least different from what BIMVision shows).

    I think this means that who created the model and assigned the quantities to it just have done it in a wrong way.

    With bbim you can correct these errors btw :-)

    For real? Is there a tutorial on how to fix these errors?

    Or do you mean to fix the ifc loading error with this ifc model, instead of fixing the wrong netarea values?

  1. Page 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6

Login or Register to reply.