[BlenderBIM] & IfcOpeningElements

2»

Comments

  • @aothms it's been definitely very interesting to learn! I'll polish it a bit and publish a Jupyter Notebook, which I think can be also valuable to people learning the high level Python API today.

    @Moult for now, here's a snippet of the roof creation, and the current IFC is attached:

    roof = ios.root.create_entity(file, ifc_class='IfcRoof', name='Roof', predefined_type='GABLE_ROOF')
    ios.spatial.assign_container(file, product=roof, relating_structure=storey)
    roof_representation_south = ios.geometry.add_wall_representation(
        file, context=body, length=roof_size.x, height=(storey_size.y / 2 + wall_thickness + roof_ledge.y), 
        thickness=roof_thickness, x_angle=(180 - roof_angle) * np.pi/180
    )
    roof_representation_north = ifcopenshell.util.element.copy_deep(file, roof_representation_south)
    roof_downward_offset = (roof_ledge.y + wall_thickness / 2) * np.tan(roof_angle * np.pi / 180)
    
    south_roof = ios.root.create_entity(file, ifc_class='IfcSlab', name='South roof', predefined_type='ROOF')
    ios.geometry.assign_representation(file, product=south_roof, representation=roof_representation_south)
    ios.geometry.edit_object_placement(
        file, product=south_roof, matrix=placement_matrix(
            [-roof_size.x / 2, -roof_ledge.y - wall_thickness / 2, storey_size.z - roof_downward_offset], 
            z_local=[0., 1., 0.]
        )
    )
    
    north_roof = ios.root.create_entity(file, ifc_class='IfcSlab', name='North roof', predefined_type='ROOF')
    ios.geometry.assign_representation(file, product=north_roof, representation=roof_representation_north)
    ios.geometry.edit_object_placement(
        file, product=north_roof, matrix=placement_matrix(
            [
                roof_size.x / 2, 
                storey_size.y + 3 / 2 * wall_thickness + roof_ledge.y - roof_size.y / 2, 
                storey_size.z - roof_downward_offset + roof_size.z + roof_thickness / roof_angle_cos
            ], x_local=[-1., 0., 0.], z_local=[0., 1., 0.]
        )
    )
    
    ios.aggregate.assign_object(file, product=south_roof, relating_object=roof)
    ios.aggregate.assign_object(file, product=north_roof, relating_object=roof)
    

    The ios thing is just some artifact to avoid strings in ifcopenshell.api.run.

    Coenaothms
  • I'll polish it a bit and publish a Jupyter Notebook

    Feel free to put it here: https://github.com/IfcOpenShell/academy/tree/main/posts

    cvillagrasa
  • @cvillagrasa there are a number of validation issues with your model which you can run ifcopenshell.validate (or press the checkmark button in the debug panel in Blender). However the one related to your missing roof is that extruded area solids need to have a positive extrusion depth whereas you've given it a negative depth.

    By the way you might want to check out ifcopenshell.util.shape_builder :)

  • @aothms thanks a lot! I'll try to advance with it next week. At the moment I'm organizing it with an external Python module to shorten a bit the notebook, and also with a JavaScript file which uses IFC.js for viz (and all the Node.js things, bundle, etc.), so with all of that I don't know if it's better to fork your IfcOpenHouse repo and just place a markdown with a link on the academy repo.

    @Moult yeah, that's going to be caused by the weird angles in the snippet above. Tried to quickly change it and it seems to be improving... right?
    ??

    I did indeed see shape_builder, it looks great! but it's a bit lower level and requires more commands. At a higher level, to me add_wall_representation, add_slab_representation and add_profile_representation look more or less like the same thing, which construct an IfcExtrudedAreaSolid. Would it make sense to have a combined add_extruded_representation which returned an IfcShapeRepresentation and took rectangular width, depth, or alternatively a full IfcProfileDef? also with some options for cardinal point insertion, like add_profile_representation at the moment?

    By the way, one thing I wanted to achieve in the Jupyter environment is that when running a cell with say: entity = ios.root.create_entity(file, ifc_class='IfcWall'), and then regretting and re-running it with entity = ios.root.create_entity(file, ifc_class='IfcSlab'), the previous wall entity got handled from the file. I managed to achieve it with Python audit hooks and ifcopenshell.util.element.remove_deep2, but it's not reliable and it makes the kernel reload when removing certain representations (for instance, east/west walls in this model). It doesn't happen when overwriting other representations, like the roof ones. I've read a bunch of GH issues with some reported crashes and the creation of remove_deep2, and I get this can be complex, but it would be awesome to achieve that experimentation environment that Jupyter Notebooks provide, without having to rerun everything for any single change.


  • Where can I find the latest tutorial on how to update voids with the BlenderBIM add-on? I don't understand how to adjust the size.

  • This doesn't work :-(

  • @Coen said:

    This doesn't work :-(


    Spoke to soon, it works. just shoudn't rotate it in edit mode.

  • @Coen said:

    @Coen said:

    This doesn't work :-(

    Spoke to soon, it works. just shoudn't rotate it in edit mode.

    Spoke to soon again,
    How to modify the length as I have drawn with red arrows? I am compleltely clueless:

  • In edit mode you can only tweak the profile. Go back into object mode. I think this information may be available in the 3D viewport but you can go to the mesh properties, expand "Get Representation IFC Parameters" and tweak the value there.

    This will display a gizmo in the viewport that you can click'n'drag but I don't think it can be trusted blindly :)

    Coen
  • @Coen said:

    @Coen said:

    This doesn't work :-(

    Spoke to soon, it works. just shoudn't rotate it in edit mode.

    Spoke to soon again,
    How to modify the length as I have drawn with red arrows? I am compleltely clueless:

    Yes thank you! What a well hidden sneaky button ?

  • @cvillagrasa said:
    I'll polish it a bit and publish a Jupyter Notebook, which I think can be also valuable to people learning the high level Python API today.

    As a last reference in this thread, here's the new thread about the recreation of the IfcOpenHouse:
    https://community.osarch.org/discussion/1471/ifcopenhouse-step-by-step-tutorial-with-the-ifcopenshell-python-api

Sign In or Register to comment.