mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Alignment API updates to support new patch recipes
This commit is contained in:
+38
@@ -20,6 +20,44 @@ import math
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.unit
|
||||
|
||||
def add_linear_placement_fallback_position(file:ifcopenshell.file)->ifcopenshell.file:
|
||||
import ifcopenshell.api.alignment
|
||||
patched_file = ifcopenshell.file.from_string(file.wrapped_data.to_string())
|
||||
|
||||
linear_placements = patched_file.by_type("IfcLinearPlacement")
|
||||
for lp in linear_placements:
|
||||
ifcopenshell.api.alignment.update_fallback_position(patched_file,lp)
|
||||
|
||||
return patched_file
|
||||
|
||||
|
||||
def create_alignment_geometry(file:ifcopenshell.file)->ifcopenshell.file:
|
||||
import ifcopenshell.api.alignment
|
||||
patched_file = ifcopenshell.file.from_string(file.wrapped_data.to_string())
|
||||
|
||||
alignments = patched_file.by_type("IfcAlignment")
|
||||
for alignment in alignments:
|
||||
ifcopenshell.api.alignment.create_representation(patched_file,alignment)
|
||||
|
||||
return patched_file
|
||||
|
||||
def append_zero_length_segments(file:ifcopenshell.file)->ifcopenshell.file:
|
||||
"""Appends zero length segments to all alignment layouts and layout geometry, if missing."""
|
||||
import ifcopenshell.api.alignment
|
||||
patched_file = ifcopenshell.file.from_string(file.wrapped_data.to_string())
|
||||
|
||||
alignments = patched_file.by_type("IfcAlignment")
|
||||
for alignment in alignments:
|
||||
layouts = ifcopenshell.api.alignment.get_alignment_layouts(alignment)
|
||||
for layout in layouts:
|
||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file,layout,include_referent=False)
|
||||
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
|
||||
if curve:
|
||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file,curve)
|
||||
|
||||
return patched_file
|
||||
|
||||
|
||||
|
||||
def station_as_string(file: ifcopenshell.file, sta: float):
|
||||
"""
|
||||
Reference in New Issue
Block a user