OSArch Community

blenderBIM window list with global orientation

  1. H

    Hi everyone,

    I´m using blenderbim quite often for energy calculations. In this process I currently use a combination of blenderbim - Sketchup and other methods.

    One of my main tasks for my evaluation is to get correct window informations.

    I use ifc2csv to get a complete window list with Heigth | Width etc. What I am not able to obtain is the global orientation of the window (to asses the solar energy gain).

    I found Python code snippets in an earlier post

    https://community.osarch.org/discussion/1026/ifcwindow-normal-according-to-world

    Does someone know a way to combine ifc2csv with Python code or a similar approach?

    Regards Hannes

  2. A

    I think the simple way to combine them would be to write a script to calculate the orientation and save it to some property set and then access it from ifc2csv.

  3. M
  4. H

    Thank you Andrej730 and Moult for your quick response.

    As I'm more a civil engineer than a programmer forgive my maybe silly questions

    I tried to execute the ifcopenshell commands in blenders Python console but could not get a result

    
    >>> import ifcopenshell.util.placement
    
    >>> 
    
    >>> window = model.by_type("IfcWindow")[0]
    
    Traceback (most recent call last):
    
      File "<blender_console>", line 1, in <module>
    
    NameError: name 'model' is not defined
    
    
    >>> 
    
    >>> matrix = ifcopenshell.util.placement.get_local_placement(window.ObjectPlacement)
    
    Traceback (most recent call last):
    
      File "<blender_console>", line 1, in <module>
    
    AttributeError: 'Context' object has no attribute 'ObjectPlacement'
    
    
    >>> 
    
    >>> print(matrix[:,3][:3])
    

    Is there a possibility to execute the commands in the Python console of Blender?

    What I would like to find is

    • search the IFC Datastructure with BlenderBIM methods (IFC Search, point and click ...)

    • then execute the proposed script from inside blender on the search filter

    • write custom property set back to the search

    • execute IFC2CSV

    many thanks for your time

  5. H

    Hi again,

    I was able to get some way

    with the following code in the Blender Python console

    
    >>> for object in bpy.data.objects:
    
    ...     print (f"{object.name} has normal vector {object.matrix_world.col[1].to_3d()} and location {object.location}")
    

    I get a somewhat usable list

    
    IfcWindow/Fenster-011.017 has normal vector <Vector (1.0000, 0.0000, 0.0000)> and location <Vector (3508.8879, -494.1635, 3.8000)>
    
    IfcWindow/Fenster-011.018 has normal vector <Vector (1.0000, 0.0000, 0.0000)> and location <Vector (3508.8879, -489.1644, 3.8000)>
    
    IfcWindow/Fenster-011.019 has normal vector <Vector (1.0000, 0.0000, 0.0000)> and location <Vector (3508.8879, -489.1644, 3.8000)>
    
    IfcWindow/Fenster-011.020 has normal vector <Vector (1.0000, 0.0000, 0.0000)> and location <Vector (3508.8879, -494.1635, 3.8000)>
    
    IfcWindow/Fenster-011.021 has normal vector <Vector (-1.0000, 0.0000, 0.0000)> and location <Vector (3516.6328, -493.8635, 3.8000)>
    

    For me this can be a good start, but it is the complete list of objects in the file.

    What I now would like to achieve is to use a filtered and selected list from blenderbim

    select this list in the console

    
    >>> for selected_object in bpy.context.selected_objects:
    
    ...     print (f"{selected_object.name} has normal vector {selected_object.matrix_world.col[1].to_3d()} and location {selected_object.location}")
    

    and I get the filtered list!!!

    My next steps would be

    • add custom pset from Python console to selected_objects (any hints how to)

    • add normal vector to pset

    • ifc2csv

  6. H

    Happy New Year,

    I´ve been busy before the holiday season and therefore was not able to nail down some points.

    I tried to get the GUID with the python script

    
    import blenderbim.tool as tool
    
    for selected_object in bpy.context.selected_objects:
    
    print (f"{selected_object.name} ; has normal vector ; {selected_object.matrix_world.col[1].to_3d()} ; and location ; {selected_object.location} ; height ; {selected_object.BIMWindowProperties.overall_height} ; width ; {selected_object.BIMWindowProperties.overall_width} ; type; {selected_object.BIMWindowProperties.window_type} ; GlobalId ; {tool.Ifc.get_entity(bpy.context.selected_objects[0]).GlobalId}")
    

    But I´m getting a list with the Windows, orientations, positions but only the first overall_heigth, overall width, window_type and GlobalId?

    
    IfcWindow/Element ohne Kämpfer:FET 1-tlg - ML 1100 x 2570 - FB ; has normal vector ; <Vector (-0.0000, -1.0000, 0.0000)> ; and location ; <Vector (19.7464, 1.1184, -0.2000)> ; height ; 0.8999999761581421 ; width ; 0.6000000238418579 ; type; SINGLE_PANEL ; GlobalId ; 04BQj6$jz1Oh70$fH7F2rh
    
    IfcWindow/Element ohne Kämpfer:FET 2-tlg - ML 2100 x 2570 - FB ; has normal vector ; <Vector (-0.0000, -1.0000, 0.0000)> ; and location ; <Vector (12.3864, 1.1184, -0.2000)> ; height ; 0.8999999761581421 ; width ; 0.6000000238418579 ; type; SINGLE_PANEL ; GlobalId ; 04BQj6$jz1Oh70$fH7F2rh
    
    IfcWindow/Element ohne Kämpfer:FET 2-tlg - ML 2100 x 2570  ; has normal vector ; <Vector (-0.0000, -1.0000, 0.0000)> ; and location ; <Vector (9.5864, 1.1184, -0.2000)> ; height ; 0.8999999761581421 ; width ; 0.6000000238418579 ; type; SINGLE_PANEL ; GlobalId ; 04BQj6$jz1Oh70$fH7F2rh
    
    IfcWindow/Element ohne Kämpfer:FET 2-tlg - ML 2100 x 2570 .001 ; has normal vector ; <Vector (-0.0000, -1.0000, 0.0000)> ; and location ; <Vector (6.5864, 1.1184, -0.2000)> ; height ; 0.8999999761581421 ; width ; 0.6000000238418579 ; type; SINGLE_PANEL ; GlobalId ; 04BQj6$jz1Oh70$fH7F2rh
    
    

    Somehow I missed something. Can someone guide me to my error?

    Hannes

  7. A

    @hannes said:

    {tool.Ifc.get_entity(bpy.context.selected_objects[0]).GlobalId}

    Try this as tool.Ifc.get_entity(bpy.context.selected_object).GlobalId ie without indexing as selected_objects[0]

Login or Register to reply.