Remove usage of .wrapped_item and some other fixes

This commit is contained in:
Thomas Krijnen
2026-01-10 11:01:18 +01:00
parent 5c9213426f
commit b66b04b001
55 changed files with 129 additions and 118 deletions
@@ -79,7 +79,7 @@ def _add_curve_segment_to_composite_curve(
if zero_length_segment:
settings = ifcopenshell.geom.settings()
segment_fn = ifcopenshell_wrapper.map_shape(settings, curve_segment.wrapped_data)
segment_fn = ifcopenshell_wrapper.map_shape(settings, curve_segment)
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
e = segment_evaluator.evaluate(segment_fn.end())
end = np.array(e)
@@ -97,7 +97,7 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg
# compute the end point matrix
settings = ifcopenshell.geom.settings()
segment_fn = ifcopenshell_wrapper.map_shape(settings, mapped_segment.wrapped_data)
segment_fn = ifcopenshell_wrapper.map_shape(settings, mapped_segment)
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
e = segment_evaluator.evaluate(segment_fn.end())
end = np.array(e)
@@ -144,7 +144,7 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg
end_referent.ObjectPlacement.RelativePlacement.Location.DistanceAlong.wrappedValue = start_dist_along
settings = ifcopenshell.geom.settings()
basis_curve = ifcopenshell.api.alignment.get_basis_curve(alignment)
curve_fn = ifcopenshell_wrapper.map_shape(settings, basis_curve.wrapped_data)
curve_fn = ifcopenshell_wrapper.map_shape(settings, basis_curve)
curve_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, curve_fn)
p = curve_evaluator.evaluate(start_dist_along * unit_scale)
p = np.array(p)
@@ -84,7 +84,7 @@ def add_stationing_referent(
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
settings = ifcopenshell.geom.settings()
fn = ifcopenshell_wrapper.map_shape(settings, basis_curve.wrapped_data)
fn = ifcopenshell_wrapper.map_shape(settings, basis_curve)
if basis_curve.is_a("IfcPolyline") or basis_curve.is_a("IfcIndexedPolyCurve"):
fn = ifcopenshell_wrapper.convert_loop_to_function_item(fn)
@@ -77,7 +77,7 @@ def add_zero_length_segment(file: ifcopenshell.file, layout: entity_instance, in
# because this becomes of placement of the zero length segment
last_segment = layout.Segments[-1]
settings = ifcopenshell.geom.settings()
fn = wrapper.map_shape(settings, last_segment.wrapped_data)
fn = wrapper.map_shape(settings, last_segment)
eval = wrapper.function_item_evaluator(settings, fn)
e = np.array(eval.evaluate(fn.end()))
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
@@ -135,7 +135,7 @@ def add_zero_length_segment(file: ifcopenshell.file, layout: entity_instance, in
settings = ifcopenshell.geom.settings()
mapped_segments = _map_alignment_horizontal_segment(file, last_segment)
geometry_segment = mapped_segments[0] if mapped_segments[1] == None else mapped_segments[1]
fn = wrapper.map_shape(settings, geometry_segment.wrapped_data)
fn = wrapper.map_shape(settings, geometry_segment)
eval = wrapper.function_item_evaluator(settings, fn)
e = np.array(eval.evaluate(fn.end()))
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
@@ -177,7 +177,7 @@ def add_zero_length_segment(file: ifcopenshell.file, layout: entity_instance, in
settings = ifcopenshell.geom.settings()
mapped_segments = _map_alignment_vertical_segment(file, last_segment)
geometry_segment = mapped_segments[0] if mapped_segments[1] == None else mapped_segments[1]
fn = wrapper.map_shape(settings, geometry_segment.wrapped_data)
fn = wrapper.map_shape(settings, geometry_segment)
eval = wrapper.function_item_evaluator(settings, fn)
e = np.array(eval.evaluate(fn.end()))
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
@@ -78,7 +78,7 @@ def create_layout_segment(
settings = ifcopenshell.geom.settings()
segment_fn = ifcopenshell_wrapper.map_shape(settings, curve_segment.wrapped_data)
segment_fn = ifcopenshell_wrapper.map_shape(settings, curve_segment)
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
e = segment_evaluator.evaluate(segment_fn.end())
end = np.array(e)
@@ -56,7 +56,7 @@ def get_curve_segment_transition_code(
settings = ifcopenshell.geom.settings()
settings.set("COMPUTE_CURVATURE", True)
segment_fn = ifcopenshell_wrapper.map_shape(settings, segment.wrapped_data)
segment_fn = ifcopenshell_wrapper.map_shape(settings, segment)
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
e = segment_evaluator.evaluate(segment_fn.end())
end = np.array(e)
@@ -64,7 +64,7 @@ def get_curve_segment_transition_code(
# must add the new segment to the container before mapping it, otherwise the segment doesn't
# have enough context to know if it is for horizontal, vertical, cant
next_segment_fn = ifcopenshell_wrapper.map_shape(settings, next_segment.wrapped_data)
next_segment_fn = ifcopenshell_wrapper.map_shape(settings, next_segment)
next_segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, next_segment_fn)
s = next_segment_evaluator.evaluate(next_segment_fn.start())
start = np.array(s)
@@ -49,7 +49,7 @@ def evaluate_representation(shape_rep: entity_instance, dist_along: float) -> np
# TODO: confirm point is not beyond limits of alignment
s = ifcopenshell.geom.settings()
function_item = ifcopenshell_wrapper.map_shape(s, shape_rep.wrapped_data)
function_item = ifcopenshell_wrapper.map_shape(s, shape_rep)
evaluator = ifcopenshell_wrapper.function_item_evaluator(s, function_item)
trans_matrix = evaluator.evaluate(dist_along)
@@ -72,7 +72,7 @@ def evaluate_segment(segment: entity_instance, dist_along: float) -> np.ndarray:
raise ValueError(f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength}).")
s = ifcopenshell.geom.settings()
function_item = ifcopenshell_wrapper.map_shape(s, segment.wrapped_data)
function_item = ifcopenshell_wrapper.map_shape(s, segment)
evaluator = ifcopenshell_wrapper.function_item_evaluator(s, function_item)
trans_matrix = evaluator.evaluate(dist_along)