Skip to content

Commit e4fddaf

Browse files
authored
Make Y Configuration the Default for 3RP (#116)
* change default to Y configuration * change default in rp plot
1 parent 8484479 commit e4fddaf

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

Diff for: pyroll/core/profile/hookimpls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def width(self: Profile):
1919
@Profile.height
2020
def height_3fold(self: Profile):
2121
if "3fold" in self.classifiers:
22-
return (self.cross_section.centroid.y - self.cross_section.bounds[1]) * 2
22+
return (self.cross_section.bounds[3] - self.cross_section.centroid.y) * 2
2323

2424

2525
@Profile.width
2626
def width_3fold(self: Profile):
2727
if "3fold" in self.classifiers:
28-
return (self.cross_section.bounds[3] - self.cross_section.centroid.y) * 2
28+
return (self.cross_section.centroid.y - self.cross_section.bounds[1]) * 2
2929

3030

3131
@Profile.equivalent_height

Diff for: pyroll/core/roll_pass/hookimpls/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def out_cross_section3(rp: ThreeRollPass, width: float) -> Polygon:
1717
poly = Polygon(np.concatenate([cl.coords for cl in rp.contour_lines]))
1818

1919
for _ in range(3):
20-
poly = clip_by_rect(poly, -math.inf, -math.inf, math.inf, width / 2)
20+
poly = clip_by_rect(poly, -math.inf, -width / 2, math.inf, math.inf)
2121
poly = rotate(poly, angle=120, origin=(0, 0))
2222

2323
return poly

Diff for: pyroll/core/roll_pass/hookimpls/profile.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import math
2-
3-
import numpy as np
4-
from scipy.optimize import root_scalar, fixed_point
5-
from shapely.affinity import rotate
1+
from scipy.optimize import fixed_point
62
from shapely.geometry import Polygon
7-
from shapely.ops import clip_by_rect
83

94
from ..roll_pass import RollPass
105
from ..three_roll_pass import ThreeRollPass
@@ -83,7 +78,7 @@ def cross_section(self: RollPass.OutProfile) -> Polygon:
8378
@ThreeRollPass.OutProfile.cross_section
8479
def cross_section3(self: ThreeRollPass.OutProfile) -> Polygon:
8580
cs = helpers.out_cross_section3(self.roll_pass, self.width)
86-
if (cs.bounds[3] - cs.centroid.y) * 2.02 < self.width:
81+
if (-cs.bounds[1] + cs.centroid.y) * 2.02 < self.width:
8782
raise ValueError(
8883
"Profile's width can not be larger than its contour lines."
8984
"May be caused by critical overfilling."

Diff for: pyroll/core/roll_pass/hookimpls/roll_pass.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def height3(self):
112112
self.roll.groove.usable_width / 2,
113113
math.inf
114114
)
115-
return -2 * usable_contour.bounds[1]
115+
return 2 * usable_contour.bounds[3]
116116

117117

118118
@RollPass.volume

Diff for: pyroll/core/roll_pass/roll_pass.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,19 @@ def plot(self, **kwargs):
242242
ax.grid(lw=0.5)
243243

244244
def oriented(geom):
245-
if isinstance(self.orientation, int) and self.orientation != 0:
246-
return rotate(geom, self.orientation, (0, 0))
247-
elif self.orientation == 0:
248-
return geom
249-
elif self.orientation.lower() in ["horizontal", "h", "antiy", "ay"]:
250-
return geom
251-
elif self.orientation.lower() in ["vertical", "v"]:
252-
return rotate(geom, 90, (0, 0))
253-
elif self.orientation.lower() in ["y"]:
254-
return rotate(geom, 180, (0, 0))
245+
orientation = self.orientation
246+
247+
if isinstance(orientation, str):
248+
if orientation.lower() in ["horizontal", "h", "y"]:
249+
orientation = 0
250+
elif orientation.lower() in ["vertical", "v"]:
251+
orientation = 90
252+
elif orientation.lower() in ["antiy", "ay"]:
253+
orientation = 180
254+
255+
if orientation != 0:
256+
return rotate(geom, orientation, (0, 0))
257+
return geom
255258

256259
artists = []
257260

Diff for: pyroll/core/roll_pass/three_roll_pass.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def contour_lines(self) -> List[LineString]:
1818
return self._contour_lines
1919

2020
shift = self.roll.groove.usable_width / 2 / np.sqrt(3) + self.gap / np.sqrt(3)
21-
lower = rotate(translate(self.roll.contour_line, yoff=shift), angle=180, origin=(0, 0))
22-
lower = LineString(lower.coords[::-1]) # get back coordinate order
23-
right = rotate(lower, angle=120, origin=(0, 0))
24-
left = rotate(lower, angle=-120, origin=(0, 0))
21+
upper = translate(self.roll.contour_line, yoff=shift)
22+
upper = LineString(upper.coords[::-1]) # get back coordinate order
23+
right = rotate(upper, angle=-120, origin=(0, 0))
24+
left = rotate(upper, angle=120, origin=(0, 0))
2525

26-
self._contour_lines = [left, lower, right]
26+
self._contour_lines = [right, upper, left]
2727
return self._contour_lines
2828

2929
@property

0 commit comments

Comments
 (0)