コード例 #1
0
ファイル: split_gearwheel.py プロジェクト: charlyoleg/Cnc25D
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))
コード例 #2
0
ファイル: crest.py プロジェクト: charlyoleg/Cnc25D
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))
コード例 #3
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)