Implements business 2 geometry mapping for Viennese Bend for horizontal and cant layouts

This commit is contained in:
Richard Brice
2025-08-09 14:03:19 -07:00
parent 9d2a79803a
commit 762f4ff975
6 changed files with 1023 additions and 23 deletions
@@ -1605,6 +1605,277 @@ def _SineCurve_100_0__inf__300_1_Meter(file):
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(3535.53390593274)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def _VienneseBend_100_0_300_1000_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.0,
EndCantLeft=0.0,
StartCantRight=0.1,
EndCantRight=0.03,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.05, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(185.93568367635672)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-169.87095595653895)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(180.0012184608678)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-241.1974890085123)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(200000.0)
def _VienneseBend_100_0__300__1000_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.1,
EndCantLeft=0.03,
StartCantRight=0.0,
EndCantRight=0.0,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.05, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(185.93568367635672)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-169.87095595653895)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(180.0012184608678)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-241.1974890085123)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(200000.0)
def _VienneseBend_100_0_300_inf_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.0,
EndCantLeft=0.0,
StartCantRight=0.1,
EndCantRight=0.0,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.05, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(177.82794100389228)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-161.4322423756691)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(169.6127328157867)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-224.5910214113641)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(200000.0)
def _VienneseBend_100_0__300__inf_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.1,
EndCantLeft=0.0,
StartCantRight=0.0,
EndCantRight=0.0,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.05, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(177.82794100389228)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-161.4322423756691)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(169.6127328157867)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-224.5910214113641)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(200000.0)
def _VienneseBend_100_0_1000_300_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.0,
EndCantLeft=0.0,
StartCantRight=0.03,
EndCantRight=0.1,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.015, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-185.93568367635672)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(169.87095595653895)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-180.0012184608678)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(241.1974890085123)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(666666.666666667)
def _VienneseBend_100_0__1000__300_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.03,
EndCantLeft=0.1,
StartCantRight=0.0,
EndCantRight=0.0,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.015, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-185.93568367635672)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(169.87095595653895)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-180.0012184608678)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(241.1974890085123)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(666666.666666667)
def _VienneseBend_100_0_inf_300_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.0,
EndCantLeft=0.0,
StartCantRight=0.0,
EndCantRight=0.1,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-177.82794100389228)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(161.4322423756691)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-169.6127328157867)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(224.5910214113641)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def _VienneseBend_100_0__inf__300_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.0,
HorizontalLength=100.0,
StartCantLeft=0.0,
EndCantLeft=0.1,
StartCantRight=0.0,
EndCantRight=0.0,
PredefinedType="VIENNESEBEND")
alignment_segment = file.createIfcAlignmentSegment(
GlobalId=ifcopenshell.guid.new(),
DesignParameters=design_parameters)
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
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-177.82794100389228)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(161.4322423756691)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-169.6127328157867)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(224.5910214113641)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def test_map_alignment_cant_segment():
file = ifcopenshell.file(schema="IFC4X3")
@@ -1656,5 +1927,14 @@ def test_map_alignment_cant_segment():
_SineCurve_100_0__1000__300_1_Meter(file)
_SineCurve_100_0_inf_300_1_Meter(file)
_SineCurve_100_0__inf__300_1_Meter(file)
_VienneseBend_100_0_300_1000_1_Meter(file)
_VienneseBend_100_0__300__1000_1_Meter(file)
_VienneseBend_100_0_300_inf_1_Meter(file)
_VienneseBend_100_0__300__inf_1_Meter(file)
_VienneseBend_100_0_1000_300_1_Meter(file)
_VienneseBend_100_0__1000__300_1_Meter(file)
_VienneseBend_100_0_inf_300_1_Meter(file)
_VienneseBend_100_0__inf__300_1_Meter(file)
# VIENESSE BEND NOT IMPLEMENTED
test_map_alignment_cant_segment()
@@ -2031,6 +2031,516 @@ def _SineCurve_100_0__inf__300_1_Meter(file):
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(-173.205080756888)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def _VienneseBend_100_0_300_1000_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
# for viennese bends, the horizontal layout depends on the cant layout
# for this reason, define the cant segment before the horizontal segment
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.,
EndCantLeft=0.,
StartCantRight=0.1,
EndCantRight=0.03,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=300.0,
EndRadiusOfCurvature=1000.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(82.48484305114)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-67.097076273516)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(61.2742234216927)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-68.9807356362507)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(-91.7493208218373)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(141.521951256265)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(300.0)
def _VienneseBend_100_0__300__1000_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.1,
EndCantLeft=0.03,
StartCantRight=0.,
EndCantRight=0.,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=-300.0,
EndRadiusOfCurvature=-1000.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-82.48484305114)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(67.097076273516)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-61.2742234216927)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(68.9807356362507)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(91.7493208218373)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(-141.521951256265)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(-300.0)
def _VienneseBend_100_0_300_inf_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.,
EndCantLeft=0.,
StartCantRight=0.1,
EndCantRight=0.,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=300.0,
EndRadiusOfCurvature=0.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(78.8880838459446)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-63.7638813456506)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(57.7378785242934)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-64.2314061308743)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(-83.922298125931)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(125.657906854859)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(300.0)
def _VienneseBend_100_0__300__inf_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.1,
EndCantLeft=0.,
StartCantRight=0.,
EndCantRight=0.,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=-300.0,
EndRadiusOfCurvature=0.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-78.8880838459446)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(63.7638813456506)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-57.7378785242934)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(64.2314061308743)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(83.922298125931)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(-125.657906854859)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(-300.0)
def _VienneseBend_100_0_1000_300_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.,
EndCantLeft=0.,
StartCantRight=0.03,
EndCantRight=0.1,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=1000.0,
EndRadiusOfCurvature=300.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-82.48484305114)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(67.097076273516)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-61.2742234216927)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(68.9807356362507)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(91.7493208218373)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(-141.521951256265)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(1000.0)
def _VienneseBend_100_0__1000__300_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.03,
EndCantLeft=0.1,
StartCantRight=0.,
EndCantRight=0.,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=-1000.0,
EndRadiusOfCurvature=-300.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(82.48484305114)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-67.097076273516)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(61.2742234216927)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-68.9807356362507)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(-91.7493208218373)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(141.521951256265)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(-1000.0)
def _VienneseBend_100_0_inf_300_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.,
EndCantLeft=0.,
StartCantRight=0.,
EndCantRight=0.1,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=300.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(-78.8880838459446)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(63.7638813456506)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(-57.7378785242934)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(64.2314061308743)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(83.922298125931)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(-125.657906854859)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def _VienneseBend_100_0__inf__300_1_Meter(file):
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new())
length = ifcopenshell.api.unit.add_si_unit(file,unit_type="LENGTHUNIT")
ifcopenshell.api.unit.assign_unit(file,units=[length])
alignment = ifcopenshell.api.alignment.create(file,"",include_vertical=True,include_cant=True)
cant_layout = ifcopenshell.api.alignment.get_cant_layout(alignment)
cant_layout.RailHeadDistance=1.5
design_parameters = file.createIfcAlignmentCantSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartCantLeft=0.,
EndCantLeft=0.1,
StartCantRight=0.,
EndCantRight=0.,
PredefinedType="VIENNESEBEND"
)
ifcopenshell.api.alignment.create_layout_segment(file,cant_layout,design_parameters)
horizontal_layout = ifcopenshell.api.alignment.get_horizontal_layout(alignment)
design_parameters = file.createIfcAlignmentHorizontalSegment(
StartPoint=file.createIfcCartesianPoint((0.0, 0.0)),
StartDirection=0.0,
StartRadiusOfCurvature=0.0,
EndRadiusOfCurvature=-300.0,
SegmentLength=100.0,
GravityCenterLineHeight=1.8,
PredefinedType="VIENNESEBEND")
ifcopenshell.api.alignment.create_layout_segment(file,horizontal_layout,design_parameters)
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
design_parameters = file.createIfcAlignmentVerticalSegment(
StartDistAlong=0.,
HorizontalLength=100.,
StartHeight=0.,
StartGradient=0.,
EndGradient=0.,
PredefinedType = "CONSTANTGRADIENT"
)
ifcopenshell.api.alignment.create_layout_segment(file,vertical_layout,design_parameters)
alignment_segment = horizontal_layout.IsNestedBy[0].RelatedObjects[0]
mapped_segments = _map_alignment_horizontal_segment(file,alignment_segment)
mapped_segment = mapped_segments[0]
assert len(mapped_segments) == 2
assert "DISCONTINUOUS" == mapped_segment.Transition
assert mapped_segment.Placement.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.Placement.RefDirection.DirectionRatios == pytest.approx((1.0, 0.0))
assert mapped_segment.SegmentStart.wrappedValue == pytest.approx(0.0)
assert mapped_segment.SegmentLength.wrappedValue == pytest.approx(100.0)
assert mapped_segment.ParentCurve.is_a("IfcSeventhOrderPolynomialSpiral")
assert mapped_segment.ParentCurve.Position.Location.Coordinates == pytest.approx((0.0, 0.0))
assert mapped_segment.ParentCurve.Position.RefDirection.DirectionRatios == pytest.approx((1.0,0.0))
assert mapped_segment.ParentCurve.SepticTerm == pytest.approx(78.8880838459446)
assert mapped_segment.ParentCurve.SexticTerm == pytest.approx(-63.7638813456506)
assert mapped_segment.ParentCurve.QuinticTerm == pytest.approx(57.7378785242934)
assert mapped_segment.ParentCurve.QuarticTerm == pytest.approx(-64.2314061308743)
assert mapped_segment.ParentCurve.CubicTerm == pytest.approx(-83.922298125931)
assert mapped_segment.ParentCurve.QuadraticTerm == pytest.approx(125.657906854859)
assert mapped_segment.ParentCurve.LinearTerm == pytest.approx(None)
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
def test_map_alignment_horizontal_segment():
file = ifcopenshell.file(schema="IFC4X3")
@@ -2098,8 +2608,14 @@ def test_map_alignment_horizontal_segment():
_SineCurve_100_0__1000__300_1_Meter(file)
_SineCurve_100_0_inf_300_1_Meter(file)
_SineCurve_100_0__inf__300_1_Meter(file)
# VIENESSE BEND NOT IMPLEMENTED
_VienneseBend_100_0_300_1000_1_Meter(file)
_VienneseBend_100_0__300__1000_1_Meter(file)
_VienneseBend_100_0_300_inf_1_Meter(file)
_VienneseBend_100_0__300__inf_1_Meter(file)
_VienneseBend_100_0_1000_300_1_Meter(file)
_VienneseBend_100_0__1000__300_1_Meter(file)
_VienneseBend_100_0_inf_300_1_Meter(file)
_VienneseBend_100_0__inf__300_1_Meter(file)
test_map_alignment_horizontal_segment()