Example #1
0
def crest_simulation_A(c):
  """ define the crest simulation
  """
  # inherit from gear_profile
  i_crest = crest.crest()
  i_crest.apply_external_constraint(c)
  i_crest.run_simulation('crest_simulation_A')
  return(1)
Example #2
0
def crest_simulation_A(c):
    """ define the crest simulation
  """
    # inherit from gear_profile
    i_crest = crest.crest()
    i_crest.apply_external_constraint(c)
    i_crest.run_simulation('crest_simulation_A')
    return (1)
Example #3
0
def cross_cube_info(c):
  """ create the text info related to the cross_cube design
  """
  r_info = ""
  i_crest = crest.crest()
  i_crest.apply_external_constraint(c)
  r_info += i_crest.get_info()
  r_info += cross_cube_sub.cross_cube_top_parameter_info(c)
  r_info += """
crest on faces:
face_A1_crest:      {:d}
face_A2_crest:      {:d}
face_B1_crest:      {:d}
face_B2_crest:      {:d}
""".format(c['face_A1_crest'], c['face_A2_crest'], c['face_B1_crest'], c['face_B2_crest'])
  #print("dbg552: r_info: {:s}".format(r_info))
  return(r_info)
Example #4
0
def cross_cube_info(c):
    """ create the text info related to the cross_cube design
  """
    r_info = ""
    i_crest = crest.crest()
    i_crest.apply_external_constraint(c)
    r_info += i_crest.get_info()
    r_info += cross_cube_sub.cross_cube_top_parameter_info(c)
    r_info += """
crest on faces:
face_A1_crest:      {:d}
face_A2_crest:      {:d}
face_B1_crest:      {:d}
face_B2_crest:      {:d}
""".format(c['face_A1_crest'], c['face_A2_crest'], c['face_B1_crest'],
           c['face_B2_crest'])
    #print("dbg552: r_info: {:s}".format(r_info))
    return (r_info)
Example #5
0
def cross_cube_constraint_constructor(ai_parser, ai_variant=0):
  """
  Add arguments relative to the cross_cube
  """
  r_parser = ai_parser
  ### face A1, A2, B1 and B2 : inherited from crest
  i_crest = crest.crest()
  r_parser = i_crest.get_constraint_constructor()(r_parser, 1)
  ### top : inherited from cross_cube_sub
  r_parser = cross_cube_sub.cross_cube_sub_constraint_constructor(r_parser, 1)
  ### select crest on face
  r_parser.add_argument('--face_A1_crest','--fa1c', action='store_true', default=False,
    help="Replace the face_A1 with the crest. Default: False")
  r_parser.add_argument('--face_A2_crest','--fa2c', action='store_true', default=False,
    help="Replace the face_A2 with the crest. Default: False")
  r_parser.add_argument('--face_B1_crest','--fb1c', action='store_true', default=False,
    help="Replace the face_B1 with the crest. Default: False")
  r_parser.add_argument('--face_B2_crest','--fb2c', action='store_true', default=False,
    help="Replace the face_B2 with the crest. Default: False")
  ### output
  # return
  return(r_parser)
Example #6
0
def cross_cube_constraint_constructor(ai_parser, ai_variant=0):
    """
  Add arguments relative to the cross_cube
  """
    r_parser = ai_parser
    ### face A1, A2, B1 and B2 : inherited from crest
    i_crest = crest.crest()
    r_parser = i_crest.get_constraint_constructor()(r_parser, 1)
    ### top : inherited from cross_cube_sub
    r_parser = cross_cube_sub.cross_cube_sub_constraint_constructor(
        r_parser, 1)
    ### select crest on face
    r_parser.add_argument(
        '--face_A1_crest',
        '--fa1c',
        action='store_true',
        default=False,
        help="Replace the face_A1 with the crest. Default: False")
    r_parser.add_argument(
        '--face_A2_crest',
        '--fa2c',
        action='store_true',
        default=False,
        help="Replace the face_A2 with the crest. Default: False")
    r_parser.add_argument(
        '--face_B1_crest',
        '--fb1c',
        action='store_true',
        default=False,
        help="Replace the face_B1 with the crest. Default: False")
    r_parser.add_argument(
        '--face_B2_crest',
        '--fb2c',
        action='store_true',
        default=False,
        help="Replace the face_B2 with the crest. Default: False")
    ### output
    # return
    return (r_parser)
Example #7
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))
Example #8
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))