1
1
from typing import ClassVar , List , Optional
2
- import inspect
2
+
3
3
import numpy as np
4
4
5
+ from classy_blocks .base import transforms as tr
5
6
from classy_blocks .construct .edges import Origin , Spline
6
7
from classy_blocks .construct .flat .face import Face
7
8
from classy_blocks .construct .flat .sketches .disk import DiskBase
10
11
from classy_blocks .types import NPPointType , NPVectorType , PointType
11
12
from classy_blocks .util import constants
12
13
from classy_blocks .util import functions as f
13
- from classy_blocks .base import transforms as tr
14
14
15
15
16
16
class SplineRound (MappedSketch ):
@@ -30,12 +30,7 @@ class SplineRound(MappedSketch):
30
30
[1 , 2 ], # axis 1
31
31
]
32
32
33
- def __init__ (
34
- self ,
35
- side_1 : float ,
36
- side_2 : float ,
37
- ** kwargs
38
- ):
33
+ def __init__ (self , side_1 : float , side_2 : float , ** kwargs ):
39
34
"""
40
35
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
41
36
note the vectors from the center to corner 1 and 2 should be perpendicular.
@@ -49,8 +44,8 @@ def __init__(
49
44
self .side_1 = side_1
50
45
self .side_2 = side_2
51
46
52
- self .n_outer_spline_points = kwargs .get (' n_outer_spline_points' , self .n_outer_spline_points )
53
- self .n_straight_spline_points = kwargs .get (' n_straight_spline_points' , self .n_straight_spline_points )
47
+ self .n_outer_spline_points = kwargs .get (" n_outer_spline_points" , self .n_outer_spline_points )
48
+ self .n_straight_spline_points = kwargs .get (" n_straight_spline_points" , self .n_straight_spline_points )
54
49
55
50
@property
56
51
def center (self ):
@@ -120,7 +115,7 @@ def __init__(
120
115
corner_2_point : PointType ,
121
116
side_1 : float ,
122
117
side_2 : float ,
123
- ** kwargs
118
+ ** kwargs ,
124
119
) -> None :
125
120
"""
126
121
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
@@ -264,6 +259,7 @@ def add_edges(self) -> None:
264
259
265
260
class HalfSplineDisk (QuarterSplineDisk ):
266
261
"""Sketch for Half oval, elliptical and circular shapes"""
262
+
267
263
chops : ClassVar = [
268
264
[1 ], # axis 0
269
265
[1 , 2 , 5 ], # axis 1
@@ -276,7 +272,7 @@ def __init__(
276
272
corner_2_point : PointType ,
277
273
side_1 : float ,
278
274
side_2 : float ,
279
- ** kwargs
275
+ ** kwargs ,
280
276
) -> None :
281
277
"""
282
278
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
@@ -291,8 +287,9 @@ def __init__(
291
287
292
288
super ().__init__ (center_point , corner_1_point , corner_2_point , side_1 , side_2 , ** kwargs )
293
289
# Create quarter mirrored arround u_1
294
- other_quarter = QuarterSplineDisk (self .center , self .corner_2 , 2 * self .center - self .corner_1 ,
295
- side_2 , side_1 , ** kwargs )
290
+ other_quarter = QuarterSplineDisk (
291
+ self .center , self .corner_2 , 2 * self .center - self .corner_1 , side_2 , side_1 , ** kwargs
292
+ )
296
293
# Merge other_quarter to this quarter.
297
294
self .merge (other_quarter )
298
295
@@ -306,18 +303,20 @@ def grid(self) -> List[List[Face]]:
306
303
307
304
class SplineDisk (HalfSplineDisk ):
308
305
"""Sketch for full oval, elliptical and circular shapes"""
306
+
309
307
chops : ClassVar = [
310
308
[1 ], # axis 0
311
309
[1 , 2 , 5 , 7 , 8 , 11 ], # axis 1
312
310
]
311
+
313
312
def __init__ (
314
313
self ,
315
314
center_point : PointType ,
316
315
corner_1_point : PointType ,
317
316
corner_2_point : PointType ,
318
317
side_1 : float ,
319
318
side_2 : float ,
320
- ** kwargs
319
+ ** kwargs ,
321
320
) -> None :
322
321
"""
323
322
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
@@ -359,9 +358,8 @@ def __init__(
359
358
side_2 : float ,
360
359
width_1 : float ,
361
360
width_2 : float ,
362
- ** kwargs
361
+ ** kwargs ,
363
362
):
364
-
365
363
"""
366
364
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
367
365
Note the vectors from the center to corner 1 and 2 should be perpendicular.
@@ -401,7 +399,9 @@ def __init__(
401
399
p5 = corner_1
402
400
p5_2 = corner_1 + self .width_1 * u_1
403
401
p6 = center + (self .side_1 + 2 ** (- 1 / 2 ) * r_1 ) * u_1 + (self .side_2 + 2 ** (- 1 / 2 ) * r_2 ) * u_2
404
- p6_2 = center + (self .side_1 + 2 ** (- 1 / 2 ) * r_1_outer ) * u_1 + (self .side_2 + 2 ** (- 1 / 2 ) * r_2_outer ) * u_2
402
+ p6_2 = (
403
+ center + (self .side_1 + 2 ** (- 1 / 2 ) * r_1_outer ) * u_1 + (self .side_2 + 2 ** (- 1 / 2 ) * r_2_outer ) * u_2
404
+ )
405
405
406
406
quad_map = [
407
407
[2 , 3 , 1 , 0 ],
@@ -542,8 +542,10 @@ def add_edges(self) -> None:
542
542
self .shell [0 ].add_edge (3 , Origin (self .center ))
543
543
self .shell [1 ].add_edge (3 , Origin (self .center ))
544
544
545
+
545
546
class HalfSplineRing (QuarterSplineRing ):
546
547
"""Sketch for Half oval, elliptical and circular ring"""
548
+
547
549
chops : ClassVar = [
548
550
[0 ], # axis 0
549
551
[0 , 1 , 2 , 3 ], # axis 1
@@ -558,7 +560,7 @@ def __init__(
558
560
side_2 : float ,
559
561
width_1 : float ,
560
562
width_2 : float ,
561
- ** kwargs
563
+ ** kwargs ,
562
564
) -> None :
563
565
"""
564
566
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
@@ -574,13 +576,15 @@ def __init__(
574
576
"""
575
577
576
578
super ().__init__ (center_point , corner_1_point , corner_2_point , side_1 , side_2 , width_1 , width_2 , ** kwargs )
577
- other_quarter = QuarterSplineRing (self .center , self .corner_2 , 2 * self .center - self .corner_1 ,
578
- side_2 , side_1 , width_2 , width_1 , ** kwargs )
579
+ other_quarter = QuarterSplineRing (
580
+ self .center , self .corner_2 , 2 * self .center - self .corner_1 , side_2 , side_1 , width_2 , width_1 , ** kwargs
581
+ )
579
582
self .merge (other_quarter )
580
583
581
584
582
585
class SplineRing (HalfSplineRing ):
583
586
"""Sketch for full oval, elliptical and circular shapes"""
587
+
584
588
chops : ClassVar = [
585
589
[0 ], # axis 0
586
590
[0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ], # axis 1
@@ -595,7 +599,7 @@ def __init__(
595
599
side_2 : float ,
596
600
width_1 : float ,
597
601
width_2 : float ,
598
- ** kwargs
602
+ ** kwargs ,
599
603
) -> None :
600
604
"""
601
605
With a normal in x direction corner 1 will be in the y direction and corner 2 the z direction.
0 commit comments