コード例 #1
0
ファイル: Stepper.py プロジェクト: bjbsquared/cad
def stepper_mount_holes(d):
  conf=d["stepper"]
  thickness=d["thickness"]
  group=g();
  
  r=rect(2*conf["width"]/3,0,conf["width"]/3,thickness)
  r.set_style(Styles.get_cut_style(d))
  group.addElement(r);

  r=rect(0,0,conf["width"]/3,thickness)
  r.set_style(Styles.get_cut_style(d))
  group.addElement(r);

  return group
コード例 #2
0
ファイル: Base.py プロジェクト: bjbsquared/cad
def solenoid_hole(d):
  conf=d["solenoid"]
  x=0
  y=0
  trough_width = 8
  trough_length= 8
  s_width=conf["width"]
  s_length=conf["length"]
  lip = (conf["width"]-trough_width)/2


  p = path("M%f,%f" % (x,y))
  p.appendLineToPath(x+s_width,y,False)
  p.appendLineToPath(x+s_width,y+s_length,False)
  p.appendLineToPath(x+s_width-lip,y+s_length,False)
  p.appendLineToPath(x+s_width-lip,y+s_length+trough_length,False)
  p.appendLineToPath(x+lip,y+s_length+trough_length,False)
  p.appendLineToPath(x+lip,y+s_length,False)
  p.appendLineToPath(x,y+s_length,False)
  p.appendLineToPath(x,y,False)
  p.set_style(Styles.get_cut_style(d))
  
  #bbox=(s_length+trough_length, s_width)
  conf["total_length"]=s_length+trough_length
  conf["total_width"]=s_width
  return p
コード例 #3
0
ファイル: Stepper.py プロジェクト: bjbsquared/cad
def stepper_support(d):
  group=g();
  conf=d["stepper"]
  thickness=d["thickness"]
  conf["support_height"]=thickness+conf["height"]+thickness
  x=0
  y=0
  p = path("M%f,%f" % (x,y))
  p.appendLineToPath(conf["width"]/3,0)
  p.appendLineToPath(0,thickness)
  p.appendLineToPath(conf["width"]/3,0)
  p.appendLineToPath(0,-thickness)
  p.appendLineToPath(conf["width"]/3,0)
  p.appendLineToPath(0,conf["support_height"])
  p.appendLineToPath(-conf["width"]/3,0)
  p.appendLineToPath(0,-thickness)
  p.appendLineToPath(-conf["width"]/3,0)
  p.appendLineToPath(0,+thickness)
  p.appendLineToPath(-conf["width"]/3,0)
  p.appendLineToPath(0,-conf["support_height"])
  p.set_style(Styles.get_cut_style(d))
  group.addElement(p)
 
  #bush mounting
  c=circle(conf["width"]/2,conf["support_height"]/2,conf["bush_radius"])
  c.set_style(Styles.get_cut_style(d))
  group.addElement(c)

  #mount holes
  import math
  mount_x=math.sqrt(math.pow(conf["mount_hole_distance"],2)/2)
  mount_y=mount_x
  for x in -mount_x, mount_x:
    for y in -mount_y, mount_y:
      c=circle(conf["width"]/2+x,conf["support_height"]/2+y,conf["hole_radius"])
      c.set_style(Styles.get_cut_style(d))
      group.addElement(c)

  return group;
コード例 #4
0
ファイル: Base.py プロジェクト: bjbsquared/cad
def base_outline(d):
  conf=d["base"]
  r=rect(0,0,conf["width"],conf["length"],5,5) #rounded corners
  r.set_style(Styles.get_cut_style(d))
  return r