Closed
Description
If I have the same set of points on two different surfaces, how can I write a constraint so the locations of the points match? Specifically, consider this example:
import cadquery as Cq
points = [
(5, 5),
(-5, 5),
(5, -5)
]
box = (
Cq.Workplane('XY')
.box(20, 20, 2, centered=[True, True, False])
.faces('>Z')
.workplane()
.pushPoints(points)
.hole(2)
.tag("mate")
)
cylinder = (
Cq.Workplane('XY')
.cylinder(2, 10, centered=[True, True, False])
.faces('>Z')
.workplane()
.pushPoints(points)
.cboreHole(3, cboreDiameter=5, cboreDepth=1)
.tag("mate")
)
result = (
Cq.Assembly()
.add(box, name="box")
.add(cylinder, name="cyl")
.constrain("box?mate", "cyl?mate", "Point")
)
show_object(result)
In this case the two geometries overlap, but I want the <Z
side of the cylinder to mate onto the >Z
side of the box. I cannot simply create a new workspace and call pushPoints
because points are not supported for the Point
constraint.