mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
Refactor get alignment layouts into util
This commit is contained in:
@@ -19,20 +19,12 @@
|
|||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
from ifcopenshell import entity_instance
|
from ifcopenshell import entity_instance
|
||||||
|
import ifcopenshell.util.alignment
|
||||||
|
|
||||||
|
|
||||||
|
# TODO remove this function, use util directly
|
||||||
def get_alignment_layouts(alignment: entity_instance) -> Sequence[entity_instance]:
|
def get_alignment_layouts(alignment: entity_instance) -> Sequence[entity_instance]:
|
||||||
"""
|
"""
|
||||||
Returns the layout alignments nested to this alignment
|
Returns the layout alignments nested to this alignment
|
||||||
"""
|
"""
|
||||||
layouts = []
|
return ifcopenshell.util.alignment.get_alignment_layouts(alignment)
|
||||||
for rel in alignment.IsNestedBy:
|
|
||||||
for layout in rel.RelatedObjects:
|
|
||||||
if (
|
|
||||||
layout.is_a("IfcAlignmentHorizontal")
|
|
||||||
or layout.is_a("IfcAlignmentVertical")
|
|
||||||
or layout.is_a("IfcAlignmentCant")
|
|
||||||
):
|
|
||||||
layouts.append(layout)
|
|
||||||
|
|
||||||
return layouts
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import math
|
|||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.unit
|
import ifcopenshell.util.unit
|
||||||
|
from typing import Sequence
|
||||||
|
|
||||||
|
|
||||||
def add_linear_placement_fallback_position(file: ifcopenshell.file) -> ifcopenshell.file:
|
def add_linear_placement_fallback_position(file: ifcopenshell.file) -> ifcopenshell.file:
|
||||||
@@ -109,3 +110,19 @@ def station_as_string(file: ifcopenshell.file, sta: float):
|
|||||||
station_string = "-" + station_string
|
station_string = "-" + station_string
|
||||||
|
|
||||||
return station_string
|
return station_string
|
||||||
|
|
||||||
|
|
||||||
|
def get_alignment_layouts(alignment: ifcopenshell.entity_instance) -> Sequence[ifcopenshell.entity_instance]:
|
||||||
|
"""
|
||||||
|
Returns the layout alignments nested to this alignment
|
||||||
|
"""
|
||||||
|
layouts = []
|
||||||
|
for rel in alignment.IsNestedBy:
|
||||||
|
for layout in rel.RelatedObjects:
|
||||||
|
if (
|
||||||
|
layout.is_a("IfcAlignmentHorizontal")
|
||||||
|
or layout.is_a("IfcAlignmentVertical")
|
||||||
|
or layout.is_a("IfcAlignmentCant")
|
||||||
|
):
|
||||||
|
layouts.append(layout)
|
||||||
|
return layouts
|
||||||
|
|||||||
Reference in New Issue
Block a user