import cadquery as cq
head_height = 120
head_width2 = 50
eye_height = 20
eye_offset = 40
eye_depth = 15
def eyesocket():
obj = cq.Workplane("XY").box(eye_height, 2.5 * eye_depth, head_width2 / 2)
obj = obj.translate([eye_height / 2, -head_width2 / 2, eye_depth / 2])
obj = obj.rotate((0, 0, 0), (1, 0, 0), 180)
obj = obj.translate([-eye_offset, 2, head_width2])
return obj
sock = eyesocket()
#show_object(sock, options={"alpha":0.8, "color": (123, 164, 223)})
head = cq.Workplane("XZ").lineTo(head_width2, 0)
head = head.ellipseArc(head_width2, head_height, angle1=0, angle2=90).close()
head = head.revolve(180, axisStart=(0, 0, 0), axisEnd=(0, 1, 0))
head = head.cut(sock)
head = head.cut(sock.translate((1.5 * eye_offset, 0, 0)))
print("Head has %r edges" % head.edges(">Y").size())
#head = head.chamfer(2)
show_object(head, options={"alpha":0.2, "color": (223, 223, 164)})
import cadquery as cq
head_height = 120
head_width2 = 50
eye_height = 20
eye_offset = 40
eye_depth = 15
def eyesocket():
obj = cq.Workplane("XY").box(eye_height, 2.5 * eye_depth, head_width2 / 2)
obj = obj.translate([eye_height / 2, -head_width2 / 2, eye_depth / 2])
obj = obj.rotate((0, 0, 0), (1, 0, 0), 180)
obj = obj.translate([-eye_offset, 2, head_width2])
return obj
sock = eyesocket()
#show_object(sock, options={"alpha":0.8, "color": (123, 164, 223)})
head = cq.Workplane("XZ").lineTo(head_width2, 0)
head = head.ellipseArc(head_width2, head_height, angle1=0, angle2=90).close()
head = head.revolve(180, axisStart=(0, 0, 0), axisEnd=(0, 1, 0))
head = head.cut(sock)
head = head.cut(sock.translate((1.5 * eye_offset, 0, 0)))
sel = "(not <Y) and (not <Z)"
print("Head has %r %s edges" % (head.edges(sel).size(), sel))
head = head.edges(sel).chamfer(2)
if head.findSolid().isValid():
print("head not valid")
show_object(head, options={"alpha":0.2, "color": (223, 223, 164)})
import cadquery as cq
head_height = 120
head_width2 = 50
eye_height = 20
eye_offset = 40
eye_depth = 15
def eyesocket():
obj = cq.Workplane("XY").box(eye_height, 2.5 * eye_depth, head_width2 / 2)
obj = obj.translate([eye_height / 2, -head_width2 / 2, eye_depth / 2])
obj = obj.rotate((0, 0, 0), (1, 0, 0), 180)
obj = obj.translate([-eye_offset, 2, head_width2])
return obj
sock = eyesocket()
#show_object(sock, options={"alpha":0.8, "color": (123, 164, 223)})
head = cq.Workplane("XZ").lineTo(head_width2, 0)
head = head.ellipseArc(head_width2, head_height, angle1=0, angle2=90).close()
head = head.revolve(180, axisStart=(0, 0, 0), axisEnd=(0, 1, 0))
head = head.cut(sock)
head = head.cut(sock.translate((1.5 * eye_offset, 0, 0)))
if head.findSolid().isValid():
print("head pre not valid")
if False:
sel = "(not <Y) and (not <Z)"
else:
sel = cq.selectors.BoxSelector(
(-head_width2, 1, 0),
(head_width2, 0.99*head_width2, 0.8*head_height),
boundingbox=True) # select just eye edges
print("Head has %r %s edges" % (head.edges(sel).size(), sel))
head = head.edges(sel).chamfer(2)
if head.findSolid().isValid():
print("head post not valid")
show_object(head, options={"alpha":0.2, "color": (223, 223, 164)})
--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/CAEcGQ%2BOacQ-e2NRKFT4gvVkvk5Lpw8%3DMEOB7OivmE4umK4xxNQ%40mail.gmail.com.
--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/CAEcGQ%2BNJQGJ5KE42UQb1Tgdq7g2-wsKbQMwTZU_jOJCm2r3UnA%40mail.gmail.com.