Skip to content

Commit 4257800

Browse files
committed
start dev on curved wall
1 parent 9241fee commit 4257800

File tree

1 file changed

+124
-3
lines changed

1 file changed

+124
-3
lines changed

src/ifcplus/api/built_element.py

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import ifcplus.api.material
3737
import ifcopenshell.util.representation
3838
from typing import cast
39+
import ifcplus.util.geometry
3940

4041
BUILT_ELEMENT_FRAME_MEMBER = Literal["IfcBeam", "IfcColumn", "IfcMember"]
4142

@@ -189,9 +190,6 @@ def create_opening_element(
189190
ifc4_file=ifc4_file,
190191
profile=profile,
191192
extrusion_depth=depth,
192-
# repositioned_origin=origin_relative_to_voided_element,
193-
# repositioned_x_axis=x_axis_relative_to_voided_element,
194-
# repositioned_z_axis=z_axis_relative_to_voided_element,
195193
)
196194

197195
representation_type = ifcopenshell.util.representation.guess_type(
@@ -359,6 +357,129 @@ def create_2pt_wall(
359357
return wall
360358

361359

360+
# def create_curved_wall(
361+
# point_of_curvature_2d: tuple[float, float],
362+
# point_on_center_of_curvature_side_2d: tuple[float, float],
363+
# point_of_tangency_2d: tuple[float, float],
364+
# elevation: float,
365+
# height: float,
366+
# materials: list[ifcopenshell.entity_instance],
367+
# thicknesses: list[float],
368+
# wall: ifcopenshell.entity_instance | None = None,
369+
# name: str | None = None,
370+
# parent: ifcopenshell.entity_instance | None = None,
371+
# place_object_relative_to_parent: bool = False,
372+
# ):
373+
# """Add straight IfcWall with IfcMaterialLayerSetUsage based on two points in
374+
# XY space."""
375+
376+
# ifc4_file = materials[0].file
377+
378+
# material_layer_set = ifcplus.api.material.add_material_layer_set(
379+
# materials=materials,
380+
# thicknesses=thicknesses,
381+
# name=None,
382+
# check_for_duplicate=True,
383+
# )
384+
385+
# wall_type = ifcplus.api.element_type.add_element_type_for_material_layer_set(
386+
# ifc_class="IfcWallType",
387+
# material_layer_set=material_layer_set,
388+
# name=material_layer_set.LayerSetName,
389+
# check_for_duplicate=True,
390+
# )
391+
392+
# if wall is None:
393+
# wall = ifcopenshell.api.root.create_entity(
394+
# file=ifc4_file,
395+
# ifc_class="IfcWall",
396+
# name=name,
397+
# predefined_type="NOTDEFINED",
398+
# )
399+
400+
# ifcopenshell.api.type.assign_type(
401+
# file=ifc4_file,
402+
# related_objects=[wall],
403+
# relating_type=wall_type,
404+
# )
405+
406+
# total_thickness = 0.0
407+
# for material_layer in material_layer_set.MaterialLayers:
408+
# total_thickness += material_layer.LayerThickness
409+
410+
# rel_associates_material = ifcopenshell.api.material.assign_material(
411+
# file=ifc4_file,
412+
# products=[wall],
413+
# type="IfcMaterialLayerSetUsage",
414+
# material=None, # inferred from assigned IfcElementType
415+
# )
416+
# material_layer_set_usage = cast(
417+
# ifcopenshell.entity_instance, rel_associates_material
418+
# ).RelatingMaterial
419+
# material_layer_set_usage.OffsetFromReferenceLine = -total_thickness / 2
420+
421+
# point_of_curvature_3d = (start_point_2d[0], start_point_2d[1], elevation)
422+
# end_point_3d = (end_point_2d[0], end_point_2d[1], elevation)
423+
# vector_from_start_point_to_end_point = np.array(end_point_3d) - np.array(
424+
# start_point_3d
425+
# )
426+
# length = float(np.linalg.norm(vector_from_start_point_to_end_point))
427+
428+
# representation_item = ifcplus.api.geometry.add_extruded_area_solid(
429+
# ifc4_file=ifc4_file,
430+
# profile=ifcplus.api.profile.add_arbitrary_profile_with_or_without_voids(
431+
# file=ifc4_file,
432+
# outer_profile=[
433+
# (0.0, 0.0 - total_thickness / 2),
434+
# (0.0 + length, 0.0 - total_thickness / 2),
435+
# (0.0 + length, 0.0 + total_thickness - total_thickness / 2),
436+
# (0.0 + length - length, 0.0 + total_thickness - total_thickness / 2),
437+
# (0.0, 0.0 - total_thickness / 2),
438+
# ],
439+
# inner_profiles=[],
440+
# name=None,
441+
# ),
442+
# extrusion_depth=height,
443+
# )
444+
445+
# representation_type = ifcopenshell.util.representation.guess_type(
446+
# items=[representation_item]
447+
# )
448+
449+
# shape_model = ifcplus.api.geometry.add_shape_model(
450+
# ifc4_file=ifc4_file,
451+
# shape_model_class="IfcShapeRepresentation",
452+
# representation_identifier="Body",
453+
# representation_type=cast(str, representation_type), # SweptSolid
454+
# context_type="Model",
455+
# target_view="MODEL_VIEW",
456+
# items=[representation_item],
457+
# )
458+
459+
# ifcopenshell.api.geometry.assign_representation(
460+
# file=ifc4_file,
461+
# product=wall,
462+
# representation=shape_model,
463+
# )
464+
465+
# if isinstance(parent, ifcopenshell.entity_instance):
466+
# ifcopenshell.api.spatial.assign_container(
467+
# file=ifc4_file,
468+
# products=[wall],
469+
# relating_structure=parent,
470+
# )
471+
472+
# ifcplus.api.placement.edit_object_placement(
473+
# product=wall,
474+
# repositioned_origin=start_point_3d,
475+
# repositioned_x_axis=tuple(vector_from_start_point_to_end_point.tolist()),
476+
# repositioned_z_axis=(0.0, 0.0, 1.0),
477+
# place_object_relative_to_parent=place_object_relative_to_parent,
478+
# )
479+
480+
# return wall
481+
482+
362483
def create_npt_slab(
363484
outer_profile: list[tuple[float, float]], # global XY
364485
elevation: float, # global Z

0 commit comments

Comments
 (0)