// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2014/01/27 Fixed cuff problem inches vs. cm double index, done; object marker_array[20]; double marker_count, loop; double result; double x[300], y[300]; double ang,vang,vdistance,rangle; object group_obj[50]; object current_object; point current_point; selection current_selection; double vp, ry, vy, aly,ptl, ktk, sp, pit, ep, evy, sl, ktl, rl, lk, hp, hsl; double language; double sv; double siirtox, siirtoy; double metric; double read; double ptp,ktkt,ktyt; double ktke,ktye; double pk,pl,KTS,KTY; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","MB_macros", "This macro needs to be properly installed before running it."); } init_xarc_array(); //Start Options //End Options vp=179; ry=117; vy=106; aly=108; sp=55; sl=49; pit=30; hp=67; hsl=31; sv=1; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { vp=vp/2.54; ry=ry/2.54; vy=vy/2.54; aly=aly/2.54; sp=sp/2.54; sl=sl/2.54; hp=hp/2.54; pit=pit/2.54; hsl=hsl/2.54; sv=sv/2.54; } } else { if (language == 0) { metric=2*pop_up("Units","Inches","Centimeters"); } if (metric<1) { vp=vp/2.54; ry=ry/2.54; vy=vy/2.54; aly=aly/2.54; sp=sp/2.54; sl=sl/2.54; hp=hp/2.54; pit=pit/2.54; hsl=hsl/2.54; sv=sv/2.54; } } if(metric==0) { sv=0.39; } read = 0; if (is_function("measure_table")==1) { if (measure_table("default_men")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("MEN'S JACKET"); add_picture_input("Chest circumference", ry, "m_chest_circumference"); add_picture_input("Waist circumference", vy, "m_waist_circumference_shirt"); add_picture_input("Hip circumference", aly, "m_hip_circumference"); add_picture_input("Back length", sp, "m_back_length"); add_picture_input("Back width",sl, "m_back_width"); add_picture_input("Overarm length",hp, "m_arm_length"); } run_picture_input(); } else { if (language == 0) { dialog_box("MEN'S JACKET - 1 of 1", "Chest circumference", ry, "Waist circumference", vy, "Hip circumference", aly, "Back length", sp, "Back width",sl, "Overarm length",hp); } } } if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("CUSTOM MEASUREMENTS"); add_picture_input("Length from waist",pit, "m_jacket_length_from_waist"); add_picture_input("Cuff circumference",hsl, "m_cuff_circumference_jacket"); add_picture_input("Seam Allowance",sv, "meas_seamallow"); } run_picture_input(); } else { if (language == 0) { dialog_box("CUSTOM MEASUREMENTS", "Length from waist",pit, "Cuff circumference",hsl, "Seam Allowance",sv); } } if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { vp=vp*2.54; ry=ry*2.54; vy=vy*2.54; aly=aly*2.54; sp=sp*2.54; sl=sl*2.54; hp=hp*2.54; pit=pit*2.54; hsl=hsl*2.54; sv=sv*2.54; } } else { if (metric<1) { vp=vp*2.54; ry=ry*2.54; vy=vy*2.54; aly=aly*2.54; sp=sp*2.54; sl=sl*2.54; hp=hp*2.54; pit=pit*2.54; hsl=hsl*2.54; sv=sv*2.54; } } if(metric==2) { sv=sv/2.54; } ry=ry+6; vy=vy+6; aly=aly+6; sl=sl+3; if (ry < 92) { ktk=22; } else { if (ry < 96) { ktk=22.8; } else { if (ry < 100) { ktk=23.6; } else { if (ry < 104) { ktk=24.4; } else { if (ry < 108) { ktk=25.3; } else { if (ry < 112) { ktk=26.4; } else { if (ry < 116) { ktk=26.8; } else { if (ry < 120) { ktk=27.2; } else { if (ry < 124) { ktk=27.6; } else { if (ry < 128) { ktk=28; } else { if (ry < 132) { ktk=28.4; } else { ktk=28.8; } } } } } } } } } } } ptl=ry/20+3; ep=ktk+2; evy=vy/4; ktl=ry/8+3.5; rl=ry*2/10+2; lk=21; x[0]=0; y[0]=0; coord(0,1,0,0); coord(1,2,-ptl,0); coord(2,3,0,2.2); coord(1,4,0,-ktk/2); coord(1,5,0,-ktk); coord(1,6,0,-sp); coord(6,7,0,-lk); coord(6,8,0,-pit); coord(5,105,-50,0); coord(6,106,-50,0); coord(7,107,-50,0); coord(8,108,-50,0); coord(7,9,-3,0); line_intersect (4,9,6,106,10); coord(10,11,-1,0); line_intersect (5,105,4,11,12); coord(12,13,-sl/2,0); x[15]=x[13]; y[15]=y[1]-2; cont(3,15,16,2); coord(3,17,-0.5,0.5); coord(13,18,0,dist(1,5)/4); coord(9,19,-dist(12,13)+1.5,0); line_intersect (6,106,13,19,20); coord(20,21,1.7,0); coord(13,22,-1,0); x[23]=x[22]-0.8; y[23]=y[18]; x[24]=x[9]; y[24]=y[8]; x[25]=x[19]; y[25]=y[8]; x[26]=x[23]+0.8+1; y[26]=y[4]; current_object=newobject("poly"); addpoint((x[1])/2.54, (y[1]+1)/2.54, "LINE"); current_point=addpoint((x[4])/2.54, (y[4]+1)/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[12])/2.54, (y[12]+1)/2.54, "LINE"); current_point=addpoint((x[11])/2.54, (y[11]+1)/2.54, "LINE"); notch_type(current_point,"NOTCH",0); current_point=addpoint((x[9])/2.54, (y[9]+1)/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[24])/2.54, (y[24]+1)/2.54, "LINE"); addpoint((x[25]+.8)/2.54, (y[25]+1)/2.54, "LINE"); current_point=addpoint((x[19]+.8)/2.54, (y[19]+1)/2.54, "LINE"); notch_type(current_point,"NOTCH",0); current_point=addpoint((x[21]+.8)/2.54, (y[21]+1)/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[22]+.8)/2.54, (y[22]+1)/2.54, "line"); current_point=addpoint((x[23]+.8)/2.54, (y[23]+1)/2.54, "xarc_start"); notch_type(current_point,"btn",0); addpoint((x[26]+.8)/2.54, (y[26]+1)/2.54, "XARC_CORNER"); addpoint((x[16]+.8)/2.54, (y[16]-.8+1)/2.54, "LINE"); addpoint((x[17])/2.54, (y[17]-.8+1)/2.54, "xarc_start"); addpoint((x[17])/2.54, (y[2]+1)/2.54, "xarc_corner"); group_obj[1]=current_object; current_object=newobject("poly"); addpoint((x[17])/2.54, (y[2]+1-4)/2.54, "line"); addpoint((x[17])/2.54, (y[2]+1-4)-ktk/2.54, "open"); group_obj[22]=current_object; if (language == 0) { current_object=newobject("text","Center Back",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[1]-1)/2.54, (y[1]-1)/2.54, "line"); group_obj[23]=current_object; if(sv>0) { offset_mark(1); select(current_selection,group_obj[22]); select(current_selection,group_obj[23]); group(current_selection); deselect(current_selection); } else { mark(1); current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); select(current_selection,group_obj[22]); select(current_selection,group_obj[23]); group(current_selection); deselect(current_selection); } siirtoy=1.5*dist(1,4); current_object=newobject("poly"); addpoint((x[4])/2.54, (y[4]+1+siirtoy)/2.54, "xarc_start"); addpoint((x[4]-sl/2)/2.54, (y[4]+1+siirtoy)/2.54, "xarc_corner"); addpoint((x[23]+.8)/2.54, (y[23]+1+siirtoy)/2.54, "xarc_start"); addpoint((x[26]+.8)/2.54, (y[26]+1+siirtoy)/2.54, "XARC_CORNER"); addpoint((x[16]+.8)/2.54, (y[16]-.8+1+siirtoy)/2.54, "line"); addpoint((x[17])/2.54, (y[17]-.8+1+siirtoy)/2.54, "xarc_start"); addpoint((x[17])/2.54, (y[2]+1+siirtoy)/2.54, "xarc_corner"); addpoint((x[1])/2.54, (y[1]+1+siirtoy)/2.54, "open"); group_obj[2]=current_object; current_object=newobj_dot((x[4])/2.54, (y[4]+1+siirtoy)/2.54); addpoint((x[1])/2.54, (y[1]+1+siirtoy)/2.54, "open"); group_obj[18]=current_object; if (language == 0) { current_object=newobject("text","Center Back",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[1]-1)/2.54, (y[1]-1+siirtoy)/2.54, "line"); group_obj[24]=current_object; if(sv>0) { offset_mark(2); select(current_selection,group_obj[18]); select(current_selection,group_obj[24]); group(current_selection); deselect(current_selection); } else { mark(2); current_selection=newselection("OBJECT"); select(current_selection,group_obj[2]); select(current_selection,group_obj[18]); select(current_selection,group_obj[24]); group(current_selection); deselect(current_selection); } siirtoy=0; ptp=arclength (1,2,17); ktkt=dist(22,16); ktyt=arclength(23,26,16); coord(22,1,-25,0); x[2]=x[1]; y[2]=y[20]; coord(2,3,0,-lk); coord(1,4,0,+ep); coord(1,5,ktl,0); coord(1,6,-rl,0); coord(2,7,-evy,0); center(1,6,8); center(2,7,9); coord(8,10,-2.5,0); x[11]=x[10]; y[11]=y[4]; coord(11,12,0,-ptl); coord(12,13,-(ptl+2),0); coord(4,14,0,-3.5); cont(11,14,15,dist(17,16)-dist(11,14)); coord(1,16,0,ktk/4); coord(2,17,0,-6); coord(9,18,2,0); coord(18,19,0,-dist(2,17)-0.7); coord(1,20,3.5,0); coord(17,21,2,0); coord(3,22,2,0); coord(20,23,2,0); coord(21,24,2,0); coord(22,25,2,0); coord(23,26,1,0); coord(3,27,dist(1,5)+2,0); coord(2,128,50,0); line_intersect (2,128,5,27,28); coord(28,29,0,1); coord(29,30,-1.7,0); coord(5,31,0,1); coord(31,32,0,ktk/4); coord(27,33,0,-(pit-lk)+1); coord(7,34,0,-dist(30,33)-0.5+1); cont(21,22,135,-50); line_intersect (33,34,21,135,35); cont(24,25,136,-50); line_intersect (33,34,24,136,36); cont(34,35,37,1); coord(19,138,0,-50); line_intersect (19,138,33,34,38); cont(35,38,39,1); coord(1,41,0,ktl/4-1); cont(26,31,126,-dist(26,31)/3); x[142]=x[34]; y[142]=y[19]+10; x[143]=x[34]; y[143]=y[19]; coord(142,42,-2,0); coord(143,43,-2,0); coord(11,44,-1.5,0); x[111]=x[44]; y[111]=y[13]+3; current_object=newobject("poly"); addpoint((x[10])/2.54, (y[10]+5)/2.54, "LINE"); addpoint((x[10]+11)/2.54, (y[10]+5+2)/2.54, "LINE"); addpoint((x[10]+11)/2.54, (y[10]+5+2-3)/2.54, "LINE"); addpoint((x[10])/2.54, (y[10]+5-3)/2.54, "LINE"); group_obj[3]=current_object; siirtox=ptl; siirtoy=ktk; current_object=newobject("poly"); addpoint((x[10]+11+siirtox)/2.54, (y[10]+5+2+siirtoy)/2.54, "LINE"); addpoint((x[10]+11+siirtox)/2.54, (y[10]+5+2-3+siirtoy)/2.54, "LINE"); addpoint((x[10]+siirtox)/2.54, (y[10]+5-3+siirtoy)/2.54, "line"); addpoint((x[10]+siirtox)/2.54, (y[10]+5+siirtoy)/2.54, "open"); group_obj[19]=current_object; current_object=newobj_dot((x[10]+11+siirtox)/2.54, (y[10]+5+2+siirtoy)/2.54); addpoint((x[10]+siirtox)/2.54, (y[10]+5+siirtoy)/2.54, "open"); group_obj[20]=current_object; if(sv>0) { offset_mark(19); select(current_selection,group_obj[20]); group(current_selection); deselect(current_selection); } else { mark(19); current_selection=newselection("OBJECT"); select(current_selection,group_obj[19]); select(current_selection,group_obj[20]); group(current_selection); deselect(current_selection); } siirtoy=0; current_object=newobject("poly"); addpoint((x[15]-.8)/2.54, (y[15]-.8)/2.54, "line"); addpoint((x[16]-.8)/2.54, y[16]/2.54, "line"); addpoint((x[41]-.8)/2.54, y[41]/2.54, "xarc_start"); addpoint((x[1]-.8)/2.54, (y[1]-.8)/2.54, "xarc_corner"); addpoint((x[20]-.8)/2.54, (y[20]-.8)/2.54, "xarc_start"); x[120]=x[21]-2; y[120]=y[18]; addpoint((x[120]-.8+0.5)/2.54, y[120]/2.54, "xarc_corner"); addpoint((x[21]-.8+0.5)/2.54, y[21]/2.54, "LINE"); addpoint((x[21]-.8-0.5)/2.54, y[21]/2.54, "LINE"); x[137]=x[37]; y[137]=y[3]; current_point=addpoint((x[137]-.8)/2.54, y[137]/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[37]-.8)/2.54, y[37]/2.54, "LINE"); addpoint((x[38])/2.54, y[38]/2.54, "LINE"); addpoint((x[39])/2.54, y[39]/2.54, "line"); addpoint((x[39]-dist(39,34)/2)/2.54, y[39]/2.54, "xarc_start"); addpoint((x[34])/2.54, y[34]/2.54, "xarc_corner"); addpoint((x[43])/2.54, y[43]/2.54, "LINE"); addpoint((x[42])/2.54, y[42]/2.54, "xarc_start"); x[242]=x[42]-3; y[242]=y[6]; addpoint((x[242])/2.54, y[242]/2.54, "xarc_corner"); addpoint((x[13])/2.54, y[13]/2.54, "LINE"); cont(111,13,113,-4); current_point=addpoint((x[113])/2.54, y[113]/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[111])/2.54, y[111]/2.54, "LINE"); addpoint((x[11])/2.54, (y[11]-.8)/2.54, "LINE"); group_obj[4]=current_object; current_object=newobject("poly"); addpoint((x[22]-0.5)/2.54, y[21]/2.54, "LINE"); addpoint((x[19])/2.54, y[19]/2.54, "LINE"); current_point=addpoint((x[18])/2.54, y[18]/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[18]-0.75)/2.54, (y[10]-2)/2.54, "LINE"); addpoint((x[18]-1.5)/2.54, y[18]/2.54, "LINE"); addpoint((x[19]-1)/2.54, y[19]/2.54, "LINE"); group_obj[6]=current_object; current_object=newobject("poly"); addpoint((x[24]+2+.8)/2.54, y[24]/2.54, "LINE"); cont (21,24,124,+(17-dist(19,21)-0.5)); addpoint((x[124]+2)/2.54, (y[124])/2.54, "LINE"); group_obj[7]=current_object; current_object=newobject("poly"); addpoint((x[9])/2.54, y[19]/2.54, "LINE"); addpoint((x[9])/2.54, (y[19]-4)/2.54, "Xarc_start"); addpoint((x[9])/2.54, (y[19]-6)/2.54, "Xarc_corner"); addpoint((x[19]+1-1)/2.54, (y[19]-6)/2.54, "LINE"); addpoint((x[21]-3-1)/2.54, (y[21]-6)/2.54, "open"); group_obj[8]=current_object; current_object=newobject("poly"); addpoint((x[143])/2.54, (y[143]-8)/2.54, "LINE"); current_point=addpoint((x[142])/2.54, (y[142])/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point=addpoint((x[143])/2.54, (y[143])/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point=addpoint((x[143])/2.54, (y[143]-5)/2.54, "open"); group_obj[9]=current_object; if (language == 0) { current_object=newobject("text","Center Back",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[142]+.2)/2.54, (y[142]-1+siirtoy)/2.54, "line"); group_obj[29]=current_object; current_object=newobject("poly"); addpoint((x[42])/2.54, (y[42])/2.54, "LINE"); cont(42,44,144,-10); addpoint((x[144])/2.54, (y[144])/2.54, "LINE"); group_obj[10]=current_object; if(sv>0) { offset_mark(4); select(current_selection,group_obj[3]); select(current_selection,group_obj[6]); select(current_selection,group_obj[7]); select(current_selection,group_obj[8]); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } else { mark(4); current_selection=newselection("OBJECT"); select(current_selection,group_obj[4]); select(current_selection,group_obj[3]); select(current_selection,group_obj[6]); select(current_selection,group_obj[7]); select(current_selection,group_obj[8]); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } siirtox=-ry/4-4; cont(15,11,121,-5); current_object=newobject("poly"); addpoint((x[39]+siirtox)/2.54, y[39]/2.54, "line"); addpoint((x[39]-dist(39,34)/2+siirtox)/2.54, y[39]/2.54, "xarc_start"); addpoint((x[34]+siirtox)/2.54, y[34]/2.54, "xarc_corner"); addpoint((x[43]+siirtox)/2.54, y[43]/2.54, "LINE"); addpoint((x[42]+siirtox)/2.54, y[42]/2.54, "xarc_start"); x[242]=x[42]-3; y[242]=y[6]; addpoint((x[242]+siirtox)/2.54, y[242]/2.54, "xarc_corner"); addpoint((x[13]+siirtox)/2.54, y[13]/2.54, "LINE"); cont(111,13,113,-4); current_point=addpoint((x[113]+siirtox)/2.54, y[113]/2.54, "LINE"); notch_type(current_point,"NOTCH",0); addpoint((x[111]+siirtox)/2.54, y[111]/2.54, "LINE"); addpoint((x[11]+siirtox)/2.54, (y[11]-.8)/2.54, "LINE"); addpoint((x[15]-.8+siirtox)/2.54, (y[15]-.8)/2.54, "line"); addpoint((x[16]-.8+siirtox)/2.54, y[16]/2.54, "xarc_start"); addpoint((x[18]-0.75+siirtox)/2.54, (y[16])/2.54, "xarc_corner"); addpoint((x[18]-1.5+siirtox)/2.54, y[18]/2.54, "LINE"); addpoint((x[19]-1+siirtox)/2.54, y[19]/2.54, "LINE"); group_obj[5]=current_object; current_object=newobject("poly"); addpoint((x[143]+siirtox)/2.54, (y[143]-8)/2.54, "LINE"); current_point=addpoint((x[142]+siirtox)/2.54, (y[142])/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point=addpoint((x[143]+siirtox)/2.54, (y[143])/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point=addpoint((x[143]+siirtox)/2.54, (y[143]-5)/2.54, "LINE"); group_obj[20]=current_object; current_object=newobject("poly"); addpoint((x[42]+siirtox)/2.54, (y[42])/2.54, "LINE"); cont(42,44,144,-10); addpoint((x[144]+siirtox)/2.54, (y[144])/2.54, "LINE"); group_obj[21]=current_object; if (language == 0) { current_object=newobject("text","Center Back",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[142]+.2+siirtox)/2.54, (y[142]-1+siirtoy)/2.54, "line"); group_obj[26]=current_object; if(sv>0) { offset_mark(5); group(current_selection); select(current_selection,group_obj[20]); select(current_selection,group_obj[21]); select(current_selection,group_obj[26]); group(current_selection); deselect(current_selection); } else { mark(5); current_selection=newselection("OBJECT"); select(current_selection,group_obj[5]); select(current_selection,group_obj[20]); select(current_selection,group_obj[21]); select(current_selection,group_obj[26]); group(current_selection); deselect(current_selection); } siirtox=0; current_object=newobject("poly"); addpoint((x[26]+.8+2)/2.54, (y[26]-.8)/2.54, "LINE"); addpoint((x[24]+.8+2)/2.54, y[24]/2.54, "LINE"); current_point=addpoint((x[25]+.8+2)/2.54, y[25]/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[36]+.8+2)/2.54, y[36]/2.54, "LINE"); addpoint((x[33]-.8+2)/2.54, y[33]/2.54, "LINE"); current_point=addpoint((x[27]-.8+2)/2.54, y[27]/2.54, "LINE"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[30]-.8+2)/2.54, y[30]/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[31]-.8+2)/2.54, y[31]/2.54, "LINE"); current_point=addpoint((x[32]-0.8+2)/2.54, (y[32]-.8)/2.54, "xarc_start"); notch_type(current_point,"btn",1); addpoint((x[126]+2)/2.54, (y[126]-.8)/2.54, "xarc_corner"); group_obj[11]=current_object; current_object=newobject("poly"); addpoint((x[126]+2)/2.54, (y[126]-.8-4)/2.54, "LINE"); addpoint((x[126]+2)/2.54, (y[126]-.8-4-ktk)/2.54, "open"); group_obj[21]=current_object; if(sv>0) { offset_mark(11); select(current_selection,group_obj[21]); group(current_selection); deselect(current_selection); } else { mark(11); current_selection=newselection("OBJECT"); select(current_selection,group_obj[11]); select(current_selection,group_obj[21]); group(current_selection); deselect(current_selection); } ktke=dist(1,15); ktye=arclength(20,1,41)+arclength(41,16,15)+arclength(26,126,32); coord(15,1,2,0); coord(1,2,0,-4); coord(1,3,0,-6); coord(3,4,2,0); coord(3,5,15,0); coord(3,6,17,0); coord(6,7,0,2); coord(6,8,0,6); current_object=newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "LINE"); addpoint((x[2])/2.54, (y[2])/2.54, "xarc_start"); addpoint((x[3])/2.54, (y[3])/2.54, "xarc_corner"); addpoint((x[4])/2.54, (y[4])/2.54, "LINE"); addpoint((x[5])/2.54, (y[5])/2.54, "xarc_start"); addpoint((x[6])/2.54, (y[6])/2.54, "xarc_corner"); addpoint((x[7])/2.54, (y[7])/2.54, "LINE"); addpoint((x[8])/2.54, (y[8])/2.54, "LINE"); group_obj[12]=current_object; if(sv>0) { offset_mark(12); group(current_selection); deselect(current_selection); } else { mark(12); current_selection=newselection("OBJECT"); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); } coord(111,1,0,0); coord(11,2,0,0); cont(42,44,45,20); linecirc(11,42,45,ptp,1,3); ang=(6*360/2/3.14159/ptp)*3.14159/180; rotate(3,2,-ang); cont(2,3,4,-6); rotate (4,3,-angle (x[3],y[4],x[3],y[4]+90*3.14159/180)); coord(2,5,-6,0); cont (5,13,6,-4); cont(111,13,7,-4); cont(6,7,6,-3.5); current_object=newobject("poly"); addpoint((x[4]-2)/2.54, (y[4]+2)/2.54, "xarc_start"); addpoint((x[5]-2)/2.54, (y[5]+2)/2.54, "xarc_corner"); addpoint((x[6]-2)/2.54, (y[6]+2)/2.54, "LINE"); addpoint((x[7]-2)/2.54, (y[7]+2)/2.54, "LINE"); addpoint((x[1]-2)/2.54, (y[1]+2)/2.54, "xarc_start"); addpoint((x[2]-2)/2.54, (y[2]+2)/2.54, "xarc_corner"); addpoint((x[3]-2)/2.54, (y[3]+2)/2.54, "open"); group_obj[13]=current_object; current_object=newobj_dot((x[4]-2)/2.54, (y[4]+2)/2.54); addpoint((x[3]-2)/2.54, (y[3]+2)/2.54, "open"); group_obj[17]=current_object; if (language == 0) { current_object=newobject("text","CB",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[4]-2)/2.54, (y[4]+2-2)/2.54, "line"); group_obj[29]=current_object; if(sv>0) { offset_mark(13); select(current_selection,group_obj[17]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } else { mark(13); current_selection=newselection("OBJECT"); select(current_selection,group_obj[13]); select(current_selection,group_obj[17]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } kts=ktke+ktkt; kty=ktye+ktyt; pk=kts/2-(kts/10+2); pl=kty/2+1; coord(13,1,1.5*sl+8,0); coord(1,2,0,-pk); coord(1,3,0,-hp); coord(3,4,0,1); coord(3,5,0,-1); center(2,4,6); y[6]=y[6]-1.5; coord(2,102,50,0); coord(6,106,50,0); coord(5,105,50,0); coord(2,7,0,(ktl/4-2)); coord(1,8,sqrt(pl*pl-dist(1,7)*dist(1,7)),0); center (1,8,9); center(1,9,10); cont(9,8,11,-2/3*dist(9,8)); coord(8,108,0,-70); coord(9,109,0,-30); line_intersect (2,102,8,108,12); line_intersect (6,106,8,108,13); line_intersect (2,102,9,109,14); coord(8,15,0,-(ktl/4+0.5)); coord(14,16,-2,0); center(7,10,17); coord(6,18,1.5,0); coord(2,19,-2.5,0); coord(18,20,-2.5,0); coord(4,21,-2.5,0); coord(5,22,sqrt((hsl/2+1)*(hsl/2+1)-2*2),0); coord(15,115,-20,0); line_intersect (15,112,8,16,23); coord(2,24,1,0); coord(18,25,1,0); coord(4,26,1,0); coord(23,27,0.8,0); coord(13,28,-1,0); coord(15,29,0.8,0); current_object=newobject("poly"); addpoint((x[19]+.8)/2.54, (y[19]-.8)/2.54, "LINE"); current_point=addpoint((x[20]+.8)/2.54, y[20]/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[21]+.8)/2.54, y[21]/2.54, "xarc_start"); addpoint((x[4]+.8)/2.54, y[4]/2.54, "xarc_corner"); addpoint((x[22]-.8)/2.54, y[22]/2.54, "xarc_start"); addpoint((x[13]-.8+1)/2.54, y[13]/2.54, "xarc_corner"); current_point=addpoint((x[15])/2.54, (y[15]-.8)/2.54, "xarc_start"); notch_type(current_point,"btn",1); center(15,11,111); x[111]=x[111]+2; addpoint((x[111]-.8)/2.54, (y[111])/2.54, "xarc_corner"); addpoint((x[11])/2.54, (y[11]-.8)/2.54, "xarc_start"); center(11,9,109); y[109]=y[109]+0.5; addpoint((x[109])/2.54, (y[109]-.8)/2.54, "xarc_corner"); addpoint((x[9])/2.54, (y[9]-.8)/2.54, "xarc_start"); center(9,17,117); y[117]=y[9]; addpoint((x[117]+.8)/2.54, (y[117]-.8)/2.54, "xarc_corner"); addpoint((x[17]+.8)/2.54, (y[17]-.8)/2.54, "line"); addpoint((x[7]+.8)/2.54, (y[7]-.8)/2.54, "xarc_start"); addpoint((x[2]+.8-1)/2.54, (y[2]-.8)/2.54, "xarc_corner"); group_obj[14]=current_object; if (language == 0) { current_object=newobject("text","Sleeve Front",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[17]+2)/2.54, (y[17]-2)/2.54, "line"); group_obj[28]=current_object; current_object=newobject("poly"); addpoint((x[9])/2.54, (y[9]-.8)/2.54, "LINE"); addpoint((x[9])/2.54, (y[13])/2.54, "LINE"); group_obj[15]=current_object; if(sv>0) { offset_mark(14); select(current_selection,group_obj[15]); select(current_selection,group_obj[28]); group(current_selection); deselect(current_selection); } else { mark(14); current_selection=newselection("OBJECT"); select(current_selection,group_obj[14]); select(current_selection,group_obj[15]); select(current_selection,group_obj[28]); group(current_selection); deselect(current_selection); } siirtox=sl/2+4; current_object=newobject("poly"); current_point=addpoint((x[25]+.8+siirtox)/2.54, (y[25])/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[26]+.8+siirtox)/2.54, (y[26])/2.54, "LINE"); addpoint((x[22]-.8+siirtox)/2.54, (y[22])/2.54, "xarc_start"); addpoint((x[28]-.8+1+siirtox)/2.54, (y[28])/2.54, "xarc_corner"); current_point=addpoint((x[23]+siirtox)/2.54, (y[23]-.8)/2.54, "LINE"); notch_type(current_point,"btn",1); center(23,16,123); addpoint((x[123]+siirtox)/2.54, (y[123]-.8)/2.54, "xarc_start"); addpoint((x[16]+siirtox)/2.54, (y[16]-.8)/2.54, "xarc_corner"); center(16,24,116); current_point=addpoint((x[116]+siirtox)/2.54, (y[116]-.8)/2.54, "LINE"); notch_type(current_point,"notch",1); addpoint((x[24]+0.8+siirtox)/2.54, (y[24]-.8)/2.54, "LINE"); group_obj[16]=current_object; if(sv>0) { offset_mark(16); group(current_selection); deselect(current_selection); } else { mark(16); current_selection=newselection("OBJECT"); select(current_selection,group_obj[16]); group(current_selection); deselect(current_selection); } current_selection=newselection("OBJECT"); for (loop = 0; loop < 20; loop = loop + 1) { if (marker_array[loop] != 0) { select(current_selection, marker_array[loop]); } } check_overlap(current_selection); if (is_function("origin_arrange")==1) { origin_arrange(current_selection); } deselect(current_selection); if (is_function("set_marker")==1) { for (loop = 0; loop < 20; loop = loop + 1) { if (marker_array[loop] != 0) { set_marker(marker_array[loop], 0); } } } run_command("zoomall"); } newobj_dot(double x, double y) { object temp; line("CENTER_LINE"); temp = newobject("poly"); addpoint(x, y, "line"); line("SOLID_LINE"); return temp; } coord(double orig, double dest, double xxx, double yyy) { x[dest]=x[orig]+xxx; y[dest]=y[orig]+yyy; } center(double one, double two, double result) { x[result]=(x[one]+x[two])/2; y[result]=(y[one]+y[two])/2; } dist(double p1, double p2) { return distance(x[p1],y[p1],x[p2],y[p2]); } line_intersect(double start1, double end1, double start2, double end2, double dest) { double tempx; double tempy; intersect(x[start1],y[start1],x[end1],y[end1],x[start2],y[start2],x[end2],y[end2],0); x[dest]=getresultx(); y[dest]=getresulty(); } cont(double cstart, double cend, double cdest, double cvdistanceance) { double ang; ang=angle(x[cstart], y[cstart], x[cend], y[cend]); polar(x[cend], y[cend], ang, cvdistanceance); x[cdest]=getresultx(); y[cdest]=getresulty(); } right_ang(double start, double end, double to_point, double dest) { double m,b; if (x[start]==x[end]) { x[dest]=x[end]; y[dest]=y[to_point]; } else { if (y[start]==y[end]) { x[dest]=x[to_point]; y[dest]=y[end]; } else { m=(y[start]-y[end])/(x[start]-x[end]); m=-1/m; b=y[to_point]-m*x[to_point]; intersect(x[start],y[start],x[end],y[end],x[to_point],y[to_point],0,b,0); x[dest]=getresultx(); y[dest]=getresulty(); } } } mark(double pass_index) { group_obj[pass_index]=marker_piece(group_obj[pass_index],1); marker_array[marker_count] = group_obj[pass_index]; marker_count = marker_count + 1; } offset_mark(double pass_index) { point pnt, test; double save_x, save_y; current_selection=newselection("OBJECT"); select(current_selection,group_obj[pass_index]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); current_object=last_obj(); marker_array[marker_count] = marker_piece(current_object,1); current_selection=newselection("OBJECT"); select(current_selection, marker_array[marker_count]); select(current_selection, group_obj[pass_index]); marker_count = marker_count + 1; } Forward() { index = index + 1; if (index == 0) { done = 1; } } Backward() { index = index - 1; } shift(double orig, double xxx, double yyy) { x[orig]=x[orig]+xxx; y[orig]=y[orig]+yyy; } rect (double x1, double y1, double x2, double y2) { newobject("poly"); addpoint( x1/2.54,y1/2.54,"LINE"); addpoint( x2/2.54,y1/2.54,"LINE"); addpoint( x2/2.54,y2/2.54,"LINE"); addpoint( x1/2.54,y2/2.54,"LINE"); } dot (double x, double y) { newobject("poly"); addpoint( x/2.54,y/2.54,"LINE"); } line (double x3, double y3, double x4, double y4) { newobject("poly"); addpoint( x3/2.54,y3/2.54,"LINE"); addpoint( x4/2.54,y4/2.54,"LINE"); } rotate(double rpoint,double rcenter, double rangle) { double vdistance, vang; vdistance=dist(rpoint, rcenter); vang=angle(x[rcenter],y[rcenter],x[rpoint],y[rpoint]); polar(x[rcenter],y[rcenter],vang+rangle,vdistance); x[rpoint]=getresultx(); y[rpoint]=getresulty(); } linecirc(double PA,double PB,double PC,double dradius,double which, double PD) { double mslope, dist0, dist1, dist2, xtemp; double tx, ty; xtemp = (x[PB]-x[PC])*(x[PB]-x[PC]); if (xtemp > 0) { xtemp = (y[PB]-y[PC])*(y[PB]-y[PC]); if ( xtemp > 0) { mslope = (y[PC] - y[PB])/(x[PC] - x[PB]); tx = x[PA] + 1; ty = y[PA] - 1/mslope; intersect(x[PA], y[PA], tx, ty, x[PB], y[PB], x[PC], y[PC], 0); tx = getresultx(); ty = getresulty(); dist1 = distance(x[PA], y[PA], tx, ty); dist2 = interceptline(0, dist1, dradius); dist0 = sqrt(1+mslope*mslope); xtemp = dist2/dist0; if (which) { x[PD] = tx+xtemp; y[PD] = ty+ xtemp*mslope; } else { x[PD] = tx-xtemp; y[PD] = ty- xtemp*mslope; } } else { x[PD] = x[PB]; if (which) { y[PD] = y[PA] + interceptline(x[PA], x[PB], dradius); } else { y[PD] = y[PA] - interceptline(x[PA], x[PB], dradius); } } } else { y[PD] = y[PB]; if (which) { x[PD] = x[PA] + interceptline(y[PA], y[PB], dradius); } else { x[PD] = x[PA] - interceptline(y[PA], y[PB], dradius); } } } double xarc_x_array[13], xarc_y_array[13]; double return_x, return_y; arclength(double start, double corner, double end) { double count, last_x, last_y; double a_dist; last_x = x[start]; last_y = y[start]; a_dist=0; for (count=1; count < 12; count = count + 1) { from_tspace(start, corner, end, count); a_dist = a_dist + distance(return_x, return_y, last_x, last_y); last_x=return_x; last_y=return_y; } return a_dist; } double A1, A2, B1, B2; double sx, sy, cx, cy, ex, ey; double tspace_0[2], tspace_1[2]; double ft_center[2]; from_tspace(double start, double corner, double end, double pos) { if (pos<1) { return_x=x[start]; return_y=y[start]; } else { if (pos<2) { sx = x[start]; sy = y[start]; cx = x[corner]; cy = y[corner]; ex = x[end]; ey = y[end]; A1=cx - sx; A2=cy - sy; B1=cx - ex; B2=cy - ey; A1=-A1; B1=-B1; A2=-A2; B2=-B2; tspace_0[0]=A1; tspace_0[1]=B1; tspace_1[0]=A2; tspace_1[1]=B2; ft_center[0]= cx + (tspace_0[0] + tspace_0[1]); ft_center[1]= cy + (tspace_1[0] + tspace_1[1]); return_x = tspace_0[0]*(xarc_x_array[pos])+tspace_0[1] * (xarc_y_array[pos])+ ft_center[0]; return_y = tspace_1[0]*(xarc_x_array[pos])+tspace_1[1] * (xarc_y_array[pos])+ ft_center[1]; } else { if (pos>10) { return_x=x[end]; return_y=y[end]; } else { return_x = tspace_0[0]*(xarc_x_array[pos])+tspace_0[1] * (xarc_y_array[pos])+ ft_center[0]; return_y = tspace_1[0]*(xarc_x_array[pos])+tspace_1[1] * (xarc_y_array[pos])+ ft_center[1]; } } } } init_xarc_array() { double ang_start, ang_end, step, theta, count; double XARC_PIECES; XARC_PIECES = 12; ang_start = -3.14159/2; ang_end= -3.14159; count=0; step= (ang_end - ang_start)/(XARC_PIECES-1); for (theta=ang_start; count < XARC_PIECES; theta = theta + step) { xarc_x_array[count] = cos(theta); xarc_y_array[count] = sin(theta); count=count+1; } } max(double aa, double bb) { if (aa > bb) { return aa; } else { return bb; } } min(double aa, double bb) { if (aa < bb) { return aa; } else { return bb; } }