Sloped walls Gables

Hello everyone,

Getting more and more into ifcopenshell.api and it's really fantastic!!
But I ran into one issue that I can't manage to solve.
How can I create sloped walls (for roof spaces or gables) like in the image:

What I use for making walls is something like this:

def convert_wall_to_ifc_wall(ifcfile, sb, body, storey, points, height=0):
    wall = ifcopenshell.api.run("root.create_entity", ifcfile, ifc_class="IfcWall", name="Wall")
    profile = sb.polyline(points)
    extruded_solid = sb.extrude(profile, magnitude=height, position=mathutils.Vector((0.0, 0.0, 0.0)), extrusion_vector=mathutils.Vector((0.0, 0.0, 1.0)))
    representation = sb.get_representation(body, extruded_solid)
    ifcopenshell.api.run("geometry.assign_representation", ifcfile, product=wall, representation=representation)
    ifcopenshell.api.run("spatial.assign_container", ifcfile, relating_structure=storey, product=wall)
    ifcopenshell.api.run("geometry.edit_object_placement", ifcfile, product=wall)

Is it possible to adapt this logic so different points of the profile polyline get extuded by different magnitudes?
Thank you in advance!

Comments

  • I would think creating the geometry for the IfcWall with an IfcExtrudedAreaSolid with a custom profile?
    http://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifcgeometricmodelresource/lexical/ifcextrudedareasolid.htm

    Here is an example with an IfcRectangleProfileDef

    Is it possible to adapt this logic so different points of the profile polyline get extuded by different magnitudes?

    Dont know if my solution would fit your usecase, maybe someone has a better idea....

    jemanik
  • edited July 2023

    Is the use of clipping planes just possible with add_wall_representation?
    And how could one go for sloped surfaces like for pitched roofs?

    The polylinemethod of ShapeBuilderclass just takes points in 2d space (without z-values)

    sb = ifcopenshell.util.shape_builder.ShapeBuilder(ifcfile)
    slab = ifcopenshell.api.run("root.create_entity", ifcfile, ifc_class="IfcSlab", name="Slab")
    profile = sb.polyline(pts)
    extruded_solid = sb.extrude(profile, magnitude=slab_thickness, position=mathutils.Vector((0.0, 0.0, 0.0)), extrusion_vector=mathutils.Vector((0.0, 0.0, -1.0)))
    
  • @jemanik pitched roofs would typically use an extrusion direction that isn't (0, 0, 1) but instead some other vector. Then the entire roof itself would be sloped too via the object placement.

    Note that you can often try modeling these things in the BlenderBIM Add-on then use the built-in debugger (like a web HTML inspector except for IFC) to see exactly how geometry is formed :)

    jemanik
  • Yes, if the extrusion vector isn't (0, 0, 1) I understand.
    But how could I go if I do want (0, 0, 1) as extrusion vec - so exactly like in the image you posted?

    And thanks for the hint with the debugger!
    Where can I find it?
    I downloaded Blender BIM but couldn't see it neither there nor in the documentation.

  • @jemanik you cannot have (0, 0, 1) as the extrusion vector. It's not possible if you want the profile to be the slab profile and the slab is sloped.

  • Thanks @Moult
    What worked for me was:

    • having relative points for the roof surface (starting from 0,0,0) projected to the xy-plane
    • making a slab and extruding it depending on the roof inclination

      rotation_matrix = Matrix.Rotation(np.radians(90 - inclination), 4, 'X')
      rotated_vector = rotation_matrix @ mathutils.Vector((0, 1, 0))
      extrusion_dir = (float(rotated_vector[0]), float(rotated_vector[1]), float(rotated_vector[2]))

    • doing two rotations and one translation with edit_object_placement to get it back to its correct position

    A lot of fiddling but it works

  • edited July 2023

    @Moult said:
    @jemanik pitched roofs would typically use an extrusion direction that isn't (0, 0, 1) but instead some other vector. Then the entire roof itself would be sloped too via the object placement.

    Is it possible if me to add a new slab with createIfcExtrudedAreaSolid with non standard placement (for example, dir1 = (0.0, 0.41, 0.91))? I have 4 trapezoids (each with four 3d coordinates) on a roof. And I would like to add this slab to a building. Can I create it with the following way?

    slab_placement = create_ifclocalplacement(ifcfile, relative_to=storey_placement)
    slab_solid = ifcfile.createIfcExtrudedAreaSolid(ifcclosedprofile, create_ifcaxis2placement(ifcfile, dir1=new_dir1), 
                                                        ifcfile.createIfcDirection(new_dir1), thickness)
    shape_representation = ifcfile.createIfcShapeRepresentation(context, 'Body', 'SweptSolid', [slab_solid])
    product_shape = ifcfile.createIfcProductDefinitionShape(None, None, [shape_representation])
    

    If I use this way, I'll have slabs in different places

    Opus
Sign In or Register to comment.