CadQuery / CadQuery/cadquery

Cutting or splitting assemblies/compounds produces wrong result

Open
#966 1 comment 0 reactions 0 assignees View on GitHub
assembly
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Sample code

```python
import cadquery as cq

space = 19.05
cherryCutOutSize=14.05
cherrySize=14.58
cols = 2
rows = 4

width = cols * space
depth = rows * space
lip=3
height = 10
plateThickness=3

bottom = (cq.Workplane("XY")
.box(width,depth,height)
.faces("+Z")
.shell(lip)
.faces(">Z")
.wires(cq.selectors.AreaNthSelector(-1))
.toPending()
.workplane()
.extrude(1)
.faces(">Z")
.wires()
.item(0)
.toPending()
.workplane()
.offset2D(-lip/2)
.cutBlind(-plateThickness)
)

cherryCut = (cq.Workplane()
.box(cherryCutOutSize, cherryCutOutSize, plateThickness+2)

# Side cuts
.faces(">Z")
.edges("|Y")
.rect(1,4)
.cutThruAll()

# Potrusions
.faces(">Y or Y or Z")
.chamfer(0.2,0.4)
)

plate = (cq.Workplane("XY")
.box(width,depth,plateThickness)
.faces(">Z")
.workplane()
.rarray(space,space,cols,rows,True)
.cutEach(lambda loc: cherryCut.val().moved(loc).translate((0,0,-2)))
)

top = (cq.Workplane("XY")
.box(width,depth,height/2)
.faces("-Z")
.shell(lip)
.faces(">Z")
.rect(width-lip,depth-lip)
.cutThruAll()
.faces("Y").vertices(">Z").tag("refpoint")
bottom.faces("Y[-4]").tag("yface")
(keyboard
.constrain("bottom@faces@>Z", "plate@faces@Z", "switches@faces@Z", "caps@faces@Z", "top@faces@

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.