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 anIfcExtrudedAreaSolid
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
Dont know if my solution would fit your usecase, maybe someone has a better idea....
Keep the extrusion going up, but then apply a half space clipping plane. Use add_wall_representation like this https://blenderbim.org/docs-python/ifcopenshell-python/code_examples.html#create-a-simple-model-from-scratch and then specify clipping planes: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py#L36
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
polyline
method ofShapeBuilder
class just takes points in 2d space (without z-values)@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 :)
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:
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 positionA lot of fiddling but it works
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?
If I use this way, I'll have slabs in different places