mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
ifcopenshell.alignment - fix error in Python 3.9
match statement was added only in Python 3.10
This commit is contained in:
@@ -203,67 +203,62 @@ class IfcAlignmentHelper:
|
|||||||
else:
|
else:
|
||||||
transition = "CONTSAMEGRADIENTSAMECURVATURE"
|
transition = "CONTSAMEGRADIENTSAMECURVATURE"
|
||||||
|
|
||||||
match _type:
|
if _type == "LINE":
|
||||||
case "LINE":
|
parent_curve = self._file.create_entity(
|
||||||
parent_curve = self._file.create_entity(
|
type="IfcLine",
|
||||||
type="IfcLine",
|
Pnt=self._file.create_entity(
|
||||||
Pnt=self._file.create_entity(
|
type="IfcCartesianPoint",
|
||||||
type="IfcCartesianPoint",
|
Coordinates=(0.0, 0.0),
|
||||||
Coordinates=(0.0, 0.0),
|
),
|
||||||
|
Dir=self._file.create_entity(
|
||||||
|
type="IfcVector",
|
||||||
|
Orientation=self._file.create_entity(
|
||||||
|
type="IfcDirection",
|
||||||
|
DirectionRatios=(1.0, 0.0),
|
||||||
),
|
),
|
||||||
Dir=self._file.create_entity(
|
Magnitude=1.0,
|
||||||
type="IfcVector",
|
),
|
||||||
Orientation=self._file.create_entity(
|
)
|
||||||
type="IfcDirection",
|
curve_segment = self._file.create_entity(
|
||||||
DirectionRatios=(1.0, 0.0),
|
type="IfcCurveSegment",
|
||||||
),
|
Transition=transition,
|
||||||
Magnitude=1.0,
|
Placement=self._file.create_entity(
|
||||||
|
type="IfcAxis2Placement2D",
|
||||||
|
Location=start_point,
|
||||||
|
RefDirection=self._file.createIfcDirection(
|
||||||
|
(math.cos(start_direction), math.sin(start_direction)),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
curve_segment = self._file.create_entity(
|
SegmentStart=self._file.createIfcLengthMeasure(0.0),
|
||||||
type="IfcCurveSegment",
|
SegmentLength=self._file.createIfcLengthMeasure(length),
|
||||||
Transition=transition,
|
ParentCurve=parent_curve,
|
||||||
Placement=self._file.create_entity(
|
)
|
||||||
type="IfcAxis2Placement2D",
|
result = (curve_segment, None)
|
||||||
Location=start_point,
|
elif _type == "CIRCULARARC":
|
||||||
RefDirection=self._file.createIfcDirection(
|
parent_curve = self._file.createIfcCircle(
|
||||||
(math.cos(start_direction), math.sin(start_direction)),
|
Position=self._file.createIfcAxis2Placement2D(
|
||||||
),
|
Location=self._file.createIfcCartesianPoint(Coordinates=(0.0, 0.0)),
|
||||||
),
|
RefDirection=self._file.createIfcDirection((math.cos(start_direction), math.sin(start_direction))),
|
||||||
SegmentStart=self._file.createIfcLengthMeasure(0.0),
|
),
|
||||||
SegmentLength=self._file.createIfcLengthMeasure(length),
|
Radius=abs(start_radius),
|
||||||
ParentCurve=parent_curve,
|
)
|
||||||
)
|
|
||||||
result = (curve_segment, None)
|
|
||||||
case "CIRCULARARC":
|
|
||||||
parent_curve = self._file.createIfcCircle(
|
|
||||||
Position=self._file.createIfcAxis2Placement2D(
|
|
||||||
Location=self._file.createIfcCartesianPoint(Coordinates=(0.0, 0.0)),
|
|
||||||
RefDirection=self._file.createIfcDirection(
|
|
||||||
(math.cos(start_direction), math.sin(start_direction))
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Radius=abs(start_radius),
|
|
||||||
)
|
|
||||||
|
|
||||||
curve_segment = self._file.create_entity(
|
curve_segment = self._file.create_entity(
|
||||||
type="IfcCurveSegment",
|
type="IfcCurveSegment",
|
||||||
Transition=transition,
|
Transition=transition,
|
||||||
Placement=self._file.create_entity(
|
Placement=self._file.create_entity(
|
||||||
type="IfcAxis2Placement2D",
|
type="IfcAxis2Placement2D",
|
||||||
Location=start_point,
|
Location=start_point,
|
||||||
RefDirection=self._file.createIfcDirection(
|
RefDirection=self._file.createIfcDirection((math.cos(start_direction), math.sin(start_direction))),
|
||||||
(math.cos(start_direction), math.sin(start_direction))
|
),
|
||||||
),
|
SegmentStart=self._file.createIfcLengthMeasure(0.0),
|
||||||
),
|
SegmentLength=self._file.createIfcLengthMeasure(length * start_radius / abs(start_radius)),
|
||||||
SegmentStart=self._file.createIfcLengthMeasure(0.0),
|
ParentCurve=parent_curve,
|
||||||
SegmentLength=self._file.createIfcLengthMeasure(length * start_radius / abs(start_radius)),
|
)
|
||||||
ParentCurve=parent_curve,
|
result = (curve_segment, None)
|
||||||
)
|
|
||||||
result = (curve_segment, None)
|
|
||||||
|
|
||||||
case _:
|
else:
|
||||||
result = (None, None)
|
result = (None, None)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user