Skip to content

Commit

Permalink
Update the custom sketch example
Browse files Browse the repository at this point in the history
Some minor changes to comply with the tutorial on damogranlabs.com.
  • Loading branch information
FranzBangar committed Nov 12, 2024
1 parent c70979e commit 1867e6f
Show file tree
Hide file tree
Showing 2 changed files with 351 additions and 256 deletions.
15 changes: 8 additions & 7 deletions examples/shape/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np

import classy_blocks as cb
from classy_blocks.grading.autograding.grader import HighReGrader
from classy_blocks.types import PointType
from classy_blocks.util import functions as f

Expand Down Expand Up @@ -33,6 +32,8 @@ class RoundSquare(cb.MappedSketch):
[21, 22, 23, 20],
]

chops = [[0], [0, 1, 4, 5, 8, 12]]

def __init__(self, center: PointType, side: float, corner_round: float):
center = np.array(center)
points = [
Expand All @@ -56,17 +57,17 @@ def add_edges(self) -> None:
self.faces[i].add_edge(1, cb.Angle(np.pi / 2, [0, 0, 1]))


base_1 = RoundSquare([0, 0, 0], 1, 0.5)
smoother = cb.SketchSmoother(base_1)
base = RoundSquare([0, 0, 0], 1, 0.5)
smoother = cb.SketchSmoother(base)
smoother.smooth()

shape = cb.ExtrudedShape(base_1, 1)
shape = cb.ExtrudedShape(base, 1)
shape.chop(0, start_size=0.05)
shape.chop(1, start_size=0.05)
shape.chop(2, count=5)

mesh.add(shape)
mesh.assemble()

grader = HighReGrader(mesh, 0.03)
grader.grade(take="max")

mesh.set_default_patch("walls", "wall")
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")
Loading

0 comments on commit 1867e6f

Please sign in to comment.