Пример #1
0
def sub_gimbal_freecad_construction(c, ai_bottom_angle, ai_top_angle):
  """ generate the the freecad-object gimbal
  """
  # intermediate parameters
  z1 = c['base_thickness'] + c['bell_face_height'] + c['leg_length']
  z2 = c['inter_axle_length']
  # make the freecad-objects from bell_bagel_assembly and cross_cube
  i_bba = bell_bagel_assembly.bba()
  i_bba.apply_external_constraint(c)
  fc_bb_bottom = i_bba.get_fc_obj_3dconf('bell_bagel_assembly_conf1')
  fc_bb_top = fc_bb_bottom.copy()
  i_cross_cube = cross_cube.cross_cube()
  i_cross_cube.apply_external_constraint(cross_cube_constraint(c))
  fc_cc = i_cross_cube.get_fc_obj_3dconf('cross_cube_assembly_with_rods_and_axles')
  # place
  fc_bb_bottom.rotate(Base.Vector(0,0,0),Base.Vector(0,0,1),90)
  fc_bb_top.rotate(Base.Vector(0,0,z1),Base.Vector(0,1,0),180)
  fc_bb_top.translate(Base.Vector(0,0,z2))
  fc_cc.translate(Base.Vector(-1*c['cube_width']/2.0, -1*c['cube_width']/2.0, z1-(c['top_thickness'] + c['height_margin'] + c['axle_diameter']/2.0)))
  fc_cc.rotate(Base.Vector(0,0,0),Base.Vector(0,0,1),90)
  # apply the rotation
  fc_bb_top.rotate(Base.Vector(0,0,z1+z2),Base.Vector(0,1,0),ai_top_angle*180/math.pi)
  fc_top = Part.makeCompound([fc_bb_top, fc_cc])
  fc_top.rotate(Base.Vector(0,0,z1),Base.Vector(1,0,0),ai_bottom_angle*180/math.pi)
  r_fc_gimbal = Part.makeCompound([fc_bb_bottom, fc_top])
  return(r_fc_gimbal)
Пример #2
0
def sub_gimbal_freecad_construction(c, ai_bottom_angle, ai_top_angle):
    """ generate the the freecad-object gimbal
  """
    # intermediate parameters
    z1 = c['base_thickness'] + c['bell_face_height'] + c['leg_length']
    z2 = c['inter_axle_length']
    # make the freecad-objects from bell_bagel_assembly and cross_cube
    i_bba = bell_bagel_assembly.bba()
    i_bba.apply_external_constraint(c)
    fc_bb_bottom = i_bba.get_fc_obj_3dconf('bell_bagel_assembly_conf1')
    fc_bb_top = fc_bb_bottom.copy()
    i_cross_cube = cross_cube.cross_cube()
    i_cross_cube.apply_external_constraint(cross_cube_constraint(c))
    fc_cc = i_cross_cube.get_fc_obj_3dconf(
        'cross_cube_assembly_with_rods_and_axles')
    # place
    fc_bb_bottom.rotate(Base.Vector(0, 0, 0), Base.Vector(0, 0, 1), 90)
    fc_bb_top.rotate(Base.Vector(0, 0, z1), Base.Vector(0, 1, 0), 180)
    fc_bb_top.translate(Base.Vector(0, 0, z2))
    fc_cc.translate(
        Base.Vector(
            -1 * c['cube_width'] / 2.0, -1 * c['cube_width'] / 2.0,
            z1 - (c['top_thickness'] + c['height_margin'] +
                  c['axle_diameter'] / 2.0)))
    fc_cc.rotate(Base.Vector(0, 0, 0), Base.Vector(0, 0, 1), 90)
    # apply the rotation
    fc_bb_top.rotate(Base.Vector(0, 0, z1 + z2), Base.Vector(0, 1, 0),
                     ai_top_angle * 180 / math.pi)
    fc_top = Part.makeCompound([fc_bb_top, fc_cc])
    fc_top.rotate(Base.Vector(0, 0, z1), Base.Vector(1, 0, 0),
                  ai_bottom_angle * 180 / math.pi)
    r_fc_gimbal = Part.makeCompound([fc_bb_bottom, fc_top])
    return (r_fc_gimbal)
Пример #3
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))
Пример #4
0
def gimbal_constraint_constructor(ai_parser, ai_variant=0):
    """
  Add arguments relative to the gimbal
  """
    r_parser = ai_parser
    ### inheritance from bell_bagel_assembly
    i_bell_bagel_assembly = bell_bagel_assembly.bba()
    r_parser = i_bell_bagel_assembly.get_constraint_constructor()(r_parser, 1)
    ### inheritance from cross_cube
    i_cross_cube = cross_cube.cross_cube()
    r_parser = i_cross_cube.get_constraint_constructor()(r_parser, 1)
    ### roll-pitch angles
    r_parser.add_argument(
        '--bottom_angle',
        '--ba',
        action='store',
        type=float,
        default=0.0,
        help="Set the bottom angle (in radians). Default: 0.0")
    r_parser.add_argument('--top_angle',
                          '--ta',
                          action='store',
                          type=float,
                          default=0.0,
                          help="Set the top angle (in radians). Default: 0.0")
    ### pan_tilt angles # can be set only if roll-pitch angles are left to 0.0
    r_parser.add_argument(
        '--pan_angle',
        '--pan',
        action='store',
        type=float,
        default=0.0,
        help=
        "Set the pan angle (in radians). Use the pan-tilt angles only if roll-pitch angles are left to 0.0. Default: 0.0"
    )
    r_parser.add_argument('--tilt_angle',
                          '--tilt',
                          action='store',
                          type=float,
                          default=0.0,
                          help="Set the tilt angle (in radians). Default: 0.0")
    ### output
    # return
    return (r_parser)
Пример #5
0
def gimbal_info(c):
  """ create the text info related to the bagel design
  """
  r_info = ""
  i_bell_bagel = bell_bagel_assembly.bba()
  i_bell_bagel.apply_external_constraint(c)
  r_info += i_bell_bagel.get_info()
  i_cross_cube = cross_cube.cross_cube()
  i_cross_cube.apply_external_constraint(c)
  r_info += i_cross_cube.get_info()
  r_info += """
roll-pitch angles:
bottom_angle:   {:0.3f} (radian)    {:0.3f} (degree)
top_angle:      {:0.3f} (radian)    {:0.3f} (degree)
pan-tilt conversion:
pan_angle:      {:0.3f} (radian)    {:0.3f} (degree)
tilt_angle:     {:0.3f} (radian)    {:0.3f} (degree)
roll-pitch pan-tilt drit angle: {:0.3f} (radian)    {:0.3f} (degree)
""".format(c['bottom_angle'], c['bottom_angle']*180/math.pi, c['top_angle'], c['top_angle']*180/math.pi, c['pan_angle'], c['pan_angle']*180/math.pi, c['tilt_angle'], c['tilt_angle']*180/math.pi, c['b3'], c['b3']*180/math.pi)
  #print(r_info)
  return(r_info)
Пример #6
0
def gimbal_constraint_constructor(ai_parser, ai_variant=0):
  """
  Add arguments relative to the gimbal
  """
  r_parser = ai_parser
  ### inheritance from bell_bagel_assembly
  i_bell_bagel_assembly = bell_bagel_assembly.bba()
  r_parser = i_bell_bagel_assembly.get_constraint_constructor()(r_parser, 1)
  ### inheritance from cross_cube
  i_cross_cube = cross_cube.cross_cube()
  r_parser = i_cross_cube.get_constraint_constructor()(r_parser, 1)
  ### roll-pitch angles
  r_parser.add_argument('--bottom_angle','--ba', action='store', type=float, default=0.0,
    help="Set the bottom angle (in radians). Default: 0.0")
  r_parser.add_argument('--top_angle','--ta', action='store', type=float, default=0.0,
    help="Set the top angle (in radians). Default: 0.0")
  ### pan_tilt angles # can be set only if roll-pitch angles are left to 0.0
  r_parser.add_argument('--pan_angle','--pan', action='store', type=float, default=0.0,
    help="Set the pan angle (in radians). Use the pan-tilt angles only if roll-pitch angles are left to 0.0. Default: 0.0")
  r_parser.add_argument('--tilt_angle','--tilt', action='store', type=float, default=0.0,
    help="Set the tilt angle (in radians). Default: 0.0")
  ### output
  # return
  return(r_parser)
Пример #7
0
def gimbal_info(c):
    """ create the text info related to the bagel design
  """
    r_info = ""
    i_bell_bagel = bell_bagel_assembly.bba()
    i_bell_bagel.apply_external_constraint(c)
    r_info += i_bell_bagel.get_info()
    i_cross_cube = cross_cube.cross_cube()
    i_cross_cube.apply_external_constraint(c)
    r_info += i_cross_cube.get_info()
    r_info += """
roll-pitch angles:
bottom_angle:   {:0.3f} (radian)    {:0.3f} (degree)
top_angle:      {:0.3f} (radian)    {:0.3f} (degree)
pan-tilt conversion:
pan_angle:      {:0.3f} (radian)    {:0.3f} (degree)
tilt_angle:     {:0.3f} (radian)    {:0.3f} (degree)
roll-pitch pan-tilt drit angle: {:0.3f} (radian)    {:0.3f} (degree)
""".format(c['bottom_angle'], c['bottom_angle'] * 180 / math.pi,
           c['top_angle'], c['top_angle'] * 180 / math.pi, c['pan_angle'],
           c['pan_angle'] * 180 / math.pi, c['tilt_angle'],
           c['tilt_angle'] * 180 / math.pi, c['b3'], c['b3'] * 180 / math.pi)
    #print(r_info)
    return (r_info)
Пример #8
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))