Hi list.
The following works fine
------
import cadquery as cq
PCB = cq.Workplane("front").lineTo(0, 53.3).lineTo(68.6, 53.3).lineTo(68.6,0).lineTo(0,0).close().extrude(1)
p_thickness = 3
PCB
# parameter definitions
ar_screw_height = 7.0
ar_screw_ID = 2.7
ar_screw_OD = 5.0
coord_holes = ((14,2.5),
( 15.3,50.7),
(66.1,33.5),
(66.1,7.6))
PCB = PCB.translate((0,0,ar_screw_height+p_thickness))
#PCB = PCB.faces(">Z").workplane().pushPoints(coord_holes).hole(ar_screw_ID)
post1 = cq.Workplane("XY").center(coord_holes[0][0],coord_holes[0][1]).circle(ar_screw_OD/2.0).circle(ar_screw_ID/2.0).extrude(1.0*(ar_screw_height+p_thickness),True)
post2 = cq.Workplane("XY").center(coord_holes[1][0],coord_holes[1][1]).circle(ar_screw_OD/2.0).circle(ar_screw_ID/2.0).extrude(1.0*(ar_screw_height+p_thickness),True)
post3 = cq.Workplane("XY").center(coord_holes[2][0],coord_holes[2][1]).circle(ar_screw_OD/2.0).circle(ar_screw_ID/2.0).extrude(1.0*(ar_screw_height+p_thickness),True)
post4 = cq.Workplane("XY").center(coord_holes[3][0],coord_holes[3][1]).circle(ar_screw_OD/2.0).circle(ar_screw_ID/2.0).extrude(1.0*(ar_screw_height+p_thickness),True)
arduino = PCB.union(post1).union(post2).union(post3).union(post4)
#arduino = arduino.faces(">Z").workplane(invert=False).pushPoints(coord_holes).hole(ar_screw_ID)
arduino
-----
But If i comment out
#PCB = PCB.faces(">Z").workplane(invert=False).pushPoints(coord_holes).hole(ar_screw_ID)
then I am failing on PCB.union command
21 arduino = PCB.union(post1).union(post2).union(post3).union(post4)
22 #arduino = arduino.faces(">Z").workplane(invert=False).pushPoints(coord_holes).hole(ar_screw_ID)
23 arduino
~/miniconda3/envs/jcq3/lib/python3.8/site-packages/cadquery/cq.py in union(self, toUnion, clean, glue, tol)
3312
3313 if clean:
-> 3314 r = r.clean()
3315
3316 return self.newObject([r])
~/miniconda3/envs/jcq3/lib/python3.8/site-packages/cadquery/occ_impl/shapes.py in clean(self)
391 upgrader = ShapeUpgrade_UnifySameDomain(self.wrapped, True, True, True)
392 upgrader.AllowInternalEdges(False)
--> 393 upgrader.Build()
394
395 return self.__class__(upgrader.Shape())
Standard_NullObject: BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt
and if I try to make holes after unification:
using
arduino = arduino.faces(">Z").workplane(invert=False).pushPoints(coord_holes).hole(ar_screw_ID)
I get the same error:
Standard_NullObject Traceback (most recent call last)
/tmp/ipykernel_7633/2009801332.py in <cell line: 22>()
20
21 arduino = PCB.union(post1).union(post2).union(post3).union(post4)
---> 22 arduino = arduino.faces(">Z").workplane(invert=False).pushPoints(coord_holes).hole(ar_screw_ID)
23 arduino
~/miniconda3/envs/jcq3/lib/python3.8/site-packages/cadquery/cq.py in hole(self, diameter, depth, clean)
2945 ) # local coordinates!
2946
-> 2947 return self.cutEach(lambda loc: h.moved(loc), True, clean)
2948
2949 # TODO: duplicated code with _extrude and extrude
~/miniconda3/envs/jcq3/lib/python3.8/site-packages/cadquery/cq.py in cutEach(self, fcn, useLocalCoords, clean)
2791
2792 if clean:
-> 2793 s = s.clean()
2794
2795 return self.newObject([s])
~/miniconda3/envs/jcq3/lib/python3.8/site-packages/cadquery/occ_impl/shapes.py in clean(self)
391 upgrader = ShapeUpgrade_UnifySameDomain(self.wrapped, True, True, True)
392 upgrader.AllowInternalEdges(False)
--> 393 upgrader.Build()
394
395 return self.__class__(upgrader.Shape())
Standard_NullObject: BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt
--
Is it a bug or I am missing something in the cadquerry logic?
Thanks.
Petro.
______________________________