Alignment api update (#6817)

* Some basic COGO survey points functions

* Update alignment api

Includes defining alignment segment by segment, automatic geometry definitions, and automatric stationing and referents

* Fixes bonsai import alignment from csv

* Adds DMS angle conversion functions to COGO api

* Updated per @civilx64 review comments

* Fixes problem with segment representations

* Fixes problem with segment transition codes

* Allows for compound vertical and horizontal curves

* Implements callbacks for referent naming

* Renames angle_from_bearing to bearing2dd for consistency with ifcopenshell.util.geolocation.dms2dd. Removes angle_from_dms because it duplicates dms2dd

* Documents register_referent_name_callback

* Fixes all sorts of problems with Cant/SegRefCurve implementation

* refactor referent unit tests to use a fixture for test setup

* lint with black

---------

Co-authored-by: Scott Lecher <civilx64@gmail.com>
This commit is contained in:
Richard Brice
2025-07-08 10:09:14 -07:00
committed by GitHub
parent ad8d02bfed
commit 40f92d15c3
76 changed files with 3645 additions and 1839 deletions
@@ -1,72 +0,0 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
def test_add_segment_to_curve():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
circular_arc = file.createIfcCurveSegment(
Placement=file.createIfcAxis2Placement2d(
file.createIfcCartesianPoint((4084.115884, 3889.462938)),
file.createIfcDirection((0.224530986099614, 0.974466949814685)),
),
SegmentStart=file.createIfcLengthMeasure(0.0),
SegmentLength=file.createIfcLengthMeasure(-1848.115835),
ParentCurve=file.createIfcCircle(
Position=file.createIfcAxis2Placement2d(
file.createIfcCartesianPoint((0.0, 0.0)), file.createIfcDirection((1.0, 0.0))
),
Radius=1250.0,
),
)
line = file.createIfcCurveSegment(
Placement=file.createIfcAxis2Placement2d(
file.createIfcCartesianPoint((5469.395067, 4847.56631)),
file.createIfcDirection((0.991014275066766, -0.133756146078947)),
),
SegmentStart=file.createIfcLengthMeasure(0.0),
SegmentLength=file.createIfcLengthMeasure(1564.635765),
ParentCurve=file.createIfcLine(
Pnt=file.createIfcCartesianPoint((0.0, 0.0)),
Dir=file.createIfcVector(Orientation=file.createIfcDirection((1.0, 0.0)), Magnitude=1.0),
),
)
composite_curve = file.createIfcCompositeCurve(SelfIntersect=False)
ifcopenshell.api.alignment.add_segment_to_curve(file, circular_arc, composite_curve)
assert circular_arc.UsingCurves[0] == composite_curve
assert composite_curve.Segments[-1] == circular_arc
ifcopenshell.api.alignment.add_segment_to_curve(file, line, composite_curve)
assert line.UsingCurves[0] == composite_curve
assert composite_curve.Segments[-1] == line
@@ -20,10 +20,13 @@ import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
from ifcopenshell.api.alignment._add_segment_to_layout import _add_segment_to_layout
def test_add_segment_to_layout():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -33,16 +36,8 @@ def test_add_segment_to_layout():
parent=geometric_representation_context,
)
horizontal_alignment = file.create_entity(
type="IfcAlignmentHorizontal",
GlobalId=ifcopenshell.guid.new(),
OwnerHistory=None,
Name=None,
Description=None,
ObjectType=None,
ObjectPlacement=None,
Representation=None,
)
alignment = ifcopenshell.api.alignment.create(file,"")
horizontal_alignment = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.create_entity(
type="IfcAlignmentHorizontalSegment",
@@ -68,8 +63,9 @@ def test_add_segment_to_layout():
DesignParameters=design_parameters,
)
ifcopenshell.api.alignment.add_segment_to_layout(file, horizontal_alignment, alignment_segment)
_add_segment_to_layout(file, horizontal_alignment, alignment_segment)
assert len(horizontal_alignment.IsNestedBy) == 1
assert len(horizontal_alignment.IsNestedBy[0].RelatedObjects) == 1
assert len(horizontal_alignment.IsNestedBy[0].RelatedObjects) == 2 # The the segment we added and the automatically created zero length segment
assert horizontal_alignment.IsNestedBy[0].RelatedObjects[0] == alignment_segment
assert alignment_segment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent") # a referent is automatically added at the start of the segment
@@ -21,10 +21,11 @@ import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.util.element
def test_add_stationing_to_alignment():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -34,17 +35,9 @@ def test_add_stationing_to_alignment():
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths
alignment = ifcopenshell.api.alignment.create(
file, "TestAlignment", start_station=2000.
)
ifcopenshell.api.alignment.create_geometric_representation(file, alignment)
ifcopenshell.api.alignment.add_stationing_to_alignment(file, alignment, 2000.0)
for rel in alignment.IsNestedBy:
for referent in rel.RelatedObjects:
@@ -21,9 +21,11 @@ import ifcopenshell.api.alignment
import ifcopenshell.api.context
def test_add_vertical_by_pi_method():
def test_add_vertical_alignment():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -33,42 +35,44 @@ def test_add_vertical_by_pi_method():
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
# single horizontal alignment
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(file, "TestAlignment", coordinates, radii)
alignment = ifcopenshell.api.alignment.create(file,"A1",include_vertical=False)
assert len(alignment.IsDecomposedBy) == 0 # no child alignments
assert len(alignment.IsNestedBy) == 1 # nesting IfcAlignemtHorizontal
assert len(alignment.IsNestedBy[0].RelatedObjects) == 1 # nesting one IfcAlignmentHorizontal
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentHorizontal")
assert (
len(alignment.IsNestedBy[0].RelatedObjects[0].IsNestedBy) == 1
) # nesting of segments beneath IfcAlignmentHorizontal
assert len(alignment.IsNestedBy[0].RelatedObjects[0].IsNestedBy[0].RelatedObjects) == 8 # segments
assert len(alignment.IsNestedBy) == 1 # one nest
assert len(alignment.IsNestedBy[0].RelatedObjects) == 2 # nesting IfcReferent, IfcAlignmentHorizontal
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcCompositeCurve")
vertical_layout = ifcopenshell.api.alignment.add_vertical_layout(file,alignment)
# add first vertical
ifcopenshell.api.alignment.add_vertical_alignment_by_pi_method(file, alignment, vpoints, lengths)
assert len(alignment.IsDecomposedBy) == 0 # no child alignments
assert len(alignment.IsNestedBy) == 1 # 1 nesting relationsip for the alignments
assert len(alignment.IsNestedBy[0].RelatedObjects) == 2 # nesting IfcAlignmentHorizontal and IfcAlignmentVertical
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentHorizontal")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentVertical")
assert len(alignment.IsNestedBy) == 1 # one nest
assert len(alignment.IsNestedBy[0].RelatedObjects) == 3 # nesting IfcReferent, IfcAlignmentHorizontal, IfcAlignmentVertical
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
assert alignment.IsNestedBy[0].RelatedObjects[2].is_a("IfcAlignmentVertical")
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcGradientCurve")
# add a second vertical alignment
vertical_layout = ifcopenshell.api.alignment.add_vertical_layout(file,alignment)
# add second vertical
ifcopenshell.api.alignment.add_vertical_alignment_by_pi_method(file, alignment, vpoints, lengths)
assert len(alignment.IsDecomposedBy) == 1 # 1 IfcRelAggreates relationship for the child algiments
assert (
len(alignment.IsDecomposedBy[0].RelatedObjects) == 2
) # two child alignments, one for the first vertical and one for the vertical just added
for child_alignment in alignment.IsDecomposedBy[0].RelatedObjects:
assert child_alignment.is_a("IfcAlignment")
assert len(child_alignment.IsNestedBy) == 1 # one nesting relationship for the IfcAlignmentVertical
assert len(child_alignment.IsNestedBy[0].RelatedObjects) == 1 # The IfcAlignmentVertical
assert child_alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentVertical")
assert len(alignment.IsNestedBy) == 1 # 1 nesting relationsip for the alignments
assert len(alignment.IsNestedBy[0].RelatedObjects) == 1 # nesting one IfcAlignmentHorizontal
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcAlignmentHorizontal")
assert len(alignment.IsNestedBy[0].RelatedObjects) == 2 # nesting IfcReferent and IfcAlignmentHorizontal
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
test_add_vertical_alignment()
@@ -0,0 +1,69 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.alignment.get_layout_segments
import ifcopenshell.api.context
def test_create_alignment():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
include_vertical = [False,True,True]
include_cant = [False, False, True]
expected_curve_type = ["IfcCompositeCurve","IfcGradientCurve","IfcSegmentedReferenceCurve"]
for i in range(0,3) :
ali = ifcopenshell.api.alignment.create(file,"A1",include_vertical[i],include_cant[i])
assert ali != None
# verify the geometric representation was created
curve = ifcopenshell.api.alignment.get_curve(ali)
assert(curve.is_a() == expected_curve_type[i])
assert len(curve.Segments) == 1
horiz = ifcopenshell.api.alignment.get_horizontal_layout(ali)
vert = ifcopenshell.api.alignment.get_vertical_layout(ali)
cant = ifcopenshell.api.alignment.get_cant_layout(ali)
assert horiz != None
if include_vertical[i]:
assert vert != None
if include_cant[i]:
assert cant != None
# verify each layout has a zero length segment (which also tests if the geometry curve has a zero length segment)
alignments = [horiz,vert,cant]
for a in alignments:
if a != None:
segments = ifcopenshell.api.alignment.get_layout_segments(a)
assert len(segments) == 1
assert ifcopenshell.api.alignment.has_zero_length_segment(a) # there is a check in this function for the geometry curve
@@ -0,0 +1,57 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
def test_create_alignment_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file,name="foot")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_by_pi_method(file, "TestAlignment", coordinates, radii, vpoints, lengths)
assert len(alignment.IsDecomposedBy) == 0 # no child alignments
assert len(alignment.IsNestedBy) == 1 # one nest
assert len(alignment.IsNestedBy[0].RelatedObjects) == 3 # nesting IfcReferent, IfcAlignmentHorizontal, IfcAlignmentVertical
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
assert alignment.IsNestedBy[0].RelatedObjects[2].is_a("IfcAlignmentVertical")
assert (
len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy) == 1
) # nesting of segments beneath IfcAlignmentHorizontal
assert len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects) == 8 # segments in horizontal layout
assert len(alignment.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects) == 10 # segments in vertical layout
test_create_alignment_pi_method()
@@ -0,0 +1,275 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
from ifcopenshell import entity_instance
import math
def _test_horizontal() -> ifcopenshell.file:
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
# creates an IfcAlignment with an IfcAlignmentHorizontal layout containing only the zero length segment
ali = ifcopenshell.api.alignment.create(file,"A1")
# append a segment to the horizontal layout
horizontal_alignment = ifcopenshell.api.alignment.get_horizontal_layout(ali)
curve = ifcopenshell.api.alignment.get_curve(horizontal_alignment)
assert curve == None # for single horizontal, geometric representation is on IfcAlignment
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcCompositeCurve")
assert len(curve.Segments) == 1
design_parameters = file.create_entity(
type="IfcAlignmentHorizontalSegment",
StartTag=None,
EndTag=None,
StartPoint=file.createIfcCartesianPoint(Coordinates=((0.0, 0.0))),
StartDirection=0.0,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=0.0,
SegmentLength=100.0,
GravityCenterLineHeight=None,
PredefinedType="LINE",
)
end = ifcopenshell.api.alignment.create_layout_segment(file,horizontal_alignment,design_parameters)
assert len(horizontal_alignment.IsNestedBy[0].RelatedObjects) == 2
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 100.0
assert y == 0.0
assert z == 0.0
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcCompositeCurve")
assert len(curve.Segments) == 2
design_parameters = file.create_entity(
type="IfcAlignmentHorizontalSegment",
StartTag=None,
EndTag=None,
StartPoint=file.createIfcCartesianPoint(Coordinates=((x.item(), y.item()))),
StartDirection=math.pi/6,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=0.0,
SegmentLength=50.0,
GravityCenterLineHeight=None,
PredefinedType="LINE",
)
end = ifcopenshell.api.alignment.create_layout_segment(file,horizontal_alignment,design_parameters)
assert len(horizontal_alignment.IsNestedBy[0].RelatedObjects) == 3
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 100.0 + 50.0*math.cos(math.pi/6)
assert y == 50.0*math.sin(math.pi/6)
assert z == 0.0
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcCompositeCurve")
assert len(curve.Segments) == 3
return file
def _test_horizontal_vertical():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
# creates an IfcAlignment with an IfcAlignmentHorizontal layout containing only the zero length segment
ali = ifcopenshell.api.alignment.create(file,"A1",True)
# append a segment to the horizontal layout
horizontal_alignment = ifcopenshell.api.alignment.get_horizontal_layout(ali)
vertical_alignment = ifcopenshell.api.alignment.get_vertical_layout(ali)
curve = ifcopenshell.api.alignment.get_curve(horizontal_alignment)
assert curve == None
curve = ifcopenshell.api.alignment.get_curve(vertical_alignment)
assert curve == None
basis_curve = ifcopenshell.api.alignment.get_basis_curve(ali)
assert basis_curve.is_a("IfcCompositeCurve")
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcGradientCurve")
assert len(basis_curve.Segments) == 1
assert len(curve.Segments) == 1
design_parameters = file.create_entity(
type="IfcAlignmentHorizontalSegment",
StartTag=None,
EndTag=None,
StartPoint=file.createIfcCartesianPoint(Coordinates=((0.0, 0.0))),
StartDirection=0.0,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=0.0,
SegmentLength=100.0,
GravityCenterLineHeight=None,
PredefinedType="LINE",
)
end = ifcopenshell.api.alignment.create_layout_segment(file,horizontal_alignment,design_parameters)
basis_curve = ifcopenshell.api.alignment.get_basis_curve(ali)
assert basis_curve.is_a("IfcCompositeCurve")
assert len(basis_curve.Segments) == 2
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.0,
HorizontalLength=50.0,
StartHeight=20.0,
StartGradient = 1./100.,
EndGradient = 1./100.,
PredefinedType="CONSTANTGRADIENT"
)
end = ifcopenshell.api.alignment.create_layout_segment(file,vertical_alignment,design_parameters)
assert len(vertical_alignment.IsNestedBy[0].RelatedObjects) == 2
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 50.
assert y == 20.5
assert z == 0.0
dx = end[0,0]
dy = end[1,0]
gradient = dy/dx
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=50.0,
HorizontalLength=50.0,
StartHeight=y.item(),
StartGradient = -gradient,
EndGradient = -gradient,
PredefinedType="CONSTANTGRADIENT"
)
end = ifcopenshell.api.alignment.create_layout_segment(file,vertical_alignment,design_parameters)
assert len(vertical_alignment.IsNestedBy[0].RelatedObjects) == 3
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 100.
assert y == 20.
assert z == 0.0
basis_curve = ifcopenshell.api.alignment.get_basis_curve(ali)
assert basis_curve.is_a("IfcCompositeCurve")
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcGradientCurve")
assert len(basis_curve.Segments) == 2
assert len(curve.Segments) == 3
def _test_horizontal_vertical2(file: ifcopenshell.file):
ali = file.by_type("IfcAlignment")[0]
vertical_alignment = ifcopenshell.api.alignment.get_vertical_layout(ali)
assert vertical_alignment == None
vertical_alignment = ifcopenshell.api.alignment.add_vertical_layout(file,ali)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.0,
HorizontalLength=50.0,
StartHeight=20.0,
StartGradient = 1./100.,
EndGradient = 1./100.,
PredefinedType="CONSTANTGRADIENT"
)
end = ifcopenshell.api.alignment.create_layout_segment(file,vertical_alignment,design_parameters)
assert len(vertical_alignment.IsNestedBy[0].RelatedObjects) == 2
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 50.
assert y == 20.5
assert z == 0.0
dx = end[0,0]
dy = end[1,0]
gradient = dy/dx
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=50.0,
HorizontalLength=50.0,
StartHeight=y.item(),
StartGradient = -gradient,
EndGradient = -gradient,
PredefinedType="CONSTANTGRADIENT"
)
end = ifcopenshell.api.alignment.create_layout_segment(file,vertical_alignment,design_parameters)
assert len(vertical_alignment.IsNestedBy[0].RelatedObjects) == 3
x = end[0,3]
y = end[1,3]
z = end[2,3]
assert x == 100.
assert y == 20.
assert z == 0.0
curve = ifcopenshell.api.alignment.get_curve(ali)
assert curve.is_a("IfcGradientCurve")
assert len(curve.Segments) == 3
def test_append_segment():
file = _test_horizontal()
_test_horizontal_vertical()
_test_horizontal_vertical2(file)
test_append_segment()
@@ -20,10 +20,11 @@ import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
def test_add_stationing_to_alignment():
def test_distance_along_from_station():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file,name="foot")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -38,18 +39,15 @@ def test_add_stationing_to_alignment():
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths
alignment = ifcopenshell.api.alignment.create_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths,start_station=10000.0
)
# test alignment without stationing referent
assert ifcopenshell.api.alignment.distance_along_from_station(file, alignment, 500.0) == pytest.approx(500.0)
# add stationing referent
ifcopenshell.api.alignment.add_stationing_to_alignment(file, alignment, 10000.0)
# Station 138+83.96
assert ifcopenshell.api.alignment.distance_along_from_station(file, alignment, 13883.96) == pytest.approx(3883.96)
# Station 175+25.36
assert ifcopenshell.api.alignment.distance_along_from_station(file, alignment, 17525.36) == pytest.approx(7525.36)
test_distance_along_from_station()
@@ -0,0 +1,54 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
def test_get_alignment():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
include_vertical = [False,True,True]
include_cant = [False, False, True]
for i in range(0,3) :
ali = ifcopenshell.api.alignment.create(file,"A1",include_vertical[i],include_cant[i])
assert ali != None
horiz = ifcopenshell.api.alignment.get_horizontal_layout(ali)
vert = ifcopenshell.api.alignment.get_vertical_layout(ali)
cant = ifcopenshell.api.alignment.get_cant_layout(ali)
assert ali == ifcopenshell.api.alignment.get_alignment(horiz)
if include_vertical[i]:
assert ali == ifcopenshell.api.alignment.get_alignment(vert)
if include_cant[i]:
assert ali == ifcopenshell.api.alignment.get_alignment(cant)
@@ -18,15 +18,15 @@
import pytest
# import test.bootstrap
import ifcopenshell.api.alignment
import ifcopenshell.api.context
# class TestGetBasisCurve(test.bootstrap.IFC4X3):
def test_horizontal():
def _test_horizontal():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -36,18 +36,16 @@ def test_horizontal():
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(file, "TestAlignment", coordinates, radii)
ifcopenshell.api.alignment.create_geometric_representation(file, alignment)
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment")
basis_curve = ifcopenshell.api.alignment.get_basis_curve(alignment)
assert basis_curve.is_a("IfcCompositeCurve")
def test_horizontal_and_vertical():
def _test_horizontal_and_vertical():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -57,14 +55,33 @@ def test_horizontal_and_vertical():
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths
alignment = ifcopenshell.api.alignment.create(
file, "TestAlignment", include_vertical=True
)
ifcopenshell.api.alignment.create_geometric_representation(file, alignment)
basis_curve = ifcopenshell.api.alignment.get_basis_curve(alignment)
assert basis_curve.is_a("IfcCompositeCurve")
def _test_horizontal_and_vertical_and_cant():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
alignment = ifcopenshell.api.alignment.create(
file, "TestAlignment", include_vertical=True,include_cant=True
)
basis_curve = ifcopenshell.api.alignment.get_basis_curve(alignment)
assert basis_curve.is_a("IfcCompositeCurve")
def test_get_basis_curve():
_test_horizontal()
_test_horizontal_and_vertical()
_test_horizontal_and_vertical_and_cant()
@@ -16,17 +16,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
# import test.bootstrap
import ifcopenshell.api.alignment
import ifcopenshell.api.context
# class TestGetCurve(test.bootstrap.IFC4X3):
def test_horizontal():
def test_get_curve():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -36,35 +32,14 @@ def test_horizontal():
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(file, "TestAlignment", coordinates, radii)
ifcopenshell.api.alignment.create_geometric_representation(file, alignment)
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=False,include_cant=False)
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcCompositeCurve")
def test_horizontal_and_vertical():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths
)
ifcopenshell.api.alignment.create_geometric_representation(file, alignment)
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=True,include_cant=False)
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcGradientCurve")
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=True,include_cant=True)
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcSegmentedReferenceCurve")
@@ -0,0 +1,57 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.api.alignment
def test_get_layout_curve():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=False,include_cant=False)
layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcCompositeCurve")
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=True,include_cant=False)
layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcCompositeCurve")
layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcGradientCurve")
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment",include_vertical=True,include_cant=True)
layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcCompositeCurve")
layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcGradientCurve")
layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
assert curve.is_a("IfcSegmentedReferenceCurve")
@@ -16,18 +16,15 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.alignment.has_zero_length_segment
import ifcopenshell.api.alignment.remove_zero_length_segment
import ifcopenshell.api.context
import ifcopenshell.guid
import ifcopenshell.api.nest
def _test_business_definition():
def _test_horizontal():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -37,41 +34,15 @@ def _test_business_definition():
parent=geometric_representation_context,
)
horizontal = file.createIfcAlignmentHorizontal("Horizontal Alignment")
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
SegmentLength=100.0,
PredefinedType="LINE",
)
segment = file.createIfcAlignmentSegment(GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters)
ifcopenshell.api.nest.assign_object(
file,
related_objects=[
segment,
],
relating_object=horizontal,
)
assert False == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
ifcopenshell.api.alignment.add_zero_length_segment(file, horizontal)
assert len(horizontal.IsNestedBy[0].RelatedObjects) == 2
alignment = ifcopenshell.api.alignment.create(file,"TestAlignment")
horizontal = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
zero_length_segment = ifcopenshell.api.alignment.remove_zero_length_segment(file, horizontal)
assert len(horizontal.IsNestedBy[0].RelatedObjects) == 1
assert False == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
ifcopenshell.api.alignment.add_segment_to_layout(file, horizontal, zero_length_segment)
assert len(horizontal.IsNestedBy[0].RelatedObjects) == 2
assert True == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
def _test_geometric_definition():
def _test_horizontal_vertical():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -80,44 +51,39 @@ def _test_geometric_definition():
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
circular_arc = file.createIfcCurveSegment(
Placement=file.createIfcAxis2Placement2d(
file.createIfcCartesianPoint((4084.115884, 3889.462938)),
file.createIfcDirection((0.224530986099614, 0.974466949814685)),
),
SegmentStart=file.createIfcLengthMeasure(0.0),
SegmentLength=file.createIfcLengthMeasure(-1848.115835),
ParentCurve=file.createIfcCircle(
Position=file.createIfcAxis2Placement2d(
file.createIfcCartesianPoint((0.0, 0.0)), file.createIfcDirection((1.0, 0.0))
),
Radius=1250.0,
),
alignment = ifcopenshell.api.alignment.create(file,"TestAlignment",include_vertical=True)
horizontal = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
vertical = ifcopenshell.api.alignment.get_vertical_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(vertical)
def _test_horizontal_vertical_cant():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
composite_curve = file.createIfcCompositeCurve(Segments=(circular_arc,), SelfIntersect=False)
assert False == ifcopenshell.api.alignment.has_zero_length_segment(composite_curve)
ifcopenshell.api.alignment.add_zero_length_segment(file, composite_curve)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(composite_curve)
assert len(composite_curve.Segments) == 2
zero_length_segment = ifcopenshell.api.alignment.remove_zero_length_segment(file, composite_curve)
assert len(composite_curve.Segments) == 1
assert False == ifcopenshell.api.alignment.has_zero_length_segment(composite_curve)
ifcopenshell.api.alignment.add_segment_to_curve(file, zero_length_segment, composite_curve)
assert len(composite_curve.Segments) == 2
assert True == ifcopenshell.api.alignment.has_zero_length_segment(composite_curve)
segment = composite_curve.Segments[-1]
assert segment.Placement.Location.Coordinates == (5469.394535876198, 4847.567078630914)
assert segment.Placement.RefDirection.DirectionRatios == (0.9910142986043448, -0.13375597168627318)
alignment = ifcopenshell.api.alignment.create(file,"TestAlignment",include_vertical=True,include_cant=True)
horizontal = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(horizontal)
vertical = ifcopenshell.api.alignment.get_vertical_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(vertical)
cant = ifcopenshell.api.alignment.get_cant_layout(alignment)
assert True == ifcopenshell.api.alignment.has_zero_length_segment(cant)
def test_has_zero_length_segment():
_test_business_definition()
_test_geometric_definition()
_test_horizontal()
_test_horizontal_vertical()
_test_horizontal_vertical_cant()
test_has_zero_length_segment()
@@ -0,0 +1,55 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
# other test cases cover the typical vertical by PI method (test_create_alignment_by_pi_method)
# this test will focus on the edge cases of no initial tangent run, no final tangent run, and
# compound curve (no tangent between curves)
def test_horizontal_layout_by_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file,name="foot")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
coordinates = [(838.760, 224.745), (965.926, 258.819), (1226.296, 258.819), (1350.817, 291.415)]
radii = [(1000.0), (1000.0)]
alignment = ifcopenshell.api.alignment.create_by_pi_method(file, "TestAlignment", coordinates, radii)
assert len(alignment.IsDecomposedBy) == 0 # no child alignments
assert len(alignment.IsNestedBy) == 1 # one nest
assert len(alignment.IsNestedBy[0].RelatedObjects) == 2 # nesting IfcReferent, IfcAlignmentHorizontal
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
assert (
len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy) == 1
) # nesting of segments beneath IfcAlignmentHorizontal
assert len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects) == 3 # segments in horizontal layout
test_horizontal_layout_by_pi_method()
@@ -19,7 +19,7 @@
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
from ifcopenshell.api.alignment._map_alignment_cant_segment import _map_alignment_cant_segment
def _BlossCurve_100_0_300_1000_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
@@ -36,7 +36,7 @@ def _BlossCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -68,7 +68,7 @@ def _BlossCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -100,7 +100,7 @@ def _BlossCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -132,7 +132,7 @@ def _BlossCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -164,7 +164,7 @@ def _BlossCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -196,7 +196,7 @@ def _BlossCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -228,7 +228,7 @@ def _BlossCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -260,7 +260,7 @@ def _BlossCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -292,7 +292,7 @@ def _ConstantCant_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -321,7 +321,7 @@ def _ConstantCant_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -350,7 +350,7 @@ def _ConstantCant_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -379,7 +379,7 @@ def _ConstantCant_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -408,7 +408,7 @@ def _ConstantCant_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -437,7 +437,7 @@ def _ConstantCant_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -466,7 +466,7 @@ def _ConstantCant_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -495,7 +495,7 @@ def _ConstantCant_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -524,7 +524,7 @@ def _CosineCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -554,7 +554,7 @@ def _CosineCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -584,7 +584,7 @@ def _CosineCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -614,7 +614,7 @@ def _CosineCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -644,7 +644,7 @@ def _CosineCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -674,7 +674,7 @@ def _CosineCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -704,7 +704,7 @@ def _CosineCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -734,7 +734,7 @@ def _CosineCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -764,7 +764,7 @@ def _HelmertCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -809,7 +809,7 @@ def _HelmertCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -854,7 +854,7 @@ def _HelmertCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -899,7 +899,7 @@ def _HelmertCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -944,7 +944,7 @@ def _HelmertCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -989,7 +989,7 @@ def _HelmertCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1034,7 +1034,7 @@ def _HelmertCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1079,7 +1079,7 @@ def _HelmertCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1124,7 +1124,7 @@ def _LinearTransition_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1155,7 +1155,7 @@ def _LinearTransition_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1186,7 +1186,7 @@ def _LinearTransition_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1217,7 +1217,7 @@ def _LinearTransition_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1248,7 +1248,7 @@ def _LinearTransition_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1279,7 +1279,7 @@ def _LinearTransition_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1310,7 +1310,7 @@ def _LinearTransition_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1341,7 +1341,7 @@ def _LinearTransition_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1372,7 +1372,7 @@ def _SineCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1403,7 +1403,7 @@ def _SineCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1434,7 +1434,7 @@ def _SineCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1465,7 +1465,7 @@ def _SineCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1496,7 +1496,7 @@ def _SineCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1527,7 +1527,7 @@ def _SineCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1558,7 +1558,7 @@ def _SineCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1589,7 +1589,7 @@ def _SineCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segments = _map_alignment_cant_segment(file, alignment_segment, 1.5)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -21,7 +21,7 @@
import pytest
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._map_alignment_horizontal_segment import __map_alignment_horizontal_segment
def _BlossCurve_100_0_300_1000_1_Meter(file):
design_parameters = file.createIfcAlignmentHorizontalSegment(
@@ -37,7 +37,7 @@ def _BlossCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -68,7 +68,7 @@ def _BlossCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -99,7 +99,7 @@ def _BlossCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -130,7 +130,7 @@ def _BlossCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -161,7 +161,7 @@ def _BlossCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -192,7 +192,7 @@ def _BlossCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -223,7 +223,7 @@ def _BlossCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -254,7 +254,7 @@ def _BlossCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -285,7 +285,7 @@ def _CircularArc_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -313,7 +313,7 @@ def _CircularArc_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -341,7 +341,7 @@ def _CircularArc_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -369,7 +369,7 @@ def _CircularArc_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -397,7 +397,7 @@ def _CircularArc_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -425,7 +425,7 @@ def _CircularArc_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -453,7 +453,7 @@ def _CircularArc_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -481,7 +481,7 @@ def _CircularArc_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -509,7 +509,7 @@ def _Clothoid_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -537,7 +537,7 @@ def _Clothoid_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -565,7 +565,7 @@ def _Clothoid_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -593,7 +593,7 @@ def _Clothoid_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -621,7 +621,7 @@ def _Clothoid_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -649,7 +649,7 @@ def _Clothoid_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -677,7 +677,7 @@ def _Clothoid_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -705,7 +705,7 @@ def _Clothoid_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -733,7 +733,7 @@ def _CosineCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -762,7 +762,7 @@ def _CosineCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -791,7 +791,7 @@ def _CosineCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -820,7 +820,7 @@ def _CosineCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -849,7 +849,7 @@ def _CosineCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -878,7 +878,7 @@ def _CosineCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -907,7 +907,7 @@ def _CosineCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -936,7 +936,7 @@ def _CosineCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -965,7 +965,7 @@ def _Cubic_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -994,7 +994,7 @@ def _Cubic_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1023,7 +1023,7 @@ def _Cubic_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1052,7 +1052,7 @@ def _Cubic_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1081,7 +1081,7 @@ def _Cubic_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1110,7 +1110,7 @@ def _Cubic_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1139,7 +1139,7 @@ def _Cubic_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1168,7 +1168,7 @@ def _Cubic_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1197,7 +1197,7 @@ def _HelmertCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1245,7 +1245,7 @@ def _HelmertCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1293,7 +1293,7 @@ def _HelmertCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1341,7 +1341,7 @@ def _HelmertCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1389,7 +1389,7 @@ def _HelmertCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1437,7 +1437,7 @@ def _HelmertCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1485,7 +1485,7 @@ def _HelmertCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1533,7 +1533,7 @@ def _HelmertCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1581,7 +1581,7 @@ def _Line_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1609,7 +1609,7 @@ def _Line_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1637,7 +1637,7 @@ def _Line_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1665,7 +1665,7 @@ def _Line_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1693,7 +1693,7 @@ def _Line_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1721,7 +1721,7 @@ def _Line_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1749,7 +1749,7 @@ def _Line_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1777,7 +1777,7 @@ def _Line_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1805,7 +1805,7 @@ def _SineCurve_100_0_300_1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1835,7 +1835,7 @@ def _SineCurve_100_0__300__1000_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1865,7 +1865,7 @@ def _SineCurve_100_0_300_inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1895,7 +1895,7 @@ def _SineCurve_100_0__300__inf_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1925,7 +1925,7 @@ def _SineCurve_100_0_1000_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1955,7 +1955,7 @@ def _SineCurve_100_0__1000__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -1985,7 +1985,7 @@ def _SineCurve_100_0_inf_300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -2015,7 +2015,7 @@ def _SineCurve_100_0__inf__300_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_horizontal_segment(file, alignment_segment)
mapped_segments = __map_alignment_horizontal_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
@@ -21,7 +21,7 @@
import pytest
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._map_alignment_vertical_segment import _map_alignment_vertical_segment
def _CircularArc_100_0_10_0_0_0_0_5_1_Meter(file):
design_parameters = file.createIfcAlignmentVerticalSegment(
@@ -37,7 +37,7 @@ def _CircularArc_100_0_10_0_0_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -66,7 +66,7 @@ def _CircularArc_100_0_10_0_0_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -97,7 +97,7 @@ def _CircularArc_100_0_10_0_0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -128,7 +128,7 @@ def _CircularArc_100_0_10_0__0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -159,7 +159,7 @@ def _CircularArc_100_0_10_0_0_5_1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -192,7 +192,7 @@ def _CircularArc_100_0_10_0__0_5__1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -225,7 +225,7 @@ def _CircularArc_100_0_10_0_1_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -258,7 +258,7 @@ def _CircularArc_100_0_10_0__1_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -291,7 +291,7 @@ def _ConstantGradient_100_0_10_0_0_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -320,7 +320,7 @@ def _ConstantGradient_100_0_10_0_0_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -349,7 +349,7 @@ def _ConstantGradient_100_0_10_0_0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -380,7 +380,7 @@ def _ConstantGradient_100_0_10_0__0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -411,7 +411,7 @@ def _ConstantGradient_100_0_10_0_0_5_1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -442,7 +442,7 @@ def _ConstantGradient_100_0_10_0__0_5__1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -473,7 +473,7 @@ def _ConstantGradient_100_0_10_0_1_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -504,7 +504,7 @@ def _ConstantGradient_100_0_10_0__1_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -535,7 +535,7 @@ def _ParabolicArc_100_0_10_0_0_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -564,7 +564,7 @@ def _ParabolicArc_100_0_10_0_0_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -593,7 +593,7 @@ def _ParabolicArc_100_0_10_0_0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -624,7 +624,7 @@ def _ParabolicArc_100_0_10_0__0_5_0_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -655,7 +655,7 @@ def _ParabolicArc_100_0_10_0_0_5_1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -686,7 +686,7 @@ def _ParabolicArc_100_0_10_0__0_5__1_0_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -717,7 +717,7 @@ def _ParabolicArc_100_0_10_0_1_0_0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -748,7 +748,7 @@ def _ParabolicArc_100_0_10_0__1_0__0_5_1_Meter(file):
GlobalId=ifcopenshell.guid.new(), DesignParameters=design_parameters
)
mapped_segments = ifcopenshell.api.alignment.map_alignment_vertical_segment(file, alignment_segment)
mapped_segments = _map_alignment_vertical_segment(file, alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert mapped_segments[1] == None
@@ -23,7 +23,9 @@ import ifcopenshell.api.context
def test_name_segments():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -38,7 +40,7 @@ def test_name_segments():
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_alignment_by_pi_method(
alignment = ifcopenshell.api.alignment.create_by_pi_method(
file, "TestAlignment", coordinates, radii, vpoints, lengths
)
@@ -0,0 +1,124 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
from pytest import fixture
import ifcopenshell.api.alignment
import ifcopenshell.api.context
@pytest.fixture(scope="module")
def default_names_alignment():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file, name="foot")
ifcopenshell.api.unit.assign_unit(file, units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_by_pi_method(file, "TestAlignment", coordinates, radii, vpoints,
lengths)
yield alignment
def _hcallback(prev_segment, segment):
if (prev_segment is None) and (segment is not None):
label = "A"
elif (prev_segment is not None) and (segment is None):
label = "Z"
else:
label = "Q"
return label
def _vcallback(prev_segment, segment):
if (prev_segment is None) and (segment is not None):
label = "a"
elif (prev_segment is not None) and (segment is None):
label = "z"
else:
label = "q"
return label
@pytest.fixture(scope="module")
def callback_alignment():
ifcopenshell.api.alignment.register_referent_name_callback(_hcallback, _vcallback, None)
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file, name="foot")
ifcopenshell.api.unit.assign_unit(file, units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
coordinates = [(500.0, 2500.0), (3340.0, 660.0), (4340.0, 5000.0), (7600.0, 4560.0), (8480.0, 2010.0)]
radii = [(1000.0), (1250.0), (950.0)]
vpoints = [(0.0, 100.0), (2000.0, 135.0), (5000.0, 105.0), (7400.0, 153.0), (9800.0, 105.0), (12800.0, 90.0)]
lengths = [(1600.0), (1200.0), (2000.0), (800.0)]
alignment = ifcopenshell.api.alignment.create_by_pi_method(file, "TestAlignment", coordinates, radii, vpoints,
lengths)
yield alignment
def test_with_default_names(default_names_alignment):
hlayout = ifcopenshell.api.alignment.get_horizontal_layout(default_names_alignment)
assert "P.O.B." in hlayout.IsNestedBy[0].RelatedObjects[0].IsNestedBy[0].RelatedObjects[0].Name
assert "P.C." in hlayout.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects[0].Name
assert "P.T." in hlayout.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects[0].Name
assert "P.O.E." in hlayout.IsNestedBy[0].RelatedObjects[-1].IsNestedBy[0].RelatedObjects[0].Name
vlayout = ifcopenshell.api.alignment.get_vertical_layout(default_names_alignment)
assert "V.P.O.B." in vlayout.IsNestedBy[0].RelatedObjects[0].IsNestedBy[0].RelatedObjects[0].Name
assert "P.V.C." in vlayout.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects[0].Name
assert "P.V.T." in vlayout.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects[0].Name
assert "V.P.O.E." in vlayout.IsNestedBy[0].RelatedObjects[-1].IsNestedBy[0].RelatedObjects[0].Name
def test_with_callbacks(callback_alignment):
hlayout = ifcopenshell.api.alignment.get_horizontal_layout(callback_alignment)
assert "A" in hlayout.IsNestedBy[0].RelatedObjects[0].IsNestedBy[0].RelatedObjects[0].Name
assert "Q" in hlayout.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects[0].Name
assert "Q" in hlayout.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects[0].Name
assert "Z" in hlayout.IsNestedBy[0].RelatedObjects[-1].IsNestedBy[0].RelatedObjects[0].Name
vlayout = ifcopenshell.api.alignment.get_vertical_layout(callback_alignment)
assert "a" in vlayout.IsNestedBy[0].RelatedObjects[0].IsNestedBy[0].RelatedObjects[0].Name
assert "q" in vlayout.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects[0].Name
assert "q" in vlayout.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects[0].Name
assert "z" in vlayout.IsNestedBy[0].RelatedObjects[-1].IsNestedBy[0].RelatedObjects[0].Name
@@ -17,13 +17,15 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
from ifcopenshell.api.alignment._update_curve_segment_transition_code import _update_curve_segment_transition_code
import ifcopenshell.api.context
def _test1():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(Name="Test")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
@@ -79,7 +81,7 @@ def _test1():
composite_curve = file.createIfcCompositeCurve(Segments=(circular_arc, line), SelfIntersect=False)
ifcopenshell.api.alignment.update_curve_segment_transition_code(circular_arc, line)
_update_curve_segment_transition_code(circular_arc, line)
assert circular_arc.Transition == "CONTSAMEGRADIENT"
@@ -94,6 +96,7 @@ def _test2():
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
# 30=IFCCARTESIANPOINT((0.,0.));
# 31=IFCALIGNMENTHORIZONTALSEGMENT($,$,#30,0.523598775598299,0.,0.,27.8843513637174,$,.LINE.);
# 32=IFCALIGNMENTSEGMENT('3$jiMaOgfAoujgvRyMLw0X',$,'H1',$,$,#111,#113,#31);
@@ -220,29 +223,23 @@ def _test2():
),
)
composite_curve = file.createIfcCompositeCurve(Segments=[], SelfIntersect=False)
composite_curve = file.createIfcCompositeCurve(Segments=[line1,clothoid1,circular_arc,clothoid2,line2], SelfIntersect=False)
# add_segment_to_curve calls update_curve_segment_transition_code
ifcopenshell.api.alignment.add_segment_to_curve(file, line1, composite_curve)
assert line1.Transition == "DISCONTINUOUS"
ifcopenshell.api.alignment.add_segment_to_curve(file, clothoid1, composite_curve)
_update_curve_segment_transition_code(line1,clothoid1)
assert line1.Transition == "CONTSAMEGRADIENTSAMECURVATURE"
assert clothoid1.Transition == "DISCONTINUOUS"
ifcopenshell.api.alignment.add_segment_to_curve(file, circular_arc, composite_curve)
_update_curve_segment_transition_code(clothoid1,circular_arc)
assert clothoid1.Transition == "CONTSAMEGRADIENTSAMECURVATURE"
assert circular_arc.Transition == "DISCONTINUOUS"
ifcopenshell.api.alignment.add_segment_to_curve(file, clothoid2, composite_curve)
_update_curve_segment_transition_code(circular_arc,clothoid2)
assert circular_arc.Transition == "CONTSAMEGRADIENTSAMECURVATURE"
assert clothoid2.Transition == "DISCONTINUOUS"
ifcopenshell.api.alignment.add_segment_to_curve(file, line2, composite_curve)
_update_curve_segment_transition_code(clothoid2,line2)
assert clothoid2.Transition == "CONTSAMEGRADIENTSAMECURVATURE"
assert line2.Transition == "DISCONTINUOUS"
def test_update_curve_segment_transition_code():
_test1()
_test2()
test_update_curve_segment_transition_code()
@@ -0,0 +1,71 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
# other test cases cover the typical vertical by PI method (test_create_alignment_by_pi_method)
# this test will focus on the edge cases of no initial gradient, no final gradient, and
# compound vertical curve (no gradient between curves)
def test_vertical_layout_by_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(),Name="Test")
length = ifcopenshell.api.unit.add_conversion_based_unit(file,name="foot")
ifcopenshell.api.unit.assign_unit(file,units=[length])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Axis",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
alignment = ifcopenshell.api.alignment.create(file, "TestAlignment", include_vertical=True)
hlayout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
segment1 = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint(Coordinates=((0.,0.))), # Actual coordinate unknown
StartDirection=0.0,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=0.0,
SegmentLength=10000.0,
PredefinedType = "LINE"
)
ifcopenshell.api.alignment.create_layout_segment(file,hlayout,segment1)
vpoints = [(0.0, 110.0), (400.0, 100.0), (800.0, 115.0), (1300.0, 125.0), (1800.0, 105.0)]
lengths = [(800.0), (0.0), (1000.0)]
vlayout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
ifcopenshell.api.alignment.layout_vertical_alignment_by_pi_method(file,vlayout,vpoints,lengths)
assert len(alignment.IsDecomposedBy) == 0 # no child alignments
assert len(alignment.IsNestedBy) == 1 # one nest
assert len(alignment.IsNestedBy[0].RelatedObjects) == 3 # nesting IfcReferent, IfcAlignmentHorizontal, IfcAlignmentVertical
assert alignment.IsNestedBy[0].RelatedObjects[0].is_a("IfcReferent")
assert alignment.IsNestedBy[0].RelatedObjects[1].is_a("IfcAlignmentHorizontal")
assert alignment.IsNestedBy[0].RelatedObjects[2].is_a("IfcAlignmentVertical")
assert (
len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy) == 1
) # nesting of segments beneath IfcAlignmentHorizontal
assert len(alignment.IsNestedBy[0].RelatedObjects[1].IsNestedBy[0].RelatedObjects) == 2 # segments in horizontal layout
assert len(alignment.IsNestedBy[0].RelatedObjects[2].IsNestedBy[0].RelatedObjects) == 3 # segments in vertical layout
test_vertical_layout_by_pi_method()
@@ -0,0 +1,45 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.cogo
def test_add_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(),Name="MySite")
ifcopenshell.api.aggregate.assign_object(file,relating_object=project,products=[site])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Annotation",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
annotation = ifcopenshell.api.cogo.add_survey_point(file,file.createIfcCartesianPoint((50.0,10.0)))
assert annotation
assert annotation.PredefinedType == "SURVEY"
assert annotation.Representation.Representations[0].RepresentationIdentifier == "Annotation"
assert annotation.Representation.Representations[0].RepresentationType == "Point"
assert annotation.Representation.Representations[0].Items[0].Coordinates == pytest.approx((50.0,10.0))
@@ -0,0 +1,48 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.cogo
def test_assign_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(),Name="MySite")
ifcopenshell.api.aggregate.assign_object(file,relating_object=project,products=[site])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Annotation",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
annotation = ifcopenshell.api.cogo.add_survey_point(file,file.createIfcCartesianPoint((50.0,10.0)))
assert annotation
assert annotation.PredefinedType == "SURVEY"
assert annotation.Representation.Representations[0].RepresentationIdentifier == "Annotation"
assert annotation.Representation.Representations[0].RepresentationType == "Point"
assert annotation.Representation.Representations[0].Items[0].Coordinates == pytest.approx((50.0,10.0))
ifcopenshell.api.cogo.assign_survey_point(annotation,file.createIfcCartesianPoint((20.0,30.0,40.0)))
assert annotation.Representation.Representations[0].Items[0].Coordinates == pytest.approx((20.0,30.0,40.0))
@@ -0,0 +1,73 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.cogo
import math
def test_bearing2dd():
assert 44.743888875 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 45 15 22.5 E"))
assert 135.256111125 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 45 15 22.5 W"))
assert 224.743888875 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("S 45 15 22.5 W"))
assert 315.256111125 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("S 45 15 22.5 E"))
assert 44.743888875 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("n 45 15 22.5 e"))
assert 135.256111125 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("n 45 15 22.5 w"))
assert 224.743888875 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("s 45 15 22.5 w"))
assert 315.256111125 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("s 45 15 22.5 e"))
assert 0.0 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 90 E"))
assert 0.0 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("S 90 E"))
assert 180. == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 90 W"))
assert 180. == pytest.approx(ifcopenshell.api.cogo.bearing2dd("S 90 W"))
assert 120. == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 30 W"))
assert 120.16666666666667 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 30 10 W"))
assert 89.999722222222228 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 00 00 1 E"))
assert 89.99972222222222 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 0 0 1 E"))
assert 89.99972222222222 == pytest.approx(ifcopenshell.api.cogo.bearing2dd("N 00 00 1.0 E"))
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("Bad String")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("Very Bad String")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 100 15 22.5 E")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N -45 15 22.5 E")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 45 -15 22.5 E")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 45 88 22.5 E")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 45 15 -22.5 E")
with pytest.raises(ValueError,match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 45 15 99.5 E")
test_bearing2dd()
@@ -0,0 +1,48 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2025 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.cogo
def test_edit_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(),Name="MySite")
ifcopenshell.api.aggregate.assign_object(file,relating_object=project,products=[site])
geometric_representation_context = ifcopenshell.api.context.add_context(file, context_type="Model")
axis_model_representation_subcontext = ifcopenshell.api.context.add_context(
file,
context_type="Model",
context_identifier="Annotation",
target_view="MODEL_VIEW",
parent=geometric_representation_context,
)
annotation = ifcopenshell.api.cogo.add_survey_point(file,file.createIfcCartesianPoint((50.0,10.0)))
assert annotation
assert annotation.PredefinedType == "SURVEY"
assert annotation.Representation.Representations[0].RepresentationIdentifier == "Annotation"
assert annotation.Representation.Representations[0].RepresentationType == "Point"
assert annotation.Representation.Representations[0].Items[0].Coordinates == pytest.approx((50.0,10.0))
ifcopenshell.api.cogo.edit_survey_point(annotation,20.0,30.0)
assert annotation.Representation.Representations[0].Items[0].Coordinates == pytest.approx((20.0,30.0))