Fix parts and add hole parameter
Fix move params Remove debugging frames
This commit is contained in:
parent
4cf33dae50
commit
6b30c60602
|
@ -11,51 +11,55 @@ class Parts:
|
|||
self.boxes = boxes
|
||||
"""
|
||||
def roundKnob(self, diameter, n=20, callback=None, move=""):
|
||||
size = diameter+diameter/n+2*spacing
|
||||
size = diameter+diameter/n
|
||||
if self.move(size, size, move, before=True):
|
||||
return
|
||||
self.boxes.ctx.save()
|
||||
self.moveTo(size/2, size/2)
|
||||
self.cc(callback, None, 0, 0)
|
||||
|
||||
self.boxes.ctx.restore()
|
||||
self.move(size, size, move, before=True)
|
||||
self.move(size, size, move)
|
||||
"""
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.boxes, name)
|
||||
|
||||
def disc(self, diameter, callback=None, move=""):
|
||||
def disc(self, diameter, hole=0, callback=None, move=""):
|
||||
size = diameter
|
||||
r = diameter/2.0
|
||||
if self.move(size, size, move, before=True):
|
||||
return
|
||||
self.moveTo(size/2, size/2)
|
||||
if hole:
|
||||
self.hole(0, 0, hole/2)
|
||||
self.cc(callback, None, 0, 0)
|
||||
self.moveTo(r+self.burn,0, 90)
|
||||
self.corner(360, r)
|
||||
self.move(size, size, move)
|
||||
|
||||
def waivyKnob(self, diameter, n=20, angle=45, callback=None, move=""):
|
||||
def waivyKnob(self, diameter, n=20, angle=45, hole=0, callback=None, move=""):
|
||||
size = diameter+pi*diameter/n
|
||||
if self.move(size, size, move, before=True):
|
||||
return
|
||||
self.moveTo(size/2, size/2)
|
||||
self.cc(callback, None, 0, 0)
|
||||
if hole:
|
||||
self.hole(0, 0, hole/2)
|
||||
self.moveTo(diameter/2, 0, angle)
|
||||
a, r = arcOnCircle(360./n, angle, diameter/2)
|
||||
a2, r2 = arcOnCircle(360./n, -angle, diameter/2)
|
||||
for i in range(n//2):
|
||||
self.boxes.corner(a, r)
|
||||
self.boxes.corner(a2, r2)
|
||||
self.move(size, size, move, before=True)
|
||||
self.move(size, size, move)
|
||||
|
||||
def concaveKnob(self, diameter, n=3, rounded=0.2, angle=70, callback=None, move=""):
|
||||
def concaveKnob(self, diameter, n=3, rounded=0.2, angle=70, hole=0,
|
||||
callback=None, move=""):
|
||||
size = diameter
|
||||
if self.move(size, size, move, before=True):
|
||||
return
|
||||
self.rectangularHole(size/2, size/2, size, size)
|
||||
self.moveTo(size/2, size/2)
|
||||
if hole:
|
||||
self.hole(0, 0, hole/2)
|
||||
self.cc(callback, None, 0, 0)
|
||||
self.moveTo(diameter/2, 0, 90+angle)
|
||||
a, r = arcOnCircle(360./n*(1-rounded), -angle, diameter/2)
|
||||
|
@ -67,6 +71,6 @@ class Parts:
|
|||
self.corner(360./n*rounded, diameter/2)
|
||||
self.corner(angle)
|
||||
|
||||
self.move(size, size, move, before=True)
|
||||
self.move(size, size, move)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue