Implement glue option and fuzzy tolerance in union#375
Conversation
Codecov Report
@@ Coverage Diff @@
## master #375 +/- ##
==========================================
- Coverage 95.52% 95.50% -0.02%
==========================================
Files 19 19
Lines 4777 4805 +28
==========================================
+ Hits 4563 4589 +26
- Misses 214 216 +2
Continue to review full report at Codecov.
|
|
For example consider the following example taken from Ex101 where interpPlates are unioned together: # EXAMPLE 3
# Points on hexagonal pattern coordinates, use of pushpoints.
r1 = 1.0
N = 3
ca = cos(30.0 * pi / 180.0)
sa = sin(30.0 * pi / 180.0)
# EVEN ROWS
pts = [
(-3.0, -3.0),
(-1.267949, -3.0),
(0.464102, -3.0),
(2.196152, -3.0),
(-3.0, 0.0),
(-1.267949, 0.0),
(0.464102, 0.0),
(2.196152, 0.0),
(-2.133974, -1.5),
(-0.401923, -1.5),
(1.330127, -1.5),
(3.062178, -1.5),
(-2.133975, 1.5),
(-0.401924, 1.5),
(1.330127, 1.5),
(3.062178, 1.5),
]
# Spike surface
thickness = 0.1
fn = 6
edge_points = [
[
r1 * cos(i * 2 * pi / fn + 30 * pi / 180),
r1 * sin(i * 2 * pi / fn + 30 * pi / 180),
]
for i in range(fn + 1)
]
surface_points = [
[
r1 / 4 * cos(i * 2 * pi / fn + 30 * pi / 180),
r1 / 4 * sin(i * 2 * pi / fn + 30 * pi / 180),
0.75,
]
for i in range(fn + 1)
] + [[0, 0, 2]]
edge_wire = cq.Workplane("XY").polyline(edge_points)
plate_3 = (
cq.Workplane("XY")
.pushPoints(pts)
.interpPlate(
edge_wire,
surface_points,
thickness,
combine=False,
clean=False,
degree=2,
nbPtsOnCur=20,
nbIter=2,
anisotropy=False,
tol2d=0.00001,
tol3d=0.0001,
tolAng=0.01,
tolCurv=0.1,
maxDeg=8,
maxSegments=9,
)
)
# TODO
plate_3 = [o.vals()[0] for o in plate_3.all()]
print("plate_3 = ", plate_3)
plate_3 = cq.Compound.makeCompound(plate_3)
print("plate_3 = ", plate_3)
#plate_3.exportStep('plate_3.stp')
plate_3 = cq.Workplane("XY").union(cq.CQ(plate_3), glue=True, tol=1e-2)
plate_3.val().exportStep('plate_3.stp')
# TODO
print("plate_3.val().Volume() = ", plate_3.val().Volume())
plate_3 = plate_3.translate((0, 4 * 11, 0))
show_object(plate_3)It crashes with standard |
|
I added the tol option @bragostin . Nice model BTW: |
jmwright
left a comment
There was a problem hiding this comment.
Looks good @adam-urbanczyk thanks for doing this!
|
Docstring is fixed, if CI passes the PR is ready for merging. |
|
@adam-urbanczyk I went ahead and merged since everything looked fine. |

Will resolve #374 . It will also enable advanced users to apply the fuzzy bool ops (see #184 ).