def plank_yz_bottom(c):
  """ Create the FreeCAD Part Object plank_yz_bottom
  """
  # plank_yz_bottom_outline
  plank_yz_bottom_outline = []
  plank_yz_bottom_outline.append([0*c['box_depth']+1*c['plank_height'], 0*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']]) #0
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c), 0*c['box_depth'], 1)) #1-2
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c), 1*c['box_depth'],-1))
  plank_yz_bottom_outline.append([1*c['box_depth']-1*c['plank_height'], 0*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_bot_yz_with_xz(c),  1*c['box_depth'], -1))
  plank_yz_bottom_outline.append([1*c['box_depth']-1*c['plank_height'], 1*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_zx(c),
    1*c['box_depth']-1*c['plank_height'], -1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),
    1*c['box_depth']-1*c['plank_height'], -1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),
    0*c['box_depth']+1*c['plank_height'],  1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_zx(c),
    0*c['box_depth']+1*c['plank_height'],  1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_yz_bottom_outline.append([0*c['box_depth']+1*c['plank_height'], 1*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_yz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_bot_yz_with_xz(c),  0*c['box_depth'],  1))
  plank_yz_bottom_A = cnc25d_api.outline_close(plank_yz_bottom_outline)
  r_fig = [plank_yz_bottom_A]
  r_fig.extend(plank_yz_bottom_hole(c))
  return(r_fig)
def plank_xz_top(c):
  """ Create the FreeCAD Part Object plank_xz_top
  """
  # plank_xz_top_outline
  plank_xz_top_outline = []
  plank_xz_top_outline.append([0*c['box_width'], 0*c['h_plank_width'], 0*c['router_bit_radius']]) #0
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),             0*c['box_width'], 1)) #1-4
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),  0*c['box_width'], 1)) #5-8
  for i in range(c['module_width']-1):
    plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),  (i+1)*c['box_width']+1.0/2*c['v_plank_width'], -1))
    plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_middle_zx(c),      (i+1)*c['box_width'],  1))
    plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),  (i+1)*c['box_width']-1.0/2*c['v_plank_width'], 1))
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),  c['module_width']*c['box_width'], -1)) #9-12
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),             c['module_width']*c['box_width'], -1)) #13-16
  plank_xz_top_outline.append([c['module_width']*c['box_width'], 0*c['plank_height'], 0*c['router_bit_radius']]) #17
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_top_xz_with_yz(c),         c['module_width']*c['box_width'], -1)) #18-21
  plank_xz_top_outline.append([c['module_width']*c['box_width'], 1*c['h_plank_width'], 0*c['router_bit_radius']]) #22
  for i in range(c['module_width']):
    plank_xz_top_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_fitting(c)[::-1],    (c['module_width']-i)*c['box_width'], -1, c['h_plank_width'], 1)) #23-24
    plank_xz_top_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_fitting(c)[::-1],  (c['module_width']-1-i)*c['box_width'],  1, c['h_plank_width'], 1)) #25-26
  plank_xz_top_outline.append([0*c['box_width'], 1*c['h_plank_width'], 0*c['router_bit_radius']]) #27
  plank_xz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_top_xz_with_yz(c),         0*c['box_width'],  1)) #28-31
  plank_xz_top_A = cnc25d_api.outline_close(plank_xz_top_outline)
  # final build of  the plank plank_xz_top
  r_fig = [plank_xz_top_A]
  r_fig.extend(plank_xz_top_hole(c))
  return(r_fig)
Esempio n. 3
0
def plank_zx_middle(c):
    """ Create the FreeCAD Part Object plank_zx_middle
  """
    #plank_z_side_length = c['box_height'] - 2*c['h_plank_width'] - c['fitting_height'] + 2*c['crenel_depth']
    plank_z_side_length = c['plank_z_length']
    plank_zx_middle_outline = []
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c),
                                    0 * plank_z_side_length, 1,
                                    0 * c['v_plank_width'], 1))
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c),
                                    1 * plank_z_side_length, -1,
                                    0 * c['v_plank_width'], 1))
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_zx_with_xz(c),
                                   1 * plank_z_side_length, -1))
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c),
                                    1 * plank_z_side_length, -1,
                                    1 * c['v_plank_width'], -1))
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c),
                                    0 * plank_z_side_length, 1,
                                    1 * c['v_plank_width'], -1))
    plank_zx_middle_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_zx_with_xz(c),
                                   0 * plank_z_side_length, 1))
    plank_zx_middle_A = cnc25d_api.outline_close(plank_zx_middle_outline)
    r_fig = [plank_zx_middle_A]
    return (r_fig)
Esempio n. 4
0
def plank_yz_top(c):
    """ Create the FreeCAD Part Object plank_yz_top
  """
    # plank_yz_top_outline
    plank_yz_top_outline = []
    plank_yz_top_outline.append([
        0 * c['box_depth'] + 1 * c['plank_height'], 0 * c['h_plank_width'],
        0 * c['router_bit_radius']
    ])  #0
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),
                                   0 * c['box_depth'] + 1 * c['plank_height'],
                                   1))  #1-4
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                   0 * c['box_depth'] + 1 * c['plank_height'],
                                   1))  #5-8
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                   1 * c['box_depth'] - 1 * c['plank_height'],
                                   -1))  #9-12
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),
                                   1 * c['box_depth'] - 1 * c['plank_height'],
                                   -1))  #13-16
    plank_yz_top_outline.append([
        1 * c['box_depth'] - 1 * c['plank_height'], 0 * c['plank_height'],
        0 * c['router_bit_radius']
    ])  #17
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_top_yz_with_xz(c),
                                   1 * c['box_depth'], -1))  #18-21
    plank_yz_top_outline.append([
        1 * c['box_depth'] - 1 * c['plank_height'], 1 * c['h_plank_width'],
        0 * c['router_bit_radius']
    ])  #22
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_fitting(c)[::-1], 1 * c['box_depth'], -1,
            c['h_plank_width'], 1))  #23-24
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_fitting(c)[::-1], 0 * c['box_depth'], 1,
            c['h_plank_width'], 1))  #25-26
    plank_yz_top_outline.append([
        0 * c['box_depth'] + 1 * c['plank_height'], 1 * c['h_plank_width'],
        0 * c['router_bit_radius']
    ])  #27
    plank_yz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_top_yz_with_xz(c),
                                   0 * c['box_depth'], 1))  #28-31
    plank_yz_top_A = cnc25d_api.outline_close(plank_yz_top_outline)
    r_fig = [plank_yz_top_A]
    r_fig.extend(plank_yz_top_hole(c))
    return (r_fig)
def slab_side(c, nai_type):
  """ Create the FreeCAD Part Object slab_side
  """
  slab_length = c['slab_side_length']
  if(nai_type=='left_right'):
    slab_width = c['slab_side_left_right_width']
  elif(nai_type=='rear_single'):
    slab_width = c['slab_side_rear_single_width']
  elif(nai_type=='rear_side'):
    slab_width = c['slab_side_rear_side_width']
  elif(nai_type=='rear_middle'):
    slab_width = c['slab_side_rear_middle_width']
  slab_side_outline = []
  slab_side_outline.append([0*slab_length+1*c['cutting_extra'], 0*slab_width+1*c['cutting_extra'], 0])
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_horizontal(c), 0*slab_length, 1, 0*slab_width, 1))
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_horizontal(c), 1*slab_length,-1, 0*slab_width, 1))
  slab_side_outline.append([1*slab_length-1*c['cutting_extra'], 0*slab_width+1*c['cutting_extra'], 0])
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_vertical(c), 1*slab_length,-1, 0*slab_width, 1))
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_vertical(c), 1*slab_length,-1, 1*slab_width,-1))
  slab_side_outline.append([1*slab_length-1*c['cutting_extra'], 1*slab_width-1*c['cutting_extra'], 0])
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_horizontal(c), 1*slab_length, -1, 1*slab_width,-1))
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_horizontal(c), 0*slab_length,  1, 1*slab_width,-1))
  slab_side_outline.append([0*slab_length+1*c['cutting_extra'], 1*slab_width-1*c['cutting_extra'], 0])
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_vertical(c), 0*slab_length, 1, 1*slab_width,-1))
  slab_side_outline.extend(cnc25d_api.outline_shift_xy(jonction_slab_side_with_wall_diagonal_vertical(c), 0*slab_length, 1, 0*slab_width, 1))
  slab_side_A = cnc25d_api.outline_close(slab_side_outline)
  r_fig = [slab_side_A]
  return(r_fig)
def plank_zx_middle(c):
  """ Create the FreeCAD Part Object plank_zx_middle
  """
  #plank_z_side_length = c['box_height'] - 2*c['h_plank_width'] - c['fitting_height'] + 2*c['crenel_depth']
  plank_z_side_length = c['plank_z_length']
  plank_zx_middle_outline = []
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c), 0*plank_z_side_length, 1, 0*c['v_plank_width'], 1))
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c), 1*plank_z_side_length,-1, 0*c['v_plank_width'], 1))
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_zx_with_xz(c), 1*plank_z_side_length,-1))
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c), 1*plank_z_side_length,-1, 1*c['v_plank_width'], -1))
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_zx_with_wall_diagonal(c), 0*plank_z_side_length, 1, 1*c['v_plank_width'], -1))
  plank_zx_middle_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_zx_with_xz(c), 0*plank_z_side_length, 1))
  plank_zx_middle_A = cnc25d_api.outline_close(plank_zx_middle_outline)
  r_fig = [plank_zx_middle_A]
  return(r_fig)
def plank_xz_bottom(c):
  """ Create the FreeCAD Part Object plank_xz_bottom
  """
  # plank_xz_bottom_outline
  plank_xz_bottom_outline = []
  plank_xz_bottom_outline.append([0*c['box_width'], 0*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']]) #0
  for i in range(c['module_width']):
    plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),              i*c['box_width'], 1)) #1-2
    plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),          (i+1)*c['box_width'],-1))
  plank_xz_bottom_outline.append([c['module_width']*c['box_width'], 0*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_bot_xz_with_yz(c),          c['module_width']*c['box_width'], -1))
  plank_xz_bottom_outline.append([c['module_width']*c['box_width'], 1*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_zx(c),             c['module_width']*c['box_width'], -1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),  c['module_width']*c['box_width'], -1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  for i in range(c['module_width']-1):
    plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),  (c['module_width']-i-1)*c['box_width']-1.0/2*c['v_plank_width'],  1, 1*(c['h_plank_width']+c['fitting_height']), -1))
    plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_middle_zx(c),      (c['module_width']-i-1)*c['box_width'], 1, 1*(c['h_plank_width']+c['fitting_height']), -1))
    plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),  (c['module_width']-i-1)*c['box_width']+1.0/2*c['v_plank_width'], -1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c),  0*c['box_width'],  1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_with_zx(c),             0*c['box_width'],  1, 1*(c['h_plank_width']+c['fitting_height']), -1))
  plank_xz_bottom_outline.append([0*c['box_width'], 1*(c['h_plank_width']+c['fitting_height']), 0*c['router_bit_radius']])
  plank_xz_bottom_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_bot_xz_with_yz(c),          0*c['box_width'],  1))
  plank_xz_bottom_A = cnc25d_api.outline_close(plank_xz_bottom_outline)
  r_fig = [plank_xz_bottom_A]
  r_fig.extend(plank_xz_bottom_hole(c))
  return(r_fig)
def plank_yz_top(c):
  """ Create the FreeCAD Part Object plank_yz_top
  """
  # plank_yz_top_outline
  plank_yz_top_outline = []
  plank_yz_top_outline.append([0*c['box_depth']+1*c['plank_height'], 0*c['h_plank_width'], 0*c['router_bit_radius']]) #0
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),            0*c['box_depth']+1*c['plank_height'], 1)) #1-4
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c), 0*c['box_depth']+1*c['plank_height'], 1)) #5-8
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c), 1*c['box_depth']-1*c['plank_height'], -1)) #9-12
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),            1*c['box_depth']-1*c['plank_height'], -1)) #13-16
  plank_yz_top_outline.append([1*c['box_depth']-1*c['plank_height'], 0*c['plank_height'], 0*c['router_bit_radius']]) #17
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_top_yz_with_xz(c),            1*c['box_depth'], -1)) #18-21
  plank_yz_top_outline.append([1*c['box_depth']-1*c['plank_height'], 1*c['h_plank_width'], 0*c['router_bit_radius']]) #22
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_fitting(c)[::-1], 1*c['box_depth'], -1, c['h_plank_width'], 1)) #23-24
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_xy(jonction_plank_xz_fitting(c)[::-1], 0*c['box_depth'],  1, c['h_plank_width'], 1)) #25-26
  plank_yz_top_outline.append([0*c['box_depth']+1*c['plank_height'], 1*c['h_plank_width'], 0*c['router_bit_radius']]) #27
  plank_yz_top_outline.extend(cnc25d_api.outline_shift_x(jonction_plank_top_yz_with_xz(c),            0*c['box_depth'],  1)) #28-31
  plank_yz_top_A = cnc25d_api.outline_close(plank_yz_top_outline)
  r_fig = [plank_yz_top_A]
  r_fig.extend(plank_yz_top_hole(c))
  return(r_fig)
Esempio n. 9
0
def gearbar_2d_construction(c):
    """
  construct the 2D-figures with outlines at the A-format for the gearbar design
  """
    ### gearbar outline
    if (c['gear_tooth_nb'] > 0):
        i_gear_profile = inherit_gear_profile()  # inherit from gear_profile
        i_gear_profile.apply_external_constraint(gear_profile_constraint(c))
        gear_profile_A = i_gear_profile.get_A_figure('first_gear')[
            0]  # Warning: gear_profile provide only B-format outline currently
        gear_profile_A = cnc25d_api.outline_rotate(
            gear_profile_A, c['g1_ix'], c['g1_iy'],
            -1 * c['g1_inclination'] + math.pi / 2)
        gear_profile_A = cnc25d_api.outline_shift_xy(
            gear_profile_A, -1 * gear_profile_A[0][0], 1,
            -1 * c['g1_iy'] + c['gearbar_height'], 1
        )  # gearbar_fig inclinatiion is always zero. Inclination only visible in simulation
    else:
        gear_profile_A = [(0, c['gearbar_height']),
                          (c['gearbar_length'], c['gearbar_height'])]
    gearbar_outline = gear_profile_A
    gearbar_outline.append((gearbar_outline[-1][0], 0))
    gearbar_outline.append((0, 0))
    gearbar_outline.append((0, gearbar_outline[0][1]))
    #print("dbg200: gearbar_outline:", gearbar_outline)
    ### gearbar-hole figure
    gearbar_hole_figure = []
    if ((c['gearbar_hole_radius'] > 0) and (c['pi_module'] > 0)):
        hole_x = c[
            'first_tooth_position'] + c['gearbar_hole_offset'] * c['pi_module']
        while (hole_x < (c['gearbar_length'] - c['gearbar_hole_radius'])):
            #print("dbg312: hole_x {:0.3f}".format(hole_x))
            gearbar_hole_figure.append([
                hole_x, c['gearbar_hole_height_position'],
                c['gearbar_hole_radius']
            ])
            hole_x += c['gearbar_hole_increment'] * c['pi_module']

    ### design output
    gb_figure = [gearbar_outline]
    gb_figure.extend(gearbar_hole_figure)
    ###
    r_figures = {}
    r_height = {}
    #
    r_figures['gearbar_fig'] = gb_figure
    r_height['gearbar_fig'] = c['gear_profile_height']
    ###
    return ((r_figures, r_height))
Esempio n. 10
0
def gearbar_2d_construction(c):
  """
  construct the 2D-figures with outlines at the A-format for the gearbar design
  """
  ### gearbar outline
  if(c['gear_tooth_nb']>0):
    i_gear_profile = inherit_gear_profile() # inherit from gear_profile
    i_gear_profile.apply_external_constraint(gear_profile_constraint(c))
    gear_profile_A = i_gear_profile.get_A_figure('first_gear')[0] # Warning: gear_profile provide only B-format outline currently
    gear_profile_A = cnc25d_api.outline_rotate(gear_profile_A, c['g1_ix'], c['g1_iy'], -1*c['g1_inclination'] + math.pi/2)
    gear_profile_A = cnc25d_api.outline_shift_xy(gear_profile_A, -1*gear_profile_A[0][0], 1, -1*c['g1_iy'] + c['gearbar_height'], 1) # gearbar_fig inclinatiion is always zero. Inclination only visible in simulation
  else:
    gear_profile_A = [(0, c['gearbar_height']),(c['gearbar_length'], c['gearbar_height'])]
  gearbar_outline = gear_profile_A
  gearbar_outline.append((gearbar_outline[-1][0], 0))
  gearbar_outline.append((0, 0))
  gearbar_outline.append((0, gearbar_outline[0][1]))
  #print("dbg200: gearbar_outline:", gearbar_outline)
  ### gearbar-hole figure
  gearbar_hole_figure = []
  if((c['gearbar_hole_radius']>0)and(c['pi_module']>0)):
    hole_x = c['first_tooth_position'] + c['gearbar_hole_offset'] * c['pi_module']
    while(hole_x<(c['gearbar_length']-c['gearbar_hole_radius'])):
      #print("dbg312: hole_x {:0.3f}".format(hole_x))
      gearbar_hole_figure.append([hole_x, c['gearbar_hole_height_position'], c['gearbar_hole_radius']])
      hole_x += c['gearbar_hole_increment'] * c['pi_module']

  ### design output
  gb_figure = [gearbar_outline]
  gb_figure.extend(gearbar_hole_figure)
  ###
  r_figures = {}
  r_height = {}
  #
  r_figures['gearbar_fig'] = gb_figure
  r_height['gearbar_fig'] = c['gear_profile_height']
  ###
  return((r_figures, r_height))
Esempio n. 11
0
def gearbar_constraint_check(c):
  """ check the gearbar constraint c and set the dynamic default values
  """
  #print("dbg122: len(c)", len(c))
  ### precision
  radian_epsilon = math.pi/1000
  ### check parameter coherence (part 1)
  c['gearbar_hole_radius'] = float(c['gearbar_hole_diameter'])/2
  # c['gearbar_hole_height_position']
  if((c['gearbar_hole_height_position']+c['gearbar_hole_radius'])>c['gearbar_height']):
    print("ERR215: Error, gearbar_hole_height_position {:0.3} and gearbar_hole_radius {:0.3f} are too big compare to gearbar_height {:0.3f} !".format(c['gearbar_hole_height_position'], c['gearbar_hole_radius'], c['gearbar_height']))
    sys.exit(2)
  # c['gearbar_hole_increment']
  if(c['gearbar_hole_increment']==0):
    print("ERR183: Error gearbar_hole_increment must be bigger than zero!")
    sys.exit(2)
  # c['gear_tooth_nb']
  if(c['gear_tooth_nb']>0): # create a gear_profile
    i_gear_profile = inherit_gear_profile() # inherit from gear_profile
    i_gear_profile.apply_external_constraint(gear_profile_constraint(c))
    gear_profile_parameters = i_gear_profile.get_constraint()
    # extract some gear_profile high-level parameter
    #print('dbg556: gear_profile_parameters:', gear_profile_parameters)
    c['g1_ix'] = gear_profile_parameters['g1_param']['center_ox']
    c['g1_iy'] = gear_profile_parameters['g1_param']['center_oy']
    c['g1_inclination'] = gear_profile_parameters['g1_param']['gearbar_inclination']
    gear_profile_for_length = i_gear_profile.get_A_figure('first_gear')[0]
    gear_profile_for_length = cnc25d_api.outline_rotate(gear_profile_for_length, c['g1_ix'], c['g1_iy'], -1*c['g1_inclination'] + math.pi/2)
    gear_profile_for_length = cnc25d_api.outline_shift_xy(gear_profile_for_length, -1*gear_profile_for_length[0][0], 1, -1*c['g1_iy'] + c['gearbar_height'], 1)
    #print("dbg127: gear_profile_for_length:", gear_profile_for_length)
    c['gearbar_length'] = gear_profile_for_length[-1][0] - gear_profile_for_length[0][0]
    ## get some parameters
    c['minimal_gear_profile_height'] = c['gearbar_height'] - (gear_profile_parameters['g1_param']['hollow_height'] + gear_profile_parameters['g1_param']['dedendum_height'])
    c['pi_module'] = gear_profile_parameters['g1_param']['pi_module']
    pfe = gear_profile_parameters['g1_param']['portion_first_end']
    full_positive_slope = gear_profile_parameters['g1_param']['full_positive_slope']
    full_negative_slope = gear_profile_parameters['g1_param']['full_negative_slope']
    bottom_land = gear_profile_parameters['g1_param']['bottom_land']
    top_land = gear_profile_parameters['g1_param']['top_land']
    if((top_land + full_positive_slope + bottom_land + full_negative_slope)!=c['pi_module']):
      print("ERR269: Error with top_land {:0.3f}  full_positive_slope {:0.3f}  bottom_land {:0.3f}  full_negative_slope {:0.3f} and pi_module  {:0.3f}".format(top_land, full_positive_slope, bottom_land, full_negative_slope, c['pi_module']))
      sys.exit(2)
    if(pfe==0):
      c['first_tooth_position'] = full_positive_slope + bottom_land + full_negative_slope + float(top_land)/2
    elif(pfe==1):
      c['first_tooth_position'] = full_positive_slope + bottom_land + full_negative_slope + top_land
    elif(pfe==2):
      c['first_tooth_position'] = full_negative_slope + float(top_land)/2
    elif(pfe==3):
      c['first_tooth_position'] = float(bottom_land)/2 + full_negative_slope + float(top_land)/2
  else: # no gear_profile, just a circle
    if(c['gear_primitive_diameter']<radian_epsilon):
      print("ERR885: Error, the no-gear-profile line outline length gear_primitive_diameter {:0.2f} is too small!".format(c['gear_primitive_diameter']))
      sys.exit(2)
    #c['g1_ix'] = c['center_position_x
    #c['g1_iy'] = c['center_position_y
    c['gearbar_length'] = c['gear_primitive_diameter']
    c['minimal_gear_profile_height'] = c['gearbar_height']
    c['pi_module'] = c['gear_module'] * math.pi
    c['first_tooth_position'] = float(c['pi_module'])/2

  ### check parameter coherence (part 2)
  # minimal_gear_profile_height
  if(c['minimal_gear_profile_height']<radian_epsilon):
    print("ERR265: Error, minimal_gear_profile_height {:0.3f} is too small".format(c['minimal_gear_profile_height']))
    sys.exit(2)
  # gearbar_hole_diameter
  if((c['gearbar_hole_height_position']+c['gearbar_hole_radius'])>c['minimal_gear_profile_height']):
    print("ERR269: Error, gearbar_hole_height_position {:0.3f} and gearbar_hole_radius {:0.3f} are too big compare to minimal_gear_profile_height {:0.3f}".format(c['gearbar_hole_height_position'], c['gearbar_hole_radius'], c['minimal_gear_profile_height']))
    sys.exit(2)
  # pi_module
  if(c['gearbar_hole_radius']>0):
    if(c['pi_module']==0):
      print("ERR277: Error, pi_module is null. You might need to use --gear_module")
      sys.exit(2)
  ###
  return(c)
Esempio n. 12
0
def slab_side(c, nai_type):
    """ Create the FreeCAD Part Object slab_side
  """
    slab_length = c['slab_side_length']
    if (nai_type == 'left_right'):
        slab_width = c['slab_side_left_right_width']
    elif (nai_type == 'rear_single'):
        slab_width = c['slab_side_rear_single_width']
    elif (nai_type == 'rear_side'):
        slab_width = c['slab_side_rear_side_width']
    elif (nai_type == 'rear_middle'):
        slab_width = c['slab_side_rear_middle_width']
    slab_side_outline = []
    slab_side_outline.append([
        0 * slab_length + 1 * c['cutting_extra'],
        0 * slab_width + 1 * c['cutting_extra'], 0
    ])
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_horizontal(c),
            0 * slab_length, 1, 0 * slab_width, 1))
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_horizontal(c),
            1 * slab_length, -1, 0 * slab_width, 1))
    slab_side_outline.append([
        1 * slab_length - 1 * c['cutting_extra'],
        0 * slab_width + 1 * c['cutting_extra'], 0
    ])
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_vertical(c), 1 * slab_length,
            -1, 0 * slab_width, 1))
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_vertical(c), 1 * slab_length,
            -1, 1 * slab_width, -1))
    slab_side_outline.append([
        1 * slab_length - 1 * c['cutting_extra'],
        1 * slab_width - 1 * c['cutting_extra'], 0
    ])
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_horizontal(c),
            1 * slab_length, -1, 1 * slab_width, -1))
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_horizontal(c),
            0 * slab_length, 1, 1 * slab_width, -1))
    slab_side_outline.append([
        0 * slab_length + 1 * c['cutting_extra'],
        1 * slab_width - 1 * c['cutting_extra'], 0
    ])
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_vertical(c), 0 * slab_length,
            1, 1 * slab_width, -1))
    slab_side_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_slab_side_with_wall_diagonal_vertical(c), 0 * slab_length,
            1, 0 * slab_width, 1))
    slab_side_A = cnc25d_api.outline_close(slab_side_outline)
    r_fig = [slab_side_A]
    return (r_fig)
Esempio n. 13
0
def plank_xz_top(c):
    """ Create the FreeCAD Part Object plank_xz_top
  """
    # plank_xz_top_outline
    plank_xz_top_outline = []
    plank_xz_top_outline.append([
        0 * c['box_width'], 0 * c['h_plank_width'], 0 * c['router_bit_radius']
    ])  #0
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),
                                   0 * c['box_width'], 1))  #1-4
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                   0 * c['box_width'], 1))  #5-8
    for i in range(c['module_width'] - 1):
        plank_xz_top_outline.extend(
            cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                       (i + 1) * c['box_width'] +
                                       1.0 / 2 * c['v_plank_width'], -1))
        plank_xz_top_outline.extend(
            cnc25d_api.outline_shift_x(jonction_plank_xz_with_middle_zx(c),
                                       (i + 1) * c['box_width'], 1))
        plank_xz_top_outline.extend(
            cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                       (i + 1) * c['box_width'] -
                                       1.0 / 2 * c['v_plank_width'], 1))
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_wall_diagonal(c),
                                   c['module_width'] * c['box_width'],
                                   -1))  #9-12
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_with_zx(c),
                                   c['module_width'] * c['box_width'],
                                   -1))  #13-16
    plank_xz_top_outline.append([
        c['module_width'] * c['box_width'], 0 * c['plank_height'],
        0 * c['router_bit_radius']
    ])  #17
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_top_xz_with_yz(c),
                                   c['module_width'] * c['box_width'],
                                   -1))  #18-21
    plank_xz_top_outline.append([
        c['module_width'] * c['box_width'], 1 * c['h_plank_width'],
        0 * c['router_bit_radius']
    ])  #22
    for i in range(c['module_width']):
        plank_xz_top_outline.extend(
            cnc25d_api.outline_shift_xy(
                jonction_plank_xz_fitting(c)[::-1],
                (c['module_width'] - i) * c['box_width'], -1,
                c['h_plank_width'], 1))  #23-24
        plank_xz_top_outline.extend(
            cnc25d_api.outline_shift_xy(
                jonction_plank_xz_fitting(c)[::-1],
                (c['module_width'] - 1 - i) * c['box_width'], 1,
                c['h_plank_width'], 1))  #25-26
    plank_xz_top_outline.append([
        0 * c['box_width'], 1 * c['h_plank_width'], 0 * c['router_bit_radius']
    ])  #27
    plank_xz_top_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_top_xz_with_yz(c),
                                   0 * c['box_width'], 1))  #28-31
    plank_xz_top_A = cnc25d_api.outline_close(plank_xz_top_outline)
    # final build of  the plank plank_xz_top
    r_fig = [plank_xz_top_A]
    r_fig.extend(plank_xz_top_hole(c))
    return (r_fig)
Esempio n. 14
0
def crest_2d_construction(c):
  """ construct the 2D-figures with outlines at the A-format for the crest design
  """
  ### precision
  radian_epsilon = math.pi/1000
  ###
  cx = c['cube_width']/2.0
  cy = c['top_thickness']+c['height_margin']+c['axle_diameter']/2.0+c['inter_axle_length']
  cube_height = 2*c['top_thickness']+2*c['height_margin']+c['axle_diameter']+c['inter_axle_length']

  # inheritance from cross_cube_sub
  bottom_outline_A = cnc25d_api.rotate_and_translate_figure(cross_cube_sub.cross_cube_face_top_outline(c, c['face_B1_thickness'], c['face_B2_thickness']), c['cube_width']/2.0, cube_height/2.0, math.pi, 0.0, 0.0)
  cross_cube_hole_figure_A = cnc25d_api.rotate_and_translate_figure(cross_cube_sub.cross_cube_face_holes(c, c['face_B1_thickness'], c['face_B2_thickness']), c['cube_width']/2.0, cube_height/2.0, math.pi, 0.0, 0.0)

  # inheritance from gear_profile
  i_gear_profile = gear_profile.gear_profile()
  gp_c = gear_profile_constraint(c)
  gp_c['center_position_x'] = cx
  gp_c['center_position_y'] = cy
  i_gear_profile.apply_external_constraint(gp_c)
  gear_profile_B = i_gear_profile.get_A_figure('first_gear')[0]
  # gear_profile check
  if(abs(gear_profile_B[0][1]-gear_profile_B[-1][-1])>radian_epsilon):
    print("ERR335: Error, extremities of the gear_profile_B have different y-coordiante {:0.3f} {:0.3f}".format(gear_profile_B[0][1], gear_profile_B[-1][-1]))
    sys.exit(2)
  # gear_profile extremity angle
  crest_gear_angle = math.atan2(gear_profile_B[0][1]-cy, gear_profile_B[0][0]-cx)
 
  ## crest outline
  crest_long_nshort = True
  free_mounting_width = c['free_mounting_width']
  if(gear_profile_B[0][1]>3*cube_height/4.0+radian_epsilon):
    crest_long_nshort = False
    free_mounting_width = c['crest_cnc_router_bit_radius']
  crest_outline_A = []
  crest_outline_A.append((gear_profile_B[-1][-2], gear_profile_B[-1][-1], 0))
  crest_outline_A.append((cx+c['crest_hollow_external_radius']*math.cos(math.pi-crest_gear_angle), cy+c['crest_hollow_external_radius']*math.sin(math.pi-crest_gear_angle), c['crest_cnc_router_bit_radius']))
  crest_outline_A.append((bottom_outline_A[0][0]-free_mounting_width, bottom_outline_A[0][1], c['crest_cnc_router_bit_radius']))
  crest_outline_A.extend(bottom_outline_A[1:-1])
  crest_outline_A.append((bottom_outline_A[-1][0]+free_mounting_width, bottom_outline_A[-1][1], c['crest_cnc_router_bit_radius']))
  crest_outline_A.append((cx+c['crest_hollow_external_radius']*math.cos(crest_gear_angle), cy+c['crest_hollow_external_radius']*math.sin(crest_gear_angle), c['crest_cnc_router_bit_radius']))
  crest_outline_A.append((gear_profile_B[0][0], gear_profile_B[0][1], 0))
  crest_outline_B = cnc25d_api.cnc_cut_outline(crest_outline_A, "crest_outline_A")
  crest_outline_B.extend(gear_profile_B[1:])
  ## crest holes
  crest_hole_A = []
  crest_hole_A.extend(cross_cube_hole_figure_A) 
  # cross_cube top holes
  ccthy = cy + c['axle_diameter']/2.0+c['height_margin']
  cw5 = c['cube_width']/5
  tt = c['top_thickness']
  ccect = c['cross_cube_extra_cut_thickness']
  cccrbr = c['cross_cube_cnc_router_bit_radius']
  cc_top_hole = []
  cc_top_hole.append((-1*ccect, -1*ccect, -1*cccrbr))
  cc_top_hole.append((cw5+1*ccect, -1*ccect, -1*cccrbr))
  cc_top_hole.append((cw5+1*ccect, tt+1*ccect, -1*cccrbr))
  cc_top_hole.append((-1*ccect, tt+1*ccect, -1*cccrbr))
  cc_top_hole.append((-1*ccect, -1*ccect, 0))
  crest_hole_A.append(cnc25d_api.outline_shift_xy(cc_top_hole, 1*cw5, 1, ccthy, 1))
  crest_hole_A.append(cnc25d_api.outline_shift_xy(cc_top_hole, 3*cw5, 1, ccthy, 1))
  # crest hollow
  cher = c['crest_hollow_external_radius']
  chir = c['crest_hollow_internal_radius']
  chln = c['crest_hollow_leg_nb']
  chsr = c['crest_hollow_smoothing_radius']
  if(crest_long_nshort):
    first_leg_ex_angle = math.asin((c['end_leg_width']+3*cube_height/4.0-cy)/cher)
    first_leg_in_angle = math.asin((c['end_leg_width']+3*cube_height/4.0-cy)/chir)
    first_leg_hole_angle = math.asin((c['end_leg_width']/2.0+3*cube_height/4.0-cy)/cher)
  else:
    first_leg_ex_angle = crest_gear_angle + 2*math.atan(c['end_leg_width']/(2.0*cher))
    first_leg_in_angle = crest_gear_angle + 2*math.atan(c['end_leg_width']/(2.0*chir))
    first_leg_hole_angle = crest_gear_angle + math.atan(c['end_leg_width']/(2.0*cher))
  if(c['crest_hollow_leg_nb']>1):
    leg_step_angle = 0
    if(chln>2):
      leg_step_angle = (math.pi-2*first_leg_ex_angle)/(chln-1)
    middle_leg_ex_half_angle = math.atan(c['middle_leg_width']/(2.0*cher))
    middle_leg_in_half_angle = math.atan(c['middle_leg_width']/(2.0*chir))
    smoothing_ex_half_angle = math.atan(float(chsr)/(cher-chsr))
    smoothing_in_half_angle = math.atan(float(chsr)/(chir+chsr))
    ex1_angles = []
    ex2_angles = []
    ex1_angles.append(first_leg_ex_angle)
    for i in range(chln-2):
      ex1_angles.append(first_leg_ex_angle + (i+1)*leg_step_angle + middle_leg_ex_half_angle)
      ex2_angles.append(first_leg_ex_angle + (i+1)*leg_step_angle - middle_leg_ex_half_angle)
    ex2_angles.append(math.pi-first_leg_ex_angle)
    in1_angles = []
    in2_angles = []
    in1_angles.append(first_leg_in_angle)
    for i in range(chln-2):
      in1_angles.append(first_leg_ex_angle + (i+1)*leg_step_angle + middle_leg_in_half_angle)
      in2_angles.append(first_leg_ex_angle + (i+1)*leg_step_angle - middle_leg_in_half_angle)
    in2_angles.append(math.pi-first_leg_in_angle)
    for i in range(chln-1):
      ea1 = ex1_angles[i]
      ea2 = ex2_angles[i]
      ma = (ex1_angles[i]+ex2_angles[i])/2.0
      ia1 = in1_angles[i]
      ia2 = in2_angles[i]
      if((ea2-ea1)<2.1*smoothing_ex_half_angle):
        print("ERR419: Error, crest_hollow_smoothing_radius {:0.3f} or crest_hollow_leg_nb {:d} are too big".format(chsr, chln))
        sys.exit(2)
      hollow = []
      hollow.append((cx+cher*math.cos(ea1), cy+cher*math.sin(ea1), chsr))
      hollow.append((cx+cher*math.cos(ma), cy+cher*math.sin(ma), cx+cher*math.cos(ea2), cy+cher*math.sin(ea2), chsr))
      if((ia2-ia1)<2.1*smoothing_in_half_angle):
        hollow.append((cx+chir*math.cos(ma), cy+chir*math.sin(ma), chsr))
      else:
        hollow.append((cx+chir*math.cos(ia2), cy+chir*math.sin(ia2), chsr))
        hollow.append((cx+chir*math.cos(ma), cy+chir*math.sin(ma), cx+chir*math.cos(ia1), cy+chir*math.sin(ia1), chsr))
      hollow.append((cx+cher*math.cos(ea1), cy+cher*math.sin(ea1), 0))
      crest_hole_A.append(hollow[:])
      #[todo] optimization with floor_width
  # crest gear holes
  hole_half_angle = math.atan(c['centring_hole_distance']/(2.0*(cher+c['centring_hole_position'])))
  hole_step_angle = 0
  if(chln>2):
    hole_step_angle = (math.pi-2*first_leg_hole_angle)/(chln-1)
  hole_angles = []
  hole_angles.append(first_leg_hole_angle)
  for i in range(chln-2):
    #hole_angles.append(first_leg_hole_angle + (i+1)*hole_step_angle)
    hole_angles.append(first_leg_ex_angle + (i+1)*leg_step_angle)
  hole_angles.append(math.pi-first_leg_hole_angle)
  for a in hole_angles:
    crest_hole_A.append((cx+(cher+c['fastening_hole_position'])*math.cos(a), cy+(cher+c['fastening_hole_position'])*math.sin(a), c['fastening_hole_radius']))
    crest_hole_A.append((cx+(cher+c['centring_hole_position'])*math.cos(a-hole_half_angle), cy+(cher+c['centring_hole_position'])*math.sin(a-hole_half_angle), c['centring_hole_radius']))
    crest_hole_A.append((cx+(cher+c['centring_hole_position'])*math.cos(a+hole_half_angle), cy+(cher+c['centring_hole_position'])*math.sin(a+hole_half_angle), c['centring_hole_radius']))
  ## crest figure
  crest_figure = []
  crest_figure.append(crest_outline_B)
  crest_figure.extend(cnc25d_api.cnc_cut_figure(crest_hole_A, "crest_hole_A"))
  ###
  r_figures = {}
  r_height = {}
  #
  r_figures['crest_fig'] = crest_figure
  r_height['crest_fig'] = c['crest_thickness']
  ###
  return((r_figures, r_height))
Esempio n. 15
0
def gearbar_constraint_check(c):
    """ check the gearbar constraint c and set the dynamic default values
  """
    #print("dbg122: len(c)", len(c))
    ### precision
    radian_epsilon = math.pi / 1000
    ### check parameter coherence (part 1)
    c['gearbar_hole_radius'] = float(c['gearbar_hole_diameter']) / 2
    # c['gearbar_hole_height_position']
    if ((c['gearbar_hole_height_position'] + c['gearbar_hole_radius']) >
            c['gearbar_height']):
        print(
            "ERR215: Error, gearbar_hole_height_position {:0.3} and gearbar_hole_radius {:0.3f} are too big compare to gearbar_height {:0.3f} !"
            .format(c['gearbar_hole_height_position'],
                    c['gearbar_hole_radius'], c['gearbar_height']))
        sys.exit(2)
    # c['gearbar_hole_increment']
    if (c['gearbar_hole_increment'] == 0):
        print("ERR183: Error gearbar_hole_increment must be bigger than zero!")
        sys.exit(2)
    # c['gear_tooth_nb']
    if (c['gear_tooth_nb'] > 0):  # create a gear_profile
        i_gear_profile = inherit_gear_profile()  # inherit from gear_profile
        i_gear_profile.apply_external_constraint(gear_profile_constraint(c))
        gear_profile_parameters = i_gear_profile.get_constraint()
        # extract some gear_profile high-level parameter
        #print('dbg556: gear_profile_parameters:', gear_profile_parameters)
        c['g1_ix'] = gear_profile_parameters['g1_param']['center_ox']
        c['g1_iy'] = gear_profile_parameters['g1_param']['center_oy']
        c['g1_inclination'] = gear_profile_parameters['g1_param'][
            'gearbar_inclination']
        gear_profile_for_length = i_gear_profile.get_A_figure('first_gear')[0]
        gear_profile_for_length = cnc25d_api.outline_rotate(
            gear_profile_for_length, c['g1_ix'], c['g1_iy'],
            -1 * c['g1_inclination'] + math.pi / 2)
        gear_profile_for_length = cnc25d_api.outline_shift_xy(
            gear_profile_for_length, -1 * gear_profile_for_length[0][0], 1,
            -1 * c['g1_iy'] + c['gearbar_height'], 1)
        #print("dbg127: gear_profile_for_length:", gear_profile_for_length)
        c['gearbar_length'] = gear_profile_for_length[-1][
            0] - gear_profile_for_length[0][0]
        ## get some parameters
        c['minimal_gear_profile_height'] = c['gearbar_height'] - (
            gear_profile_parameters['g1_param']['hollow_height'] +
            gear_profile_parameters['g1_param']['dedendum_height'])
        c['pi_module'] = gear_profile_parameters['g1_param']['pi_module']
        pfe = gear_profile_parameters['g1_param']['portion_first_end']
        full_positive_slope = gear_profile_parameters['g1_param'][
            'full_positive_slope']
        full_negative_slope = gear_profile_parameters['g1_param'][
            'full_negative_slope']
        bottom_land = gear_profile_parameters['g1_param']['bottom_land']
        top_land = gear_profile_parameters['g1_param']['top_land']
        if ((top_land + full_positive_slope + bottom_land +
             full_negative_slope) != c['pi_module']):
            print(
                "ERR269: Error with top_land {:0.3f}  full_positive_slope {:0.3f}  bottom_land {:0.3f}  full_negative_slope {:0.3f} and pi_module  {:0.3f}"
                .format(top_land, full_positive_slope, bottom_land,
                        full_negative_slope, c['pi_module']))
            sys.exit(2)
        if (pfe == 0):
            c['first_tooth_position'] = full_positive_slope + bottom_land + full_negative_slope + float(
                top_land) / 2
        elif (pfe == 1):
            c['first_tooth_position'] = full_positive_slope + bottom_land + full_negative_slope + top_land
        elif (pfe == 2):
            c['first_tooth_position'] = full_negative_slope + float(
                top_land) / 2
        elif (pfe == 3):
            c['first_tooth_position'] = float(
                bottom_land) / 2 + full_negative_slope + float(top_land) / 2
    else:  # no gear_profile, just a circle
        if (c['gear_primitive_diameter'] < radian_epsilon):
            print(
                "ERR885: Error, the no-gear-profile line outline length gear_primitive_diameter {:0.2f} is too small!"
                .format(c['gear_primitive_diameter']))
            sys.exit(2)
        #c['g1_ix'] = c['center_position_x
        #c['g1_iy'] = c['center_position_y
        c['gearbar_length'] = c['gear_primitive_diameter']
        c['minimal_gear_profile_height'] = c['gearbar_height']
        c['pi_module'] = c['gear_module'] * math.pi
        c['first_tooth_position'] = float(c['pi_module']) / 2

    ### check parameter coherence (part 2)
    # minimal_gear_profile_height
    if (c['minimal_gear_profile_height'] < radian_epsilon):
        print(
            "ERR265: Error, minimal_gear_profile_height {:0.3f} is too small".
            format(c['minimal_gear_profile_height']))
        sys.exit(2)
    # gearbar_hole_diameter
    if ((c['gearbar_hole_height_position'] + c['gearbar_hole_radius']) >
            c['minimal_gear_profile_height']):
        print(
            "ERR269: Error, gearbar_hole_height_position {:0.3f} and gearbar_hole_radius {:0.3f} are too big compare to minimal_gear_profile_height {:0.3f}"
            .format(c['gearbar_hole_height_position'],
                    c['gearbar_hole_radius'],
                    c['minimal_gear_profile_height']))
        sys.exit(2)
    # pi_module
    if (c['gearbar_hole_radius'] > 0):
        if (c['pi_module'] == 0):
            print(
                "ERR277: Error, pi_module is null. You might need to use --gear_module"
            )
            sys.exit(2)
    ###
    return (c)
Esempio n. 16
0
def plank_xz_bottom(c):
    """ Create the FreeCAD Part Object plank_xz_bottom
  """
    # plank_xz_bottom_outline
    plank_xz_bottom_outline = []
    plank_xz_bottom_outline.append([
        0 * c['box_width'], 0 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])  #0
    for i in range(c['module_width']):
        plank_xz_bottom_outline.extend(
            cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),
                                       i * c['box_width'], 1))  #1-2
        plank_xz_bottom_outline.extend(
            cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),
                                       (i + 1) * c['box_width'], -1))
    plank_xz_bottom_outline.append([
        c['module_width'] * c['box_width'],
        0 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_bot_xz_with_yz(c),
                                   c['module_width'] * c['box_width'], -1))
    plank_xz_bottom_outline.append([
        c['module_width'] * c['box_width'],
        1 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_zx(c), c['module_width'] * c['box_width'],
            -1, 1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_wall_diagonal(c),
            c['module_width'] * c['box_width'], -1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    for i in range(c['module_width'] - 1):
        plank_xz_bottom_outline.extend(
            cnc25d_api.outline_shift_xy(
                jonction_plank_xz_with_wall_diagonal(c),
                (c['module_width'] - i - 1) * c['box_width'] -
                1.0 / 2 * c['v_plank_width'], 1,
                1 * (c['h_plank_width'] + c['fitting_height']), -1))
        plank_xz_bottom_outline.extend(
            cnc25d_api.outline_shift_xy(
                jonction_plank_xz_with_middle_zx(c),
                (c['module_width'] - i - 1) * c['box_width'], 1,
                1 * (c['h_plank_width'] + c['fitting_height']), -1))
        plank_xz_bottom_outline.extend(
            cnc25d_api.outline_shift_xy(
                jonction_plank_xz_with_wall_diagonal(c),
                (c['module_width'] - i - 1) * c['box_width'] +
                1.0 / 2 * c['v_plank_width'], -1,
                1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_wall_diagonal(c), 0 * c['box_width'], 1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_zx(c), 0 * c['box_width'], 1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_xz_bottom_outline.append([
        0 * c['box_width'], 1 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_xz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_bot_xz_with_yz(c),
                                   0 * c['box_width'], 1))
    plank_xz_bottom_A = cnc25d_api.outline_close(plank_xz_bottom_outline)
    r_fig = [plank_xz_bottom_A]
    r_fig.extend(plank_xz_bottom_hole(c))
    return (r_fig)
Esempio n. 17
0
def plank_yz_bottom(c):
    """ Create the FreeCAD Part Object plank_yz_bottom
  """
    # plank_yz_bottom_outline
    plank_yz_bottom_outline = []
    plank_yz_bottom_outline.append([
        0 * c['box_depth'] + 1 * c['plank_height'],
        0 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])  #0
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),
                                   0 * c['box_depth'], 1))  #1-2
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_xz_fitting(c),
                                   1 * c['box_depth'], -1))
    plank_yz_bottom_outline.append([
        1 * c['box_depth'] - 1 * c['plank_height'],
        0 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_bot_yz_with_xz(c),
                                   1 * c['box_depth'], -1))
    plank_yz_bottom_outline.append([
        1 * c['box_depth'] - 1 * c['plank_height'],
        1 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_zx(c),
            1 * c['box_depth'] - 1 * c['plank_height'], -1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_wall_diagonal(c),
            1 * c['box_depth'] - 1 * c['plank_height'], -1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_wall_diagonal(c),
            0 * c['box_depth'] + 1 * c['plank_height'], 1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_xy(
            jonction_plank_xz_with_zx(c),
            0 * c['box_depth'] + 1 * c['plank_height'], 1,
            1 * (c['h_plank_width'] + c['fitting_height']), -1))
    plank_yz_bottom_outline.append([
        0 * c['box_depth'] + 1 * c['plank_height'],
        1 * (c['h_plank_width'] + c['fitting_height']),
        0 * c['router_bit_radius']
    ])
    plank_yz_bottom_outline.extend(
        cnc25d_api.outline_shift_x(jonction_plank_bot_yz_with_xz(c),
                                   0 * c['box_depth'], 1))
    plank_yz_bottom_A = cnc25d_api.outline_close(plank_yz_bottom_outline)
    r_fig = [plank_yz_bottom_A]
    r_fig.extend(plank_yz_bottom_hole(c))
    return (r_fig)
Esempio n. 18
0
def jonction_plank_zx_with_wall_diagonal(c):
  nr = cnc25d_api.outline_shift_xy(jonction_plank_xz_with_wall_diagonal(c), -1*c['v_plank_width']+1*c['crenel_depth'], 1, 0*c['v_plank_width'], 1)
  return(nr)
Esempio n. 19
0
def jonction_plank_zx_with_wall_diagonal(c):
    nr = cnc25d_api.outline_shift_xy(
        jonction_plank_xz_with_wall_diagonal(c),
        -1 * c['v_plank_width'] + 1 * c['crenel_depth'], 1,
        0 * c['v_plank_width'], 1)
    return (nr)