Skip to content

Commit 1867e6f

Browse files
committed
Update the custom sketch example
Some minor changes to comply with the tutorial on damogranlabs.com.
1 parent c70979e commit 1867e6f

File tree

2 files changed

+351
-256
lines changed

2 files changed

+351
-256
lines changed

examples/shape/custom.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import numpy as np
44

55
import classy_blocks as cb
6-
from classy_blocks.grading.autograding.grader import HighReGrader
76
from classy_blocks.types import PointType
87
from classy_blocks.util import functions as f
98

@@ -33,6 +32,8 @@ class RoundSquare(cb.MappedSketch):
3332
[21, 22, 23, 20],
3433
]
3534

35+
chops = [[0], [0, 1, 4, 5, 8, 12]]
36+
3637
def __init__(self, center: PointType, side: float, corner_round: float):
3738
center = np.array(center)
3839
points = [
@@ -56,17 +57,17 @@ def add_edges(self) -> None:
5657
self.faces[i].add_edge(1, cb.Angle(np.pi / 2, [0, 0, 1]))
5758

5859

59-
base_1 = RoundSquare([0, 0, 0], 1, 0.5)
60-
smoother = cb.SketchSmoother(base_1)
60+
base = RoundSquare([0, 0, 0], 1, 0.5)
61+
smoother = cb.SketchSmoother(base)
6162
smoother.smooth()
6263

63-
shape = cb.ExtrudedShape(base_1, 1)
64+
shape = cb.ExtrudedShape(base, 1)
65+
shape.chop(0, start_size=0.05)
66+
shape.chop(1, start_size=0.05)
67+
shape.chop(2, count=5)
6468

6569
mesh.add(shape)
6670
mesh.assemble()
6771

68-
grader = HighReGrader(mesh, 0.03)
69-
grader.grade(take="max")
70-
7172
mesh.set_default_patch("walls", "wall")
7273
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")

0 commit comments

Comments
 (0)