Modeling an object made from a bent plate that wasn't rectangular before bending. #1996
Unanswered
filip-zyzniewski
asked this question in
Q&A
Replies: 2 comments 8 replies
-
|
Here is another version. This used loft instead of sweep. from math import sqrt, tan, radians
from cadquery.func import *
HEIGHT = 10
THICKNESS = 0.2
BEND_RADIUS = 0.2
CUT_ANGLE = 15
# 2D wire
pts1 = [
(0, 0),
(10, 0),
(10, 10),
(5, 10),
(5, 10 + BEND_RADIUS * 2),
(15, 10 + BEND_RADIUS * 2),
]
path1 = polyline(*pts1)
path1.move(z=-5)
# 3D path z decreases by CUT_ANGLE along path
distances = [0.0]
for i in range(1, len(pts1)):
dx = pts1[i][0] - pts1[i - 1][0]
dy = pts1[i][1] - pts1[i - 1][1]
distances.append(distances[-1] + sqrt(dx * dx + dy * dy))
pts2 = [
(x, y, HEIGHT / 2 - d * tan(radians(CUT_ANGLE)))
for (x, y), d in zip(pts1, distances)
]
path2 = polyline(*pts2)
# wire fillet
path1b = path1.fillet2D(BEND_RADIUS, path1.Vertices()[1:-1])
path2b = path2.fillet(BEND_RADIUS, path2.Vertices()[1:-1])
# create shell
res_loft = loft(path1b, path2b)
# thicken faces
res = compound(
[f.thicken(-THICKNESS / 2.0) + f.thicken(THICKNESS / 2.0) for f in res_loft]
)
res = clean(res) |
Beta Was this translation helpful? Give feedback.
8 replies
-
|
Regarding the fillet, there are two problems:
Try this with fillet_edges = sh.edges("|Y").edges(">Z")
fillet_edges = compound(fillet_edges + sh.edges("|Y").edges("<Z").edges(">X"))
sh = fillet(sh, fillet_edges, BEND_RADIUS - 1e-3) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment




Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am a cadquery beginner and I am trying to model a quite complex object made of metal sheets, cut and bent.

This is a fragment of this object:
I have marked challenging edges with blue and red lines.
Do you have any advice on modeling this?
I have prepared a synthetic example and implemented a naive approach:
I have also uploaded this script here as a pull request to facilitate commenting on particular line ranges.
Resulting object looks like this:

I find this approach very verbose, naive and brittle.
Do you have any recommendations about improving it?
I was thinking about building the
cutoutsby sweeping thecut_facein one go along another path built fromsweep_path, but I have no idea how to build that another path (especially the edges where the material bends).Beta Was this translation helpful? Give feedback.
All reactions