Exemplo n.º 1
0
def bba_2d_construction(c):
    """ construct the 2D-figures with outlines at the A-format for the bell_bagel_assembly design
  """
    # inherit from bell
    i_bell = inherit_bell(c)
    (bell_figs, bell_height) = i_bell.apply_2d_constructor()
    # inherit from bagel
    i_bagel = inherit_bagel(c)
    (bagel_figs, bagel_height) = i_bagel.apply_2d_constructor()
    ### figures output
    # part_list
    part_list = []
    part_list.extend(bell_figs.values())
    part_list.extend(bagel_figs.values())
    # part_list_figure
    x_space = 2.1 * c['base_diameter']
    part_list_figure = []
    for i in range(len(part_list)):
        part_list_figure.extend(
            cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0,
                                                   i * x_space, 0.0))
    ## bell_bagel_assembly
    bell_face_fig = bell_figs['bell_face']
    bagel_external_fig = bagel_figs['external_bagel']
    bell_bagel_assembly_figure = []
    bell_bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(bell_face_fig, 0.0, 0.0, 0.0, 0,
                                               0))
    bell_bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(bagel_external_fig, 0.0, 0.0,
                                               0.0, 0, c['bagel_z']))
    ###
    r_figures = {}
    r_height = {}

    r_figures.update(bell_figs)
    r_height.update(bell_height)

    r_figures.update(bagel_figs)
    r_height.update(bagel_height)

    r_figures['part_list'] = part_list_figure
    r_height['part_list'] = 1.0

    r_figures['bell_bagel_assembly'] = bell_bagel_assembly_figure
    r_height['bell_bagel_assembly'] = 1.0
    ###
    return ((r_figures, r_height))
Exemplo n.º 2
0
def plank_yz_top_hole(c):
    r_fig = []
    r_fig.extend(
        cnc25d_api.rotate_and_translate_figure(
            plank_xz_yz_hole(c, c['box_depth'], 1), 0, 0, 0, 0,
            c['diagonal_lining_top_height']))
    return (r_fig)
Exemplo n.º 3
0
def plank_yz_bottom_hole(c):
    r_fig = []
    r_fig.extend(
        cnc25d_api.rotate_and_translate_figure(
            plank_xz_yz_hole(c, c['box_depth'], 1), 0, 0, 0, 0,
            c['h_plank_width'] + c['fitting_height'] - c['d_plank_height'] -
            c['diagonal_lining_bottom_height']))
    return (r_fig)
Exemplo n.º 4
0
def plank_xz_top_hole(c):
    r_fig = []
    r_fig.extend(
        cnc25d_api.rotate_and_translate_figure(
            plank_xz_yz_hole(c, c['box_width'], c['module_width']), 0, 0, 0, 0,
            c['diagonal_lining_top_height']))
    for i in range(c['module_width'] - 1):
        r_fig.extend(hole_in_plank_top_xz_for_yz(c, (i + 1) * c['box_width']))
    return (r_fig)
Exemplo n.º 5
0
def bba_2d_construction(c):
  """ construct the 2D-figures with outlines at the A-format for the bell_bagel_assembly design
  """
  # inherit from bell
  i_bell = inherit_bell(c)
  (bell_figs, bell_height) = i_bell.apply_2d_constructor()
  # inherit from bagel
  i_bagel = inherit_bagel(c)
  (bagel_figs, bagel_height) = i_bagel.apply_2d_constructor()
  ### figures output
  # part_list
  part_list = []
  part_list.extend(bell_figs.values())
  part_list.extend(bagel_figs.values())
  # part_list_figure
  x_space = 2.1*c['base_diameter'] 
  part_list_figure = []
  for i in range(len(part_list)):
    part_list_figure.extend(cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0, i*x_space, 0.0))
  ## bell_bagel_assembly
  bell_face_fig = bell_figs['bell_face']
  bagel_external_fig = bagel_figs['external_bagel']
  bell_bagel_assembly_figure = []
  bell_bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(bell_face_fig, 0.0, 0.0, 0.0,      0, 0))
  bell_bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(bagel_external_fig, 0.0, 0.0, 0.0, 0, c['bagel_z']))
  ###
  r_figures = {}
  r_height = {}

  r_figures.update(bell_figs)
  r_height.update(bell_height)

  r_figures.update(bagel_figs)
  r_height.update(bagel_height)

  r_figures['part_list'] = part_list_figure
  r_height['part_list'] = 1.0

  r_figures['bell_bagel_assembly'] = bell_bagel_assembly_figure
  r_height['bell_bagel_assembly'] = 1.0
  ###
  return((r_figures, r_height))
Exemplo n.º 6
0
def gimbal_2d_construction(c):
  """ construct the 2D-figures with outlines at the A-format for the gimbal design
  """
  # bell_bagel_assembly
  i_bba = bell_bagel_assembly.bba()
  i_bba.apply_external_constraint(c)
  bell_face = i_bba.get_A_figure('bell_face')

  # cross_cube
  i_cross_cube = cross_cube.cross_cube()
  i_cross_cube.apply_external_constraint(cross_cube_constraint(c))
  crest_A = i_cross_cube.get_A_figure('crest_A_fig')
  crest_B = i_cross_cube.get_A_figure('crest_B_fig')

  ## gimbal 2D sketch
  # intermediate parameters
  bagel_z = c['base_thickness'] + c['bell_face_height'] + c['leg_length']
  crest_A_axle_z = c['top_thickness'] + c['height_margin'] + c['axle_diameter']/2.0
  crest_B_axle_z = crest_A_axle_z + c['inter_axle_length']
  #
  bottom_bell_face = cnc25d_api.rotate_and_translate_figure(bell_face, 0, bagel_z, 0.0, 0.0, 0.0)
  top_bell_face = cnc25d_api.rotate_and_translate_figure(bell_face, 0, bagel_z, math.pi+c['top_angle'], 0.0, crest_B_axle_z-bagel_z)
  bottom_crest_A = cnc25d_api.rotate_and_translate_figure(crest_A, c['cube_width']/2.0, crest_A_axle_z, c['bottom_angle'], -1*c['cube_width']/2.0, bagel_z-crest_A_axle_z)
  top_crest_B = cnc25d_api.rotate_and_translate_figure(crest_B, c['cube_width']/2.0, crest_B_axle_z, 0.0, -1*c['cube_width']/2.0, 0.0)

  ### figures output
  x_space = 1.2*max(c['gear_module']*c['virtual_tooth_nb'], c['base_diameter'])
  ## gimbal_sketch
  gimbal_sketch_figure = []
  gimbal_sketch_figure.extend(cnc25d_api.rotate_and_translate_figure(bottom_bell_face, 0.0, 0.0, 0.0,   0*x_space, 0))
  gimbal_sketch_figure.extend(cnc25d_api.rotate_and_translate_figure(bottom_crest_A, 0.0, 0.0, 0.0,     0*x_space, 0))
  gimbal_sketch_figure.extend(cnc25d_api.rotate_and_translate_figure(top_bell_face, 0.0, 0.0, 0.0,      1*x_space, 0))
  gimbal_sketch_figure.extend(cnc25d_api.rotate_and_translate_figure(top_crest_B, 0.0, 0.0, 0.0,        1*x_space, 0))
  ###
  r_figures = {}
  r_height = {}
  # get figures and heights from bell_bagel_assembly
  (bba_figs, bba_heights) = i_bba.apply_2d_constructor()
  r_figures.update(bba_figs)
  r_height.update(bba_heights)
  # get figures and heights from cross_cube
  (cc_figs, cc_heights) = i_cross_cube.apply_2d_constructor()
  r_figures.update(cc_figs)
  r_height.update(cc_heights)
  #
  r_figures['gimbal_sketch'] = gimbal_sketch_figure
  r_height['gimbal_sketch'] = 1.0
  ###
  return((r_figures, r_height))
Exemplo n.º 7
0
def bagel_2d_construction(c):
  """ construct the 2D-figures with outlines at the A-format for the bagel design
  """
  ### external_bagel
  external_bagel = []
  external_bagel.append((0.0, 0.0, c['bagel_axle_external_radius']))
  external_bagel.append((0.0, 0.0, c['bagel_axle_radius']))
  for i in range(c['axle_hole_nb']):
    a = i*2*math.pi/c['axle_hole_nb']+c['axle_hole_angle']
    external_bagel.append((0.0+c['axle_hole_position_radius']*math.cos(a), 0.0+c['axle_hole_position_radius']*math.sin(a), c['axle_hole_radius']))

  ### middle_bagel
  middle_bagel = []
  middle_bagel.append((0.0, 0.0, c['bagel_axle_internal_radius']))
  middle_bagel.append((0.0, 0.0, c['bagel_axle_radius']))

  ### internal_bagel
  # intermediate parameters
  cut_y = c['bagel_extra_cut_thickness']
  cut_x1 = math.sqrt(c['bagel_axle_radius']**2+cut_y**2)
  cut_x2 = math.sqrt(c['bagel_axle_external_radius']**2+cut_y**2)
  # outline construction
  ib_ol_A = []
  ib_ol_A.append((cut_x2, cut_y, 0))
  ib_ol_A.append((0.0, c['bagel_axle_external_radius'], -1*cut_x2, cut_y, 0))
  ib_ol_A.append((-1*cut_x1, cut_y, 0))
  ib_ol_A.append((0.0, c['bagel_axle_radius'], cut_x1, cut_y, 0))
  ib_ol_A.append((cut_x2, cut_y, 0))
  #ib_ol = cnc25d_api.cnc_cut_outline(ib_ol_A, "internal_bagel_ol")
  # figure construction
  ib_figure = []
  ib_figure.append(ib_ol_A)
  ib_figure_2 = []
  ib_figure_2.append(ib_ol_A)
  if(c['axle_hole_nb']>0):
    a_step = math.pi/c['axle_hole_nb']
    for i in range(c['axle_hole_nb']/2):
      a = (2*i+1)*a_step
      ib_figure.append((0.0+c['axle_hole_position_radius']*math.cos(a), 0.0+c['axle_hole_position_radius']*math.sin(a), c['axle_hole_radius']))
    ib_figure = cnc25d_api.rotate_and_translate_figure(ib_figure, 0.0, 0.0, c['axle_hole_angle']-a_step, 0.0, 0.0)
    for i in range(c['axle_hole_nb']/2):
      a = (2*i+1+(c['axle_hole_nb']%2))*a_step
      ib_figure_2.append((0.0+c['axle_hole_position_radius']*math.cos(a), 0.0+c['axle_hole_position_radius']*math.sin(a), c['axle_hole_radius']))
    ib_figure_2 = cnc25d_api.rotate_and_translate_figure(ib_figure_2, 0.0, 0.0, c['axle_hole_angle']-a_step, 0.0, 0.0)
  internal_bagel = ib_figure
  internal_bagel_2 = cnc25d_api.rotate_and_translate_figure(ib_figure_2, 0.0, 0.0, math.pi, 0.0, 0.0)
  ### figures output
  # part_list
  part_list = []
  part_list.append(external_bagel)
  part_list.append(middle_bagel)
  part_list.append(internal_bagel)
  part_list.append(internal_bagel_2)
  # part_list_figure
  x_space = 2.2*c['bagel_axle_external_radius'] 
  part_list_figure = []
  for i in range(len(part_list)):
    part_list_figure.extend(cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0, i*x_space, 0.0))
  ## bagel_part_overview
  bagel_assembly_figure = []
  bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(external_bagel, 0.0, 0.0, 0.0,   0, 0))
  bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(middle_bagel, 0.0, 0.0, 0.0,     0, 0))
  bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(internal_bagel, 0.0, 0.0, 0.0,   0, 0))
  bagel_assembly_figure.extend(cnc25d_api.rotate_and_translate_figure(internal_bagel_2, 0.0, 0.0, 0.0, 0, 0))
  ###
  r_figures = {}
  r_height = {}

  r_figures['external_bagel'] = external_bagel
  r_height['external_bagel'] = c['external_bagel_thickness']

  r_figures['middle_bagel'] = middle_bagel
  r_height['middle_bagel'] = c['middle_bagel_thickness']

  r_figures['internal_bagel'] = internal_bagel
  r_height['internal_bagel'] = c['internal_bagel_thickness']

  r_figures['internal_bagel_2'] = internal_bagel_2
  r_height['internal_bagel_2'] = c['internal_bagel_thickness']

  r_figures['part_list'] = part_list_figure
  r_height['part_list'] = 1.0

  r_figures['bagel_assembly'] = bagel_assembly_figure
  r_height['bagel_assembly'] = 1.0
  ###
  return((r_figures, r_height))
Exemplo n.º 8
0
def bwf_2d_construction(c):
  """
  construct the 2D-figures with outlines at the A-format for the box_wood_frame design
  """
  ###
  r_figures = {}
  r_height = {}
  #
  r_figures['plank_xz_top'] = plank_xz_top(c)
  r_height['plank_xz_top'] = c['plank_height']
  #
  r_figures['plank_xz_bottom'] = plank_xz_bottom(c)
  r_height['plank_xz_bottom'] = c['plank_height']
  #
  r_figures['plank_yz_top'] = plank_yz_top(c)
  r_height['plank_yz_top'] = c['plank_height']
  #
  r_figures['plank_yz_bottom'] = plank_yz_bottom(c)
  r_height['plank_yz_bottom'] = c['plank_height']
  #
  r_figures['plank_z_side'] = plank_z_side(c)
  r_height['plank_z_side'] = c['plank_height']
  #
  r_figures['plank_wall_diagonal'] = plank_wall_diagonal(c)
  r_height['plank_wall_diagonal'] = c['d_plank_height']
  #
  l = c['crenel_depth']*math.sqrt(2)/2 # crenel_depth * cos(pi/4)
  r_figures['plank_wall_diag_cuboid'] = cnc25d_api.rotate_and_translate_figure(plank_wall_diagonal(c), l,0,math.pi/4, -l,0)
  r_height['plank_wall_diag_cuboid'] = c['d_plank_height']
  #
  r_figures['plank_tobo_diagonal'] = plank_tobo_diagonal(c)
  r_height['plank_tobo_diagonal'] = c['d_plank_height']
  #
  r_figures['plank_tobo_diag_cuboid'] =  cnc25d_api.rotate_and_translate_figure(plank_tobo_diagonal(c), 0,0,math.pi/4, 0,0)
  r_height['plank_tobo_diag_cuboid'] = c['d_plank_height']
  #
  r_figures['plank_zx_middle'] = plank_zx_middle(c)
  r_height['plank_zx_middle'] = c['plank_height']
  #
  r_figures['plank_hole_cover'] = plank_hole_cover(c)
  r_height['plank_hole_cover'] = c['plank_height']-c['tobo_diag_depth']
  #
  r_figures['slab_top_bottom_single'] = slab_top_bottom(c, 'single')
  r_height['slab_top_bottom_single'] = c['slab_thickness']
  #
  r_figures['slab_top_bottom_side'] = slab_top_bottom(c, 'side')
  r_height['slab_top_bottom_side'] = c['slab_thickness']
  #
  r_figures['slab_top_bottom_middle'] = slab_top_bottom(c, 'middle')
  r_height['slab_top_bottom_middle'] = c['slab_thickness']
  #
  r_figures['slab_side_left_right'] = slab_side(c, 'left_right')
  r_height['slab_side_left_right'] = c['slab_thickness']
  #
  r_figures['slab_side_rear_single'] = slab_side(c, 'rear_single')
  r_height['slab_side_rear_single'] = c['slab_thickness']
  #
  r_figures['slab_side_rear_side'] = slab_side(c, 'rear_side')
  r_height['slab_side_rear_side'] = c['slab_thickness']
  #
  r_figures['slab_side_rear_middle'] = slab_side(c, 'rear_middle')
  r_height['slab_side_rear_middle'] = c['slab_thickness']
  #
  r_figures['slab_front'] = slab_front(c)
  r_height['slab_front'] = c['slab_thickness']
  ###
  bwf_face = []
  bwf_face.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_xz_top'], 0,0,0, 0, c['box_height']-c['h_plank_width']))
  bwf_face.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_xz_bottom'], 0,0,0, 0,0))
  bwf_face.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_z_side'], 0,0,-math.pi/2, 0.0, c['fitting_height']+c['h_plank_width']-c['crenel_depth']+c['plank_z_length']))
  bwf_face.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_z_side'], 0,0,math.pi/2, c['module_width']*c['box_width'], c['fitting_height']+c['h_plank_width']-c['crenel_depth']))
  bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    1, -1, 0.0, c['v_plank_width'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
  bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    1, 1, 0.0, c['v_plank_width'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
  bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    -1, -1, 0.0, c['module_width']*c['box_width']-c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
  bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    -1, 1, 0.0, c['module_width']*c['box_width']-c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
  for i in range(c['module_width']-1):
    bwf_face.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_zx_middle'], 0,0,math.pi/2, (i+1)*c['box_width']+0.5*c['v_plank_width'], c['fitting_height']+c['h_plank_width']-c['crenel_depth']))
    bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
      1, -1, 0.0, (i+1)*c['box_width']+0.5*c['v_plank_width'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
    bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
      1, 1, 0.0, (i+1)*c['box_width']+0.5*c['v_plank_width'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
    bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
      -1, -1, 0.0, (i+1)*c['box_width']-0.5*c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
    bwf_face.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
      -1, 1, 0.0, (i+1)*c['box_width']-0.5*c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
  #
  bwf_side = []
  bwf_side.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_yz_top'], 0,0,0, 0, c['box_height']-c['h_plank_width']))
  bwf_side.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_yz_bottom'], 0,0,0, 0, 0))
  bwf_side.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_z_side'], 0,0,-math.pi/2, c['plank_height'], c['fitting_height']+c['h_plank_width']-c['crenel_depth']+c['plank_z_length']))
  bwf_side.extend(cnc25d_api.rotate_and_translate_figure(r_figures['plank_z_side'], 0,0,math.pi/2, c['box_depth']-c['plank_height'], c['fitting_height']+c['h_plank_width']-c['crenel_depth']))
  bwf_side.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    1, -1, 0.0, c['plank_height']+c['v_plank_width'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
  bwf_side.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    1, 1, 0.0, c['plank_height']+c['v_plank_width'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
  bwf_side.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    -1, -1, 0.0, c['box_depth']-c['plank_height']-c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['fitting_height']+c['h_plank_width']+c['wall_diagonal_size']))
  bwf_side.extend(cnc25d_api.flip_rotate_and_translate_figure(r_figures['plank_wall_diag_cuboid'], 0,0, c['plank_wall_diagonal_in_cuboid_x_length'], c['plank_wall_diagonal_in_cuboid_y_width'],
    -1, 1, 0.0, c['box_depth']-c['plank_height']-c['v_plank_width']-c['plank_wall_diagonal_in_cuboid_x_length'], c['box_height']-c['h_plank_width']-c['wall_diagonal_size']-c['plank_wall_diagonal_in_cuboid_y_width']))
  #
  bwf_overview = []
  bwf_overview.extend(cnc25d_api.rotate_and_translate_figure(bwf_face, 0,0,0, 0,0))
  bwf_overview.extend(cnc25d_api.rotate_and_translate_figure(bwf_side, 0,0,0, (c['module_width']+0.2)*c['box_width'],0))
  #
  r_figures['bwf_face'] = bwf_face
  r_height['bwf_face'] = 1.0
  #
  r_figures['bwf_side'] = bwf_side
  r_height['bwf_side'] = 1.0
  #
  r_figures['bwf_overview'] = bwf_overview
  r_height['bwf_overview'] = 1.0
  ###
  return((r_figures, r_height))
Exemplo n.º 9
0
def bagel_2d_construction(c):
    """ construct the 2D-figures with outlines at the A-format for the bagel design
  """
    ### external_bagel
    external_bagel = []
    external_bagel.append((0.0, 0.0, c['bagel_axle_external_radius']))
    external_bagel.append((0.0, 0.0, c['bagel_axle_radius']))
    for i in range(c['axle_hole_nb']):
        a = i * 2 * math.pi / c['axle_hole_nb'] + c['axle_hole_angle']
        external_bagel.append(
            (0.0 + c['axle_hole_position_radius'] * math.cos(a),
             0.0 + c['axle_hole_position_radius'] * math.sin(a),
             c['axle_hole_radius']))

    ### middle_bagel
    middle_bagel = []
    middle_bagel.append((0.0, 0.0, c['bagel_axle_internal_radius']))
    middle_bagel.append((0.0, 0.0, c['bagel_axle_radius']))

    ### internal_bagel
    # intermediate parameters
    cut_y = c['bagel_extra_cut_thickness']
    cut_x1 = math.sqrt(c['bagel_axle_radius']**2 + cut_y**2)
    cut_x2 = math.sqrt(c['bagel_axle_external_radius']**2 + cut_y**2)
    # outline construction
    ib_ol_A = []
    ib_ol_A.append((cut_x2, cut_y, 0))
    ib_ol_A.append(
        (0.0, c['bagel_axle_external_radius'], -1 * cut_x2, cut_y, 0))
    ib_ol_A.append((-1 * cut_x1, cut_y, 0))
    ib_ol_A.append((0.0, c['bagel_axle_radius'], cut_x1, cut_y, 0))
    ib_ol_A.append((cut_x2, cut_y, 0))
    #ib_ol = cnc25d_api.cnc_cut_outline(ib_ol_A, "internal_bagel_ol")
    # figure construction
    ib_figure = []
    ib_figure.append(ib_ol_A)
    ib_figure_2 = []
    ib_figure_2.append(ib_ol_A)
    if (c['axle_hole_nb'] > 0):
        a_step = math.pi / c['axle_hole_nb']
        for i in range(c['axle_hole_nb'] / 2):
            a = (2 * i + 1) * a_step
            ib_figure.append(
                (0.0 + c['axle_hole_position_radius'] * math.cos(a),
                 0.0 + c['axle_hole_position_radius'] * math.sin(a),
                 c['axle_hole_radius']))
        ib_figure = cnc25d_api.rotate_and_translate_figure(
            ib_figure, 0.0, 0.0, c['axle_hole_angle'] - a_step, 0.0, 0.0)
        for i in range(c['axle_hole_nb'] / 2):
            a = (2 * i + 1 + (c['axle_hole_nb'] % 2)) * a_step
            ib_figure_2.append(
                (0.0 + c['axle_hole_position_radius'] * math.cos(a),
                 0.0 + c['axle_hole_position_radius'] * math.sin(a),
                 c['axle_hole_radius']))
        ib_figure_2 = cnc25d_api.rotate_and_translate_figure(
            ib_figure_2, 0.0, 0.0, c['axle_hole_angle'] - a_step, 0.0, 0.0)
    internal_bagel = ib_figure
    internal_bagel_2 = cnc25d_api.rotate_and_translate_figure(
        ib_figure_2, 0.0, 0.0, math.pi, 0.0, 0.0)
    ### figures output
    # part_list
    part_list = []
    part_list.append(external_bagel)
    part_list.append(middle_bagel)
    part_list.append(internal_bagel)
    part_list.append(internal_bagel_2)
    # part_list_figure
    x_space = 2.2 * c['bagel_axle_external_radius']
    part_list_figure = []
    for i in range(len(part_list)):
        part_list_figure.extend(
            cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0,
                                                   i * x_space, 0.0))
    ## bagel_part_overview
    bagel_assembly_figure = []
    bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(external_bagel, 0.0, 0.0, 0.0,
                                               0, 0))
    bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(middle_bagel, 0.0, 0.0, 0.0, 0,
                                               0))
    bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(internal_bagel, 0.0, 0.0, 0.0,
                                               0, 0))
    bagel_assembly_figure.extend(
        cnc25d_api.rotate_and_translate_figure(internal_bagel_2, 0.0, 0.0, 0.0,
                                               0, 0))
    ###
    r_figures = {}
    r_height = {}

    r_figures['external_bagel'] = external_bagel
    r_height['external_bagel'] = c['external_bagel_thickness']

    r_figures['middle_bagel'] = middle_bagel
    r_height['middle_bagel'] = c['middle_bagel_thickness']

    r_figures['internal_bagel'] = internal_bagel
    r_height['internal_bagel'] = c['internal_bagel_thickness']

    r_figures['internal_bagel_2'] = internal_bagel_2
    r_height['internal_bagel_2'] = c['internal_bagel_thickness']

    r_figures['part_list'] = part_list_figure
    r_height['part_list'] = 1.0

    r_figures['bagel_assembly'] = bagel_assembly_figure
    r_height['bagel_assembly'] = 1.0
    ###
    return ((r_figures, r_height))
Exemplo n.º 10
0
def split_gearwheel_2d_construction(c):
    """
  construct the 2D-figures with outlines at the A-format for the split_gearwheel design
  """
    ### generate the portion outlines
    part_figure_list = []
    if (c['gear_tooth_nb'] > 0):  # create a gear_profile
        for i in range(2 * c['split_nb']):
            #print("dbg333:  portion_gear_tooth_nb[i]: {:0.3f}".format(c['portion_gear_tooth_nb'][i]))
            #print("dbg334:  portion_gear_first_end[i]: {:0.3f}".format(c['portion_gear_first_end'][i]))
            #print("dbg335:  portion_gear_last_end[i]: {:0.3f}".format(c['portion_gear_last_end'][i]))
            #print("dbg336:  portion_gear_tooth_angle[i]: {:0.3f}".format(c['portion_gear_tooth_angle'][i]))
            if (c['portion_gear_tooth_nb'][i] < 1):
                print(
                    "ERR338: Error, for i {:d} portion_gear_tooth_nb {:d} smaller than 1"
                    .format(i, c['portion_gear_tooth_nb'][i]))
                sys.exit(2)
            gp_c = c.copy()
            gp_c['gear_type'] = 'e'
            #gp_c['portion_tooth_nb']    = c['portion_gear_tooth_nb'][i]
            #gp_c['portion_first_end']   = c['portion_gear_first_end'][i]
            #gp_c['portion_last_end']    = c['portion_gear_last_end'][i]
            gp_c['cut_portion'] = [
                c['portion_gear_tooth_nb'][i], c['portion_gear_first_end'][i],
                c['portion_gear_last_end'][i]
            ]
            gp_c['gear_initial_angle'] = c['portion_gear_tooth_angle'][i]
            #print("dbg342: gp_c:", gp_c)
            #print("dbg341: gp_c['portion_tooth_nb']: {:d}".format(gp_c['portion_tooth_nb']))
            i_gear_profile = inherit_gear_profile()
            i_gear_profile.apply_external_constraint(gp_c)
            gear_profile_B = i_gear_profile.get_A_figure('first_gear')[
                0]  # gear_profile always return figure at B-format
            #print("dbg321: gear_profile constraint:", i_gear_profile.get_constraint()['portion_tooth_nb'], c['portion_gear_tooth_nb'][i])
            #cnc25d_api.figure_simple_display([gear_profile_B], [], "debug gear_profile_B")
            #print("dbg345: trash_gear_profile_parameters:", trash_gear_profile_parameters)
            #print("dbg346: trash_gear_profile_parameters['portion_tooth_nb']: {:d}".format(trash_gear_profile_parameters['portion_tooth_nb']))
            tmp_a = c['split_initial_angle'] + (i + 2.0) * c['portion_angle']
            tmp_b = c['split_initial_angle'] + (i + 1.0) * c['portion_angle']
            tmp_c = c['split_initial_angle'] + (i + 0.0) * c['portion_angle']
            low_portion_A = []
            low_portion_A.append(
                (gear_profile_B[-1][0], gear_profile_B[-1][1], 0))
            low_portion_A.append(
                (c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_a),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_a),
                 c['split_rbr']))
            low_portion_A.append(
                (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_a),
                 c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_a), 0))
            if (c['low_split_type'] == 'circle'):
                low_portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_b),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_b),
                     c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_c),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_c), 0))
            elif (c['low_split_type'] == 'line'):
                low_portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_b),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_b), 0))
                low_portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_c),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_c), 0))
            low_portion_A.append(
                (c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_c),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_c),
                 c['split_rbr']))
            low_portion_A.append(
                (gear_profile_B[0][0], gear_profile_B[0][1], 0))
            #print("dbg337: low_portion_A:", low_portion_A)
            low_portion_B = cnc25d_api.cnc_cut_outline(low_portion_A,
                                                       "portion_A")
            portion_B = gear_profile_B[:]
            portion_B.extend(low_portion_B[1:])
            #part_figure_list.append([portion_B])
            part_figure_list.append([portion_B[:]])
    else:
        for i in range(2 * c['split_nb']):
            tmp_a = c['split_initial_angle'] + (i + 2.0) * c['portion_angle']
            tmp_b = c['split_initial_angle'] + (i + 1.0) * c['portion_angle']
            tmp_c = c['split_initial_angle'] + (i + 0.0) * c['portion_angle']
            portion_A = []
            portion_A.append(
                (c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_c),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_c), 0))
            portion_A.append(
                (c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_b),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_b),
                 c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_a),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_a), 0))
            portion_A.append(
                (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_a),
                 c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_a), 0))
            if (c['low_split_type'] == 'circle'):
                portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_b),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_b),
                     c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_c),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_c), 0))
            elif (c['low_split_type'] == 'line'):
                portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_b),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_b), 0))
                portion_A.append(
                    (c['g1_ix'] + c['low_split_radius'] * math.cos(tmp_c),
                     c['g1_iy'] + c['low_split_radius'] * math.sin(tmp_c), 0))
            portion_A.append(
                (c['g1_ix'] + c['high_split_radius'] * math.cos(tmp_c),
                 c['g1_iy'] + c['high_split_radius'] * math.sin(tmp_c), 0))
            portion_B = cnc25d_api.cnc_cut_outline(portion_A,
                                                   "circle_portion_A")
            #part_figure_list.append([portion_B])
            part_figure_list.append([portion_B[:]])
    ### generate the hole outlines
    for i in range(len(part_figure_list)):
        hole_figure = []
        if (c['low_hole_radius'] > 0):
            for j in range(2 * c['low_hole_nb']):
                tmp_a = c['split_initial_angle'] + i * c['portion_angle'] + (
                    j + 0.5) * c['low_hole_space_angle']
                hole_figure.append(
                    (c['g1_ix'] +
                     c['low_hole_circle_radius'] * math.cos(tmp_a),
                     c['g1_iy'] +
                     c['low_hole_circle_radius'] * math.sin(tmp_a),
                     c['low_hole_radius']))
        if (c['high_hole_radius'] > 0):
            for j in range(2 * c['high_hole_nb']):
                tmp_a = c['split_initial_angle'] + i * c['portion_angle'] + (
                    j + 0.5) * c['high_hole_space_angle']
                hole_figure.append(
                    (c['g1_ix'] +
                     c['high_hole_circle_radius'] * math.cos(tmp_a),
                     c['g1_iy'] +
                     c['high_hole_circle_radius'] * math.sin(tmp_a),
                     c['high_hole_radius']))
        #part_figure_list[i].extend(hole_figure)
        part_figure_list[i].extend(hole_figure[:])

    ### design output
    sgw_assembly_figure = []
    sgw_assembly_A_figure = []
    sgw_assembly_B_figure = []
    aligned_part_figure_list = []
    sgw_list_of_parts = []
    for i in range(2 * c['split_nb']):
        sgw_assembly_figure.extend(part_figure_list[i])
        if ((i % 2) == 0):
            sgw_assembly_A_figure.extend(part_figure_list[i])
        else:
            sgw_assembly_B_figure.extend(part_figure_list[i])
        shift_x = 2.2 * (i % 2) * c['minimal_gear_profile_radius']
        shift_y = 2.2 * int(i / 2) * c['minimal_gear_profile_radius']
        rotated_fig = cnc25d_api.rotate_and_translate_figure(
            part_figure_list[i], c['g1_ix'], c['g1_iy'],
            -1 * (c['split_initial_angle'] + i * c['portion_angle']), 0.0, 0.0)
        aligned_part_figure_list.append(rotated_fig)
        sgw_list_of_parts.extend(
            cnc25d_api.rotate_and_translate_figure(rotated_fig, 0.0, 0.0, 0.0,
                                                   shift_x, shift_y))
    ###
    r_figures = {}
    r_height = {}
    #
    for i in range(2 * c['split_nb']):
        r_figures['sgw_part_{:02d}'.format(i)] = part_figure_list[i]
        r_height['sgw_part_{:02d}'.format(i)] = c['gear_profile_height']
    #
    r_figures['sgw_assembly_fig'] = sgw_assembly_figure
    r_height['sgw_assembly_fig'] = c['gear_profile_height']
    #
    r_figures['sgw_even_assembly_fig'] = sgw_assembly_A_figure
    r_height['sgw_even_assembly_fig'] = c['gear_profile_height']
    #
    r_figures['sgw_odd_assembly_fig'] = sgw_assembly_B_figure
    r_height['sgw_odd_assembly_fig'] = c['gear_profile_height']
    #
    for i in range(2 * c['split_nb']):
        r_figures['sgw_aligned_part_{:02d}'.format(
            i)] = aligned_part_figure_list[i]
        r_height['sgw_aligned_part_{:02d}'.format(
            i)] = c['gear_profile_height']
    #
    r_figures['sgw_list_of_parts'] = sgw_list_of_parts
    r_height['sgw_list_of_parts'] = c['gear_profile_height']
    #
    ###
    return ((r_figures, r_height))
Exemplo n.º 11
0
def cross_cube_2d_construction(c):
  """ construct the 2D-figures with outlines at the A-format for the cross_cube design
  """
  ### precision
  #radian_epsilon = math.pi/1000
  ###
  # alias
  fa1t = c['face_A1_thickness']
  fa2t = c['face_A2_thickness']
  fb1t = c['face_B1_thickness']
  fb2t = c['face_B2_thickness']
  ## face figure
  # face_A
  face_A = cnc25d_api.rotate_and_translate_figure(cross_cube_sub.cross_cube_face(c, fb1t, fb2t), c['cube_width']/2.0, c['cube_height']/2.0, 0.0, 0.0, 0.0)
  # face_B
  face_B = cnc25d_api.rotate_and_translate_figure(cross_cube_sub.cross_cube_face(c, fa2t, fa1t), c['cube_width']/2.0, c['cube_height']/2.0, math.pi, 0.0, 0.0)
  # crest
  i_crest = crest.crest()
  c_c = c.copy()
  c_c['face_B1_thickness'] = fb1t
  c_c['face_B2_thickness'] = fb2t
  i_crest.apply_external_constraint(c_c)
  crest_A = cnc25d_api.rotate_and_translate_figure(i_crest.get_A_figure('crest_fig'), c['cube_width']/2.0, c['cube_height']/2.0, math.pi, 0.0, 0.0)
  c_c['face_B1_thickness'] = fa2t
  c_c['face_B2_thickness'] = fa1t
  i_crest.apply_external_constraint(c_c)
  crest_B = cnc25d_api.rotate_and_translate_figure(i_crest.get_A_figure('crest_fig'), c['cube_width']/2.0, c['cube_height']/2.0, 0.0, 0.0, 0.0)

  ## top_figure
  top_figure = cross_cube_sub.cross_cube_top(c)


  ################################################################
  # output
  ################################################################


  ### figures output
  # part_list
  part_list = []
  part_list.append(face_A)
  part_list.append(crest_A)
  part_list.append(face_B)
  part_list.append(crest_B)
  part_list.append(top_figure)
  # part_list_figure
  x_space = 1.2*max(c['cube_width'], c['gear_module']*c['virtual_tooth_nb'])
  y_space = x_space
  part_list_figure = []
  for i in range(len(part_list)):
    part_list_figure.extend(cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0, i*x_space, 0.0))
  ## intermediate parameters
  ## sub-assembly
  ## cross_cube_part_overview
  cross_cube_part_overview_figure = []
  cross_cube_part_overview_figure.extend(cnc25d_api.rotate_and_translate_figure(face_A, 0.0, 0.0, 0.0, 1*x_space, 1*y_space))
  if(c['face_A1_crest'] or c['face_A2_crest']):
    cross_cube_part_overview_figure.extend(cnc25d_api.rotate_and_translate_figure(crest_A, 0.0, 0.0, 0.0, 1*x_space, 0*y_space))
  cross_cube_part_overview_figure.extend(cnc25d_api.rotate_and_translate_figure(face_B, 0.0, 0.0, 0.0, 0*x_space, 1*y_space))
  if(c['face_B1_crest'] or c['face_B2_crest']):
    cross_cube_part_overview_figure.extend(cnc25d_api.rotate_and_translate_figure(crest_B, 0.0, 0.0, 0.0, 0*x_space, 0*y_space))
  cross_cube_part_overview_figure.extend(cnc25d_api.rotate_and_translate_figure(top_figure, 0.0, 0.0, 0.0, 2*x_space, 1*y_space))
  ###
  face_threaded_rod = [(c['ftrr'], c['ftrr'], c['ftrr'])]
  top_threaded_rod = [(c['ttrr'], c['ttrr'], c['ttrr'])]
  axle = [(c['ar'], c['ar'], c['ar'])]
  spacer = [(c['sr'], c['sr'], c['sr'])]
  
  ###
  r_figures = {}
  r_height = {}
  #
  r_figures['face_A_fig'] = face_A
  r_height['face_A_fig'] = c['face_A1_thickness']
  #
  r_figures['crest_A_fig'] = crest_A
  r_height['crest_A_fig'] = c['face_A1_thickness']
  #
  r_figures['face_B_fig'] = face_B
  r_height['face_B_fig'] = c['face_B1_thickness']
  #
  r_figures['crest_B_fig'] = crest_B
  r_height['crest_B_fig'] = c['face_B1_thickness']
  #
  r_figures['top_fig'] = top_figure
  r_height['top_fig'] = c['top_thickness']
  #
  r_figures['cc_part_list'] = part_list_figure
  r_height['cc_part_list'] = 1.0
  #
  r_figures['cc_overview'] = cross_cube_part_overview_figure
  r_height['cc_overview'] = 1.0
  #
  r_figures['face_threaded_rod'] = face_threaded_rod
  r_height['face_threaded_rod'] = 1.0
  #
  r_figures['top_threaded_rod'] = top_threaded_rod
  r_height['top_threaded_rod'] = 1.0
  #
  r_figures['axle'] = axle
  r_height['axle'] = 1.0
  #
  r_figures['spacer'] = spacer
  r_height['spacer'] = 1.0
  ###
  return((r_figures, r_height))
Exemplo n.º 12
0
def cross_cube_2d_construction(c):
    """ construct the 2D-figures with outlines at the A-format for the cross_cube design
  """
    ### precision
    #radian_epsilon = math.pi/1000
    ###
    # alias
    fa1t = c['face_A1_thickness']
    fa2t = c['face_A2_thickness']
    fb1t = c['face_B1_thickness']
    fb2t = c['face_B2_thickness']
    ## face figure
    # face_A
    face_A = cnc25d_api.rotate_and_translate_figure(
        cross_cube_sub.cross_cube_face(c, fb1t, fb2t), c['cube_width'] / 2.0,
        c['cube_height'] / 2.0, 0.0, 0.0, 0.0)
    # face_B
    face_B = cnc25d_api.rotate_and_translate_figure(
        cross_cube_sub.cross_cube_face(c, fa2t, fa1t), c['cube_width'] / 2.0,
        c['cube_height'] / 2.0, math.pi, 0.0, 0.0)
    # crest
    i_crest = crest.crest()
    c_c = c.copy()
    c_c['face_B1_thickness'] = fb1t
    c_c['face_B2_thickness'] = fb2t
    i_crest.apply_external_constraint(c_c)
    crest_A = cnc25d_api.rotate_and_translate_figure(
        i_crest.get_A_figure('crest_fig'), c['cube_width'] / 2.0,
        c['cube_height'] / 2.0, math.pi, 0.0, 0.0)
    c_c['face_B1_thickness'] = fa2t
    c_c['face_B2_thickness'] = fa1t
    i_crest.apply_external_constraint(c_c)
    crest_B = cnc25d_api.rotate_and_translate_figure(
        i_crest.get_A_figure('crest_fig'), c['cube_width'] / 2.0,
        c['cube_height'] / 2.0, 0.0, 0.0, 0.0)

    ## top_figure
    top_figure = cross_cube_sub.cross_cube_top(c)

    ################################################################
    # output
    ################################################################

    ### figures output
    # part_list
    part_list = []
    part_list.append(face_A)
    part_list.append(crest_A)
    part_list.append(face_B)
    part_list.append(crest_B)
    part_list.append(top_figure)
    # part_list_figure
    x_space = 1.2 * max(c['cube_width'],
                        c['gear_module'] * c['virtual_tooth_nb'])
    y_space = x_space
    part_list_figure = []
    for i in range(len(part_list)):
        part_list_figure.extend(
            cnc25d_api.rotate_and_translate_figure(part_list[i], 0.0, 0.0, 0.0,
                                                   i * x_space, 0.0))
    ## intermediate parameters
    ## sub-assembly
    ## cross_cube_part_overview
    cross_cube_part_overview_figure = []
    cross_cube_part_overview_figure.extend(
        cnc25d_api.rotate_and_translate_figure(face_A, 0.0, 0.0, 0.0,
                                               1 * x_space, 1 * y_space))
    if (c['face_A1_crest'] or c['face_A2_crest']):
        cross_cube_part_overview_figure.extend(
            cnc25d_api.rotate_and_translate_figure(crest_A, 0.0, 0.0, 0.0,
                                                   1 * x_space, 0 * y_space))
    cross_cube_part_overview_figure.extend(
        cnc25d_api.rotate_and_translate_figure(face_B, 0.0, 0.0, 0.0,
                                               0 * x_space, 1 * y_space))
    if (c['face_B1_crest'] or c['face_B2_crest']):
        cross_cube_part_overview_figure.extend(
            cnc25d_api.rotate_and_translate_figure(crest_B, 0.0, 0.0, 0.0,
                                                   0 * x_space, 0 * y_space))
    cross_cube_part_overview_figure.extend(
        cnc25d_api.rotate_and_translate_figure(top_figure, 0.0, 0.0, 0.0,
                                               2 * x_space, 1 * y_space))
    ###
    face_threaded_rod = [(c['ftrr'], c['ftrr'], c['ftrr'])]
    top_threaded_rod = [(c['ttrr'], c['ttrr'], c['ttrr'])]
    axle = [(c['ar'], c['ar'], c['ar'])]
    spacer = [(c['sr'], c['sr'], c['sr'])]

    ###
    r_figures = {}
    r_height = {}
    #
    r_figures['face_A_fig'] = face_A
    r_height['face_A_fig'] = c['face_A1_thickness']
    #
    r_figures['crest_A_fig'] = crest_A
    r_height['crest_A_fig'] = c['face_A1_thickness']
    #
    r_figures['face_B_fig'] = face_B
    r_height['face_B_fig'] = c['face_B1_thickness']
    #
    r_figures['crest_B_fig'] = crest_B
    r_height['crest_B_fig'] = c['face_B1_thickness']
    #
    r_figures['top_fig'] = top_figure
    r_height['top_fig'] = c['top_thickness']
    #
    r_figures['cc_part_list'] = part_list_figure
    r_height['cc_part_list'] = 1.0
    #
    r_figures['cc_overview'] = cross_cube_part_overview_figure
    r_height['cc_overview'] = 1.0
    #
    r_figures['face_threaded_rod'] = face_threaded_rod
    r_height['face_threaded_rod'] = 1.0
    #
    r_figures['top_threaded_rod'] = top_threaded_rod
    r_height['top_threaded_rod'] = 1.0
    #
    r_figures['axle'] = axle
    r_height['axle'] = 1.0
    #
    r_figures['spacer'] = spacer
    r_height['spacer'] = 1.0
    ###
    return ((r_figures, r_height))
Exemplo n.º 13
0
def plank_yz_bottom_hole(c):
  r_fig = []
  r_fig.extend(cnc25d_api.rotate_and_translate_figure(plank_xz_yz_hole(c, c['box_depth'], 1), 0,0,0, 0, c['h_plank_width']+c['fitting_height']-c['d_plank_height']-c['diagonal_lining_bottom_height']))
  return(r_fig)
Exemplo n.º 14
0
def plank_yz_top_hole(c):
  r_fig = []
  r_fig.extend(cnc25d_api.rotate_and_translate_figure(plank_xz_yz_hole(c, c['box_depth'], 1), 0,0,0, 0, c['diagonal_lining_top_height']))
  return(r_fig)
Exemplo n.º 15
0
def plank_xz_bottom_hole(c):
  r_fig = []
  r_fig.extend(cnc25d_api.rotate_and_translate_figure(plank_xz_yz_hole(c, c['box_width'], c['module_width']), 0,0,0, 0, c['h_plank_width']+c['fitting_height']-c['d_plank_height']-c['diagonal_lining_bottom_height']))
  for i in range(c['module_width']-1):
    r_fig.extend(hole_in_plank_bot_xz_for_yz(c, (i+1)*c['box_width']))
  return(r_fig)
Exemplo n.º 16
0
def split_gearwheel_2d_construction(c):
    """
  construct the 2D-figures with outlines at the A-format for the split_gearwheel design
  """
    ### generate the portion outlines
    part_figure_list = []
    if c["gear_tooth_nb"] > 0:  # create a gear_profile
        for i in range(2 * c["split_nb"]):
            # print("dbg333:  portion_gear_tooth_nb[i]: {:0.3f}".format(c['portion_gear_tooth_nb'][i]))
            # print("dbg334:  portion_gear_first_end[i]: {:0.3f}".format(c['portion_gear_first_end'][i]))
            # print("dbg335:  portion_gear_last_end[i]: {:0.3f}".format(c['portion_gear_last_end'][i]))
            # print("dbg336:  portion_gear_tooth_angle[i]: {:0.3f}".format(c['portion_gear_tooth_angle'][i]))
            if c["portion_gear_tooth_nb"][i] < 1:
                print(
                    "ERR338: Error, for i {:d} portion_gear_tooth_nb {:d} smaller than 1".format(
                        i, c["portion_gear_tooth_nb"][i]
                    )
                )
                sys.exit(2)
            gp_c = c.copy()
            gp_c["gear_type"] = "e"
            # gp_c['portion_tooth_nb']    = c['portion_gear_tooth_nb'][i]
            # gp_c['portion_first_end']   = c['portion_gear_first_end'][i]
            # gp_c['portion_last_end']    = c['portion_gear_last_end'][i]
            gp_c["cut_portion"] = [
                c["portion_gear_tooth_nb"][i],
                c["portion_gear_first_end"][i],
                c["portion_gear_last_end"][i],
            ]
            gp_c["gear_initial_angle"] = c["portion_gear_tooth_angle"][i]
            # print("dbg342: gp_c:", gp_c)
            # print("dbg341: gp_c['portion_tooth_nb']: {:d}".format(gp_c['portion_tooth_nb']))
            i_gear_profile = inherit_gear_profile()
            i_gear_profile.apply_external_constraint(gp_c)
            gear_profile_B = i_gear_profile.get_A_figure("first_gear")[
                0
            ]  # gear_profile always return figure at B-format
            # print("dbg321: gear_profile constraint:", i_gear_profile.get_constraint()['portion_tooth_nb'], c['portion_gear_tooth_nb'][i])
            # cnc25d_api.figure_simple_display([gear_profile_B], [], "debug gear_profile_B")
            # print("dbg345: trash_gear_profile_parameters:", trash_gear_profile_parameters)
            # print("dbg346: trash_gear_profile_parameters['portion_tooth_nb']: {:d}".format(trash_gear_profile_parameters['portion_tooth_nb']))
            tmp_a = c["split_initial_angle"] + (i + 2.0) * c["portion_angle"]
            tmp_b = c["split_initial_angle"] + (i + 1.0) * c["portion_angle"]
            tmp_c = c["split_initial_angle"] + (i + 0.0) * c["portion_angle"]
            low_portion_A = []
            low_portion_A.append((gear_profile_B[-1][0], gear_profile_B[-1][1], 0))
            low_portion_A.append(
                (
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_a),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_a),
                    c["split_rbr"],
                )
            )
            low_portion_A.append(
                (
                    c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_a),
                    c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_a),
                    0,
                )
            )
            if c["low_split_type"] == "circle":
                low_portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_b),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_b),
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_c),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_c),
                        0,
                    )
                )
            elif c["low_split_type"] == "line":
                low_portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_b),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_b),
                        0,
                    )
                )
                low_portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_c),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_c),
                        0,
                    )
                )
            low_portion_A.append(
                (
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_c),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_c),
                    c["split_rbr"],
                )
            )
            low_portion_A.append((gear_profile_B[0][0], gear_profile_B[0][1], 0))
            # print("dbg337: low_portion_A:", low_portion_A)
            low_portion_B = cnc25d_api.cnc_cut_outline(low_portion_A, "portion_A")
            portion_B = gear_profile_B[:]
            portion_B.extend(low_portion_B[1:])
            # part_figure_list.append([portion_B])
            part_figure_list.append([portion_B[:]])
    else:
        for i in range(2 * c["split_nb"]):
            tmp_a = c["split_initial_angle"] + (i + 2.0) * c["portion_angle"]
            tmp_b = c["split_initial_angle"] + (i + 1.0) * c["portion_angle"]
            tmp_c = c["split_initial_angle"] + (i + 0.0) * c["portion_angle"]
            portion_A = []
            portion_A.append(
                (
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_c),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_c),
                    0,
                )
            )
            portion_A.append(
                (
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_b),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_b),
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_a),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_a),
                    0,
                )
            )
            portion_A.append(
                (
                    c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_a),
                    c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_a),
                    0,
                )
            )
            if c["low_split_type"] == "circle":
                portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_b),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_b),
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_c),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_c),
                        0,
                    )
                )
            elif c["low_split_type"] == "line":
                portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_b),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_b),
                        0,
                    )
                )
                portion_A.append(
                    (
                        c["g1_ix"] + c["low_split_radius"] * math.cos(tmp_c),
                        c["g1_iy"] + c["low_split_radius"] * math.sin(tmp_c),
                        0,
                    )
                )
            portion_A.append(
                (
                    c["g1_ix"] + c["high_split_radius"] * math.cos(tmp_c),
                    c["g1_iy"] + c["high_split_radius"] * math.sin(tmp_c),
                    0,
                )
            )
            portion_B = cnc25d_api.cnc_cut_outline(portion_A, "circle_portion_A")
            # part_figure_list.append([portion_B])
            part_figure_list.append([portion_B[:]])
    ### generate the hole outlines
    for i in range(len(part_figure_list)):
        hole_figure = []
        if c["low_hole_radius"] > 0:
            for j in range(2 * c["low_hole_nb"]):
                tmp_a = c["split_initial_angle"] + i * c["portion_angle"] + (j + 0.5) * c["low_hole_space_angle"]
                hole_figure.append(
                    (
                        c["g1_ix"] + c["low_hole_circle_radius"] * math.cos(tmp_a),
                        c["g1_iy"] + c["low_hole_circle_radius"] * math.sin(tmp_a),
                        c["low_hole_radius"],
                    )
                )
        if c["high_hole_radius"] > 0:
            for j in range(2 * c["high_hole_nb"]):
                tmp_a = c["split_initial_angle"] + i * c["portion_angle"] + (j + 0.5) * c["high_hole_space_angle"]
                hole_figure.append(
                    (
                        c["g1_ix"] + c["high_hole_circle_radius"] * math.cos(tmp_a),
                        c["g1_iy"] + c["high_hole_circle_radius"] * math.sin(tmp_a),
                        c["high_hole_radius"],
                    )
                )
        # part_figure_list[i].extend(hole_figure)
        part_figure_list[i].extend(hole_figure[:])

    ### design output
    sgw_assembly_figure = []
    sgw_assembly_A_figure = []
    sgw_assembly_B_figure = []
    aligned_part_figure_list = []
    sgw_list_of_parts = []
    for i in range(2 * c["split_nb"]):
        sgw_assembly_figure.extend(part_figure_list[i])
        if (i % 2) == 0:
            sgw_assembly_A_figure.extend(part_figure_list[i])
        else:
            sgw_assembly_B_figure.extend(part_figure_list[i])
        shift_x = 2.2 * (i % 2) * c["minimal_gear_profile_radius"]
        shift_y = 2.2 * int(i / 2) * c["minimal_gear_profile_radius"]
        rotated_fig = cnc25d_api.rotate_and_translate_figure(
            part_figure_list[i],
            c["g1_ix"],
            c["g1_iy"],
            -1 * (c["split_initial_angle"] + i * c["portion_angle"]),
            0.0,
            0.0,
        )
        aligned_part_figure_list.append(rotated_fig)
        sgw_list_of_parts.extend(cnc25d_api.rotate_and_translate_figure(rotated_fig, 0.0, 0.0, 0.0, shift_x, shift_y))
    ###
    r_figures = {}
    r_height = {}
    #
    for i in range(2 * c["split_nb"]):
        r_figures["sgw_part_{:02d}".format(i)] = part_figure_list[i]
        r_height["sgw_part_{:02d}".format(i)] = c["gear_profile_height"]
    #
    r_figures["sgw_assembly_fig"] = sgw_assembly_figure
    r_height["sgw_assembly_fig"] = c["gear_profile_height"]
    #
    r_figures["sgw_even_assembly_fig"] = sgw_assembly_A_figure
    r_height["sgw_even_assembly_fig"] = c["gear_profile_height"]
    #
    r_figures["sgw_odd_assembly_fig"] = sgw_assembly_B_figure
    r_height["sgw_odd_assembly_fig"] = c["gear_profile_height"]
    #
    for i in range(2 * c["split_nb"]):
        r_figures["sgw_aligned_part_{:02d}".format(i)] = aligned_part_figure_list[i]
        r_height["sgw_aligned_part_{:02d}".format(i)] = c["gear_profile_height"]
    #
    r_figures["sgw_list_of_parts"] = sgw_list_of_parts
    r_height["sgw_list_of_parts"] = c["gear_profile_height"]
    #
    ###
    return (r_figures, r_height)
Exemplo n.º 17
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))
Exemplo n.º 18
0
def gimbal_2d_construction(c):
    """ construct the 2D-figures with outlines at the A-format for the gimbal design
  """
    # bell_bagel_assembly
    i_bba = bell_bagel_assembly.bba()
    i_bba.apply_external_constraint(c)
    bell_face = i_bba.get_A_figure('bell_face')

    # cross_cube
    i_cross_cube = cross_cube.cross_cube()
    i_cross_cube.apply_external_constraint(cross_cube_constraint(c))
    crest_A = i_cross_cube.get_A_figure('crest_A_fig')
    crest_B = i_cross_cube.get_A_figure('crest_B_fig')

    ## gimbal 2D sketch
    # intermediate parameters
    bagel_z = c['base_thickness'] + c['bell_face_height'] + c['leg_length']
    crest_A_axle_z = c['top_thickness'] + c[
        'height_margin'] + c['axle_diameter'] / 2.0
    crest_B_axle_z = crest_A_axle_z + c['inter_axle_length']
    #
    bottom_bell_face = cnc25d_api.rotate_and_translate_figure(
        bell_face, 0, bagel_z, 0.0, 0.0, 0.0)
    top_bell_face = cnc25d_api.rotate_and_translate_figure(
        bell_face, 0, bagel_z, math.pi + c['top_angle'], 0.0,
        crest_B_axle_z - bagel_z)
    bottom_crest_A = cnc25d_api.rotate_and_translate_figure(
        crest_A, c['cube_width'] / 2.0, crest_A_axle_z, c['bottom_angle'],
        -1 * c['cube_width'] / 2.0, bagel_z - crest_A_axle_z)
    top_crest_B = cnc25d_api.rotate_and_translate_figure(
        crest_B, c['cube_width'] / 2.0, crest_B_axle_z, 0.0,
        -1 * c['cube_width'] / 2.0, 0.0)

    ### figures output
    x_space = 1.2 * max(c['gear_module'] * c['virtual_tooth_nb'],
                        c['base_diameter'])
    ## gimbal_sketch
    gimbal_sketch_figure = []
    gimbal_sketch_figure.extend(
        cnc25d_api.rotate_and_translate_figure(bottom_bell_face, 0.0, 0.0, 0.0,
                                               0 * x_space, 0))
    gimbal_sketch_figure.extend(
        cnc25d_api.rotate_and_translate_figure(bottom_crest_A, 0.0, 0.0, 0.0,
                                               0 * x_space, 0))
    gimbal_sketch_figure.extend(
        cnc25d_api.rotate_and_translate_figure(top_bell_face, 0.0, 0.0, 0.0,
                                               1 * x_space, 0))
    gimbal_sketch_figure.extend(
        cnc25d_api.rotate_and_translate_figure(top_crest_B, 0.0, 0.0, 0.0,
                                               1 * x_space, 0))
    ###
    r_figures = {}
    r_height = {}
    # get figures and heights from bell_bagel_assembly
    (bba_figs, bba_heights) = i_bba.apply_2d_constructor()
    r_figures.update(bba_figs)
    r_height.update(bba_heights)
    # get figures and heights from cross_cube
    (cc_figs, cc_heights) = i_cross_cube.apply_2d_constructor()
    r_figures.update(cc_figs)
    r_height.update(cc_heights)
    #
    r_figures['gimbal_sketch'] = gimbal_sketch_figure
    r_height['gimbal_sketch'] = 1.0
    ###
    return ((r_figures, r_height))