Door type manager previews

Hi,
Is it possible to regenerate Door Type manager preview images of doors?
I've lost almost all of mine in my ifc file. There is now about 22 door types already and they are non parametrical (but not complex). I can still use them but losing those thumbnails is bugging me. I was hoping to find a patch or something that could regenerate them but couldn't find any.

Comments

  • @Samppa What OS and Bonsai version do you use? I used to have a similar behaviour but is almost not longer happening in Linux or Windows with Bonsai v0.8.2 - alpha250403
    You can try to call operator bpy.ops.bim.load_type_thumbnails()

    Maybe if this is a recurring issue an entry should be added to the type manager:

    You can refer to https://docs.bonsaibim.org/guides/development/hello_world.html#submitting-code-to-git to submit an update like that:

    Thanks!

  • @falken10vdl Thank you, my Bonsai version is now v0.8.2 250402, but project was initially started with v0.8.1 stable.
    Tried to update thumbnails with given call, but it didn't recreate them unfortunately.
    There is also some funny business going on with how the type manager switches pages when I for example type "10" in the search field and then select a door type from say page 2/3 and the type manager switches to page 3/3 instantly when the door type is clicked. And also quite often type manager always reverts back to one specific door type which I haven't even used for awhile. Think I have to pay attention to this behaviour and then file a bug when I figure out how to really repeat this constantly.
    I also keep a separate door creation ifc file which I use as a library for doors. Doors are created and modified there and then imported to main file via Project Library. Wish there could be a way to re-import a modified door type to main file and make it regenerate the existing types in it. Wonder what makes a door type unique in project because sometimes just changing its name in my door creation Ifc file is not enough to make it appear in Project Library with possibility to "Append Library Element" (the small paperclip-icon).

  • edited April 4

    @Samppa That is unfortunate. Do you have an ifc file you can share where this is happening?
    Thanks!

  • edited April 4

    @Samppa Maybe you can try this one instead (not load but update)

        import bpy
        from bpy import data as D
        from bpy import context as C
        from mathutils import *
        from math import *
        import bonsai.tool as tool
        model = tool.Ifc.get()
        door_types = model.by_type("IfcDoorType")
        for door_type in door_types:
                tool.Model.update_thumbnail_for_element(door_type, refresh=True)
                print(f"GlobalId: {door_type.GlobalId}, Name: {door_type.Name}, Description: {door_type.Description} . Thumbnail updated")
    

    If that works, then maybe that can be added, so when one clicks the gear of the corresponding type.

    It calls update_thumbnail_for_element

    Update ui.py So clicking the gear also updates the thumbnail #6503

    Regards!

  • edited April 4

    @Massimo Is it possible to link IfcElementTypes?
    The project Library is able to append IfcElementTypes to the current project and the link IFC is able to link the IfcElements if I am not mistaken.
    If I understand correctly to @Samppa , he is after linking IfcElementTypes.
    Regards!

  • edited April 4

    FWIW it is advised against modifying the data state (eg call an operator) while inside a UI draw method, for performance reasons because it is called dozens of times per second and because it might simply lead to a crash.

  • @Gorgious Thanks for the info! I sincerely go and hack something fast without knowing the basis of how the addon works.
    Starting to learn ;)
    Thanks!

  • @Gorgious Correct way would be to implement something like this?

    op = layout.operator("bim.update_thumbnail", icon="FILE_REFRESH")
    op.element = props.menu_relating_type_id
    

    Thanks!

  • @falken10vdl i don't think so but i'm don't know too much about it...
    It is possible anyway to load a type from another library

  • edited April 7

    @Gorgious Correct way would be to implement something like this?

    op = layout.operator("bim.update_thumbnail", icon="FILE_REFRESH")
    op.element = props.menu_relating_type_id
    

    Thanks!

    @Gorgious said:
    FWIW it is advised against modifying the data state (eg call an operator) while inside a UI draw method, for performance reasons because it is called dozens of times per second and because it might simply lead to a crash.

    Here a possible way of doing it adding outside of the draw method:


    "

    Added entry in type menu to call for a thumbnail refresh #6517
    Thanks!

    MassimoduarteframosSamppaJohn
  • This looks promising! Hope this will find its way to next release!

    falken10vdl
  • BTW if anybody else is also having thumbnail issues on MacOS or Linux, please also try upgrading to Blender 4.4.1 which just came out. Upstream has fixed some glitchy behaviour.

    carlopavzoomer
Sign In or Register to comment.