mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Remove usage of .wrapped_item and some other fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
@@ -453,7 +453,7 @@ class Usecase:
|
||||
# 3 IfcPresentationLayerAssignment.AssignedItems
|
||||
skip_not_reused_entities_attr_i = 2
|
||||
|
||||
element_identity = element.wrapped_data.identity()
|
||||
element_identity = element.identity()
|
||||
|
||||
# Check if inverse element was created before.
|
||||
# Still need to recreate it again - e.g. it could be some rel
|
||||
@@ -489,7 +489,7 @@ class Usecase:
|
||||
if self.is_another_asset(item):
|
||||
continue
|
||||
if skip_not_reused_entities_attr_i is not None and i == skip_not_reused_entities_attr_i:
|
||||
identity = item.wrapped_data.identity()
|
||||
identity = item.identity()
|
||||
if (item := self.reuse_identities.get(identity)) is None:
|
||||
continue
|
||||
else:
|
||||
@@ -603,7 +603,7 @@ class Usecase:
|
||||
return ifc_file.add(element)
|
||||
|
||||
reuse_identities = self.reuse_identities
|
||||
element_identity = element.wrapped_data.identity()
|
||||
element_identity = element.identity()
|
||||
if added_element := reuse_identities.get(element_identity):
|
||||
return added_element
|
||||
|
||||
@@ -614,7 +614,7 @@ class Usecase:
|
||||
nonlocal attributes_
|
||||
if attributes_ is not None:
|
||||
return attributes_
|
||||
attributes_ = element.wrapped_data.declaration().as_entity().all_attributes()
|
||||
attributes_ = element.declaration().as_entity().all_attributes()
|
||||
return attributes_
|
||||
|
||||
def get_existing_element_(
|
||||
@@ -622,7 +622,7 @@ class Usecase:
|
||||
) -> Union[ifcopenshell.entity_instance, None]:
|
||||
# Check identity because `subelement` might not be the current `element`,
|
||||
# e.g. for IfcPersonAndOrganization.
|
||||
element_identity = subelement.wrapped_data.identity()
|
||||
element_identity = subelement.identity()
|
||||
if subelement_ := reuse_identities.get(element_identity):
|
||||
return subelement_
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class Usecase:
|
||||
self.style = style
|
||||
|
||||
attribute_types: dict[str, str] = {}
|
||||
for attribute in style.wrapped_data.declaration().as_entity().all_attributes():
|
||||
for attribute in style.declaration().as_entity().all_attributes():
|
||||
attribute_type = attribute.type_of_attribute()
|
||||
if attribute_type.as_aggregation_type() is None:
|
||||
attribute_type = attribute_type.declared_type().name()
|
||||
|
||||
Reference in New Issue
Block a user