// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2011/11/04 selection current_selection; object current_object, group_obj[100]; point current_point; double index, done; object marker_array[20]; double marker_count, loop; double result; double x[400],y[400]; double ry, vy, ly, ky, ktk, sp, lk, pp, sl, ktl, op, ptkt, ptke, ptl, ptse, okt, oke, rke; double hp, pk, hl, ray, sip, jsp, ik; double size; double t_ry[8]; double t_vy[8]; double t_ly[8]; double t_ky[8]; double t_sp[8]; double t_op[8]; double t_sl[8]; double t_ptke[8]; double t_ptkt[8]; double t_hp[8]; double t_ray[8]; double t_sip[8]; double t_jsp[8]; double kp, kpe, kpt; double language; double sizes; double metric, sv; double read; double sivu; double ang; double leveys,korkeus; double siirtox; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","Babies", "This macro needs to be properly installed before running it."); } Forward(); //Start Options while (!done) { if (index==0) { Popup1(); } if (index==1) { Popup2(); } if (index==2) { Popup3(); } } //End Options t_vy[0]=48; t_vy[1]=49; t_vy[2]=50; t_vy[3]=51; t_vy[4]=52; t_vy[5]=53; t_vy[6]=54; t_ry[0]=46; t_ry[1]=47.5; t_ry[2]=49; t_ry[3]=50.5; t_ry[4]=52; t_ry[5]=54; t_ry[6]=56; t_ly[0]=53; t_ly[1]=54; t_ly[2]=55; t_ly[3]=56; t_ly[4]=57; t_ly[5]=58; t_ly[6]=60; t_ky[0]=25; t_ky[1]=25.5; t_ky[2]=26; t_ky[3]=26.5; t_ky[4]=27; t_ky[5]=27.5; t_ky[6]=28; t_op[0]=6; t_op[1]=6.4; t_op[2]=6.8; t_op[3]=7.2; t_op[4]=7.6; t_op[5]=8; t_op[6]=8.4; t_sl[0]=2*10.4; t_sl[1]=2*10.7; t_sl[2]=2*11; t_sl[3]=2*11.3; t_sl[4]=2*11.6; t_sl[5]=2*12; t_sl[6]=2*12.4; t_hp[0]=20; t_hp[1]=24; t_hp[2]=26; t_hp[3]=28; t_hp[4]=30; t_hp[5]=32; t_hp[6]=34; t_ray[0]=10.5; t_ray[1]=11; t_ray[2]=11; t_ray[3]=11.5; t_ray[4]=11.5; t_ray[5]=12; t_ray[6]=12; t_sp[0]=18; t_sp[1]=19; t_sp[2]=20; t_sp[3]=21; t_sp[4]=22; t_sp[5]=23; t_sp[6]=24; t_sip[0]=37.5; t_sip[1]=41; t_sip[2]=44.5; t_sip[3]=48; t_sip[4]=52; t_sip[5]=56; t_sip[6]=60; t_jsp[0]=19; t_jsp[1]=22; t_jsp[2]=25; t_jsp[3]=28; t_jsp[4]=31.5; t_jsp[5]=35; t_jsp[6]=38.5; t_ptke[0]=1.5; t_ptke[1]=1.5; t_ptke[2]=1.5; t_ptke[3]=1.75; t_ptke[4]=1.75; t_ptke[5]=2.25; t_ptke[6]=2.25; ry= t_ry[size]; vy= t_vy[size]; ly= t_ly[size]; ky= t_ky[size]; op= t_op[size]; sp= t_sp[size]; hp= t_hp[size]; ray= t_ray[size]; op= t_op[size]; sl= t_sl[size]; sip= t_sip[size]; jsp= t_jsp[size]; ptke=t_ptke[size]; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { ry=ry/2.54; vy=vy/2.54; ly=ly/2.54; ky=ky/2.54; op=op/2.54; sl=sl/2.54; sp=sp/2.54; hp=hp/2.54; ray=ray/2.54; sip=sip/2.54; jsp=jsp/2.54; } } else { if (language == 0) { metric=2*pop_up("UNITS","Inches","Centimeters"); } if (metric<1) { ry=ry/2.54; vy=vy/2.54; ly=ly/2.54; ky=ky/2.54; op=op/2.54; sl=sl/2.54; sp=sp/2.54; hp=hp/2.54; ray=ray/2.54; sip=sip/2.54; jsp=jsp/2.54; } } if(metric==0) { sv=0.39; } read = 0; if (is_function("measure_table")==1) { if (measure_table("default_babies")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("BABIES' BIB OVERALLS"); } if (language == 0) { add_picture_input("Neck circumference", ky, "bc_meas_neckcirc"); } if (language == 0) { add_picture_input("Chest circumference", ry, "bc_meas_chestcirc"); } if (language == 0) { add_picture_input("Waist circumference", vy, "bc_meas_waistcirc"); } if (language == 0) { add_picture_input("Hip circumference",ly,"bc_meas_hipcirc"); } if (language == 0) { add_picture_input("Back length", sp, "bc_meas_bklength"); } if (language == 0) { add_picture_input("Back width",sl, "bc_meas_bkwidth"); } if (language == 0) { add_picture_input("Shoulder length",op, "bc_meas_shldr"); } if (language == 0) { add_picture_input("Overarm length",hp,"bc_meas_overarm"); } if (language == 0) { add_picture_input("Wrist circumference", ray, "bc_meas_wrist"); } if (language == 0) { add_picture_input("Seam Allowance", sv, "meas_seamallow"); } run_picture_input(); } else { if (language == 0) { dialog_box("BABIES' FITTED SHIRT", "Neck circumference", ky, "Chest circumference", ry, "Waist circumference", vy, "Hip circumference",ly, "Back length", sp, "Back width",sl, "Shoulder length",op, "Overarm length",hp, "Wrist circumference", ray, "Seam Allowance", sv); } } } else { if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("CUSTOM MEASUREMENTS"); } if (language == 0) { add_picture_input("Seam Allowance", sv, "meas_seamallow"); } run_picture_input(); } else { if (language == 0) { dialog_box("CUSTOM MEASUREMENTS", "Seam Allowance", sv); } } } if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { ry=ry*2.54; vy=vy*2.54; ly=ly*2.54; ky=ky*2.54; op=op*2.54; sl=sl*2.54; sp=sp*2.54; hp=hp*2.54; ray=ray*2.54; sip=sip*2.54; jsp=jsp*2.54; } } else { if (metric<1) { ry=ry*2.54; vy=vy*2.54; ly=ly*2.54; ky=ky*2.54; op=op*2.54; sl=sl*2.54; sp=sp*2.54; hp=hp*2.54; ray=ray*2.54; sip=sip*2.54; jsp=jsp*2.54; } } if(metric==2) { sv=sv/2.54; } ry= ry+20; sl=sl+4; vy= vy+16; ly= ly+16; ray=ray+10; op=op+1;// was +3 ENG ktk=ry/4-2; lk=ktk-2; pp=sp; ktl=ry/8; ptl=ky/5-.5; ptse=ky/5; rke=ry/10; pk=ry/6-2; hl=sl+1.5; ptkt=1; okt=1; oke=1; ray=hl-2; ptl=ptl+1; ptse=ptse+1; op=op+1; // added ENG pk=pk-2.25; //was 3 ENG hp=hp-2; x[0]=0; y[0]=30; coord(0,1,0,0); coord(1,2,0,-ktk); coord(1,3,0,-sp); coord(3,4,0,-lk); coord(1,5,0,-pp); coord(2,6,-sl/2,0); coord(6,7,-ktl,0); coord(2,8,-ry/2,0); x[9]=x[8]; y[9]=y[3]; coord(9,10,-1,0); coord(1,101,-100,0); cont(10,8,111,100); line_intersect (8,111,1,101,11); coord(4,104,-100,0); cont(8,10,113,100); line_intersect(8,113,4,104,12); coord(5,105,-100,0); line_intersect(8,113,5,105,13); coord(1,14,-sl/2,0); coord(14,15,-ktl,0); center(6,7,16); coord(1,17,-ptl,0); coord(17,18,0,ptkt); coord(14,19,0,-1); coord(19,119,-50,0); coord(18,20,-sqrt(op*op-(ptkt+okt)*(ptkt+okt)),-ptkt-okt); cont(8,11,21,ptke); coord(21,22,ptl,0); cont(10,21,23,-ptse); cont(11,23,123,ptl); rotate (123,23,angle (x[123],y[23],x[123],y[23]+90*3.14159/180)); coord(15,24,0,-oke); coord(22,25,sqrt(op*op-(ptke+oke)*(ptke+oke)),-ptke-oke); coord(7,26,0,ktk/4); coord(7,125,0,ktk/2); coord(6,27,0,ktk/3); coord(6,120,0,ktk/3*2); coord(16,28,0,-pp+ktk); sivu=dist(16,28); y[1]=y[1]-1; y[17]=y[17]-1; x[125]=x[125]+2; x[26]=x[26]+2; x[7]=x[7]+2; x[120]=x[120]-2; x[27]=x[27]-2; x[6]=x[6]-2; x[120]=x[20]+1; x[27]=x[20]+1; x[6]=x[20]+1; init_xarc_array(); kpt=arclength(1,17,18); group_obj[0]=newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "xarc_start"); addpoint((x[17])/2.54, (y[17])/2.54, "xarc_corner"); addpoint((x[18])/2.54, (y[18])/2.54, "LINE"); addpoint((x[20])/2.54, (y[20])/2.54, "xarc_start"); addpoint((x[120])/2.54, (y[120])/2.54, "xarc_corner"); addpoint((x[27])/2.54, (y[27])/2.54, "xarc_start"); addpoint((x[6])/2.54, (y[6])/2.54, "xarc_corner"); addpoint((x[16])/2.54, (y[16])/2.54, "line"); addpoint((x[28])/2.54, (y[3])/2.54, "line"); addpoint((x[28])/2.54, (y[3]-lk)/2.54, "line"); addpoint((x[3])/2.54, (y[3]-lk)/2.54, "LINE"); addpoint((x[3])/2.54, (y[3])/2.54, "LINE"); addpoint((x[2])/2.54, (y[2])/2.54, "LINE"); cont(20,18,304,-3); cont(2,1,306,-3); x[305]=x[304]; y[305]=y[306]; group_obj[1]=newobject("poly"); addpoint((x[18])/2.54, (y[18]+5)/2.54, "LINE"); addpoint((x[304])/2.54, (y[304]+5)/2.54, "xarc_start"); addpoint((x[305])/2.54, (y[305]+5)/2.54, "xarc_corner"); addpoint((x[306])/2.54, (y[306]+5)/2.54, "LINE"); addpoint((x[1])/2.54, (y[1]+5)/2.54, "xarc_start"); addpoint((x[17])/2.54, (y[17]+5)/2.54, "xarc_corner"); ang=angle(x[8],y[8],x[9],y[9])-angle(x[8],y[8],x[10],y[10]); rotate(22,8,ang); rotate(123,8,ang); rotate(23,8,ang); rotate(10,8,ang); rotate(12,8,ang); rotate(16,8,ang); rotate(7,8,ang); rotate(26,8,ang); rotate(125,8,ang); rotate(25,8,ang); rotate(28,8,ang); x[125]=x[25]-1; x[26]=x[25]-1; x[7]=x[25]-1; kpe=arclength(22,123,23); group_obj[2]=newobject("poly"); addpoint((x[22]-10)/2.54, (y[22])/2.54, "xarc_start"); addpoint((x[123]-10)/2.54, (y[123])/2.54, "xarc_corner"); addpoint((x[23]-10)/2.54, (y[23])/2.54, "line"); // addpoint((x[23]-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-1-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-2-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-3-10)/2.54, (y[23]+.25)/2.54, "LINE"); addpoint((x[10]-3-10)/2.54, (y[10]-lk)/2.54, "LINE"); // addpoint((x[10]-10)/2.54, (y[10]-lk)/2.54, "LINE"); // addpoint((x[8]-10)/2.54, (y[8])/2.54, "line"); // addpoint((x[10]-10)/2.54, (y[10])/2.54, "line"); addpoint((x[10]-10)/2.54, (y[10]-lk)/2.54, "xarc_start"); center(10,28,15); y[15]=y[10]; addpoint((x[15]-10)/2.54, (y[15]-lk)/2.54, "xarc_corner"); addpoint((x[28]-10)/2.54, (y[28]-lk)/2.54, "xarc_start"); addpoint((x[28]-10)/2.54, (y[28])/2.54, "xarc_corner"); addpoint((x[16]-10)/2.54, (y[16])/2.54, "xarc_start"); addpoint((x[7]-10)/2.54, (y[7])/2.54, "xarc_corner"); addpoint((x[26]-10)/2.54, (y[26])/2.54, "xarc_start"); addpoint((x[125]-10)/2.54, (y[125])/2.54, "xarc_corner"); addpoint((x[25]-10)/2.54, (y[25])/2.54, "line"); group_obj[3]=newobject("poly"); addpoint((x[23]-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-1-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-2-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[23]-3-10)/2.54, (y[23]+.25)/2.54, "LINE"); addpoint((x[10]-3-10)/2.54, (y[10]-lk)/2.54, "LINE"); addpoint((x[10]-10)/2.54, (y[10]-lk)/2.54, "LINE"); group_obj[4]=newobject("poly"); addpoint((x[23]-1-10)/2.54, (y[23])/2.54, "LINE"); addpoint((x[10]-1-10)/2.54, (y[10]-lk)/2.54, "LINE"); cont(25,22,301,-3); cont(8,23,303,-3); x[302]=x[301]; y[302]=y[303]; group_obj[5]=newobject("poly"); addpoint((x[22]-10)/2.54, (y[22]+10)/2.54, "LINE"); addpoint((x[301]-10)/2.54, (y[301]+10)/2.54, "xarc_start"); addpoint((x[302]-10)/2.54, (y[302]+10)/2.54, "xarc_corner"); addpoint((x[303]-10)/2.54, (y[303]+10)/2.54, "LINE"); addpoint((x[23]-10)/2.54, (y[23]+10)/2.54, "xarc_start"); addpoint((x[123]-10)/2.54, (y[123]+10)/2.54, "xarc_corner"); leveys=(x[26]-x[23])*2/3; korkeus=(y[23]-y[8])*4/5; group_obj[6]=newobject("poly"); addpoint((x[26]-(x[26]-x[23])/4+1-10)/2.54, (y[26]-korkeus+1)/2.54, "xarc_start"); addpoint((x[26]-(x[26]-x[23])/4+1-10)/2.54, (y[26]-korkeus)/2.54, "xarc_corner"); addpoint((x[26]-(x[26]-x[23])/4+1-1-10)/2.54, (y[26]-korkeus)/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys+1-10)/2.54, (y[26]-korkeus)/2.54, "xarc_start"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10)/2.54, (y[26]-korkeus)/2.54, "xarc_corner"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10)/2.54, (y[26]-korkeus+1)/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10)/2.54, (y[26])/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-10)/2.54, (y[26])/2.54, "LINE"); siirtox=ry/4; group_obj[7]=newobject("poly"); addpoint((x[26]-(x[26]-x[23])/4+1-10-siirtox)/2.54, (y[26]-korkeus+1)/2.54, "xarc_start"); addpoint((x[26]-(x[26]-x[23])/4+1-10-siirtox)/2.54, (y[26]-korkeus)/2.54, "xarc_corner"); addpoint((x[26]-(x[26]-x[23])/4+1-1-10-siirtox)/2.54, (y[26]-korkeus)/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys+1-10-siirtox)/2.54, (y[26]-korkeus)/2.54, "xarc_start"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10-siirtox)/2.54, (y[26]-korkeus)/2.54, "xarc_corner"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10-siirtox)/2.54, (y[26]-korkeus+1)/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-leveys-10-siirtox)/2.54, (y[26])/2.54, "LINE"); addpoint((x[26]-(x[26]-x[23])/4+1-10-siirtox)/2.54, (y[26])/2.54, "LINE"); coord(1,1,hl/2+5,0); coord(1,2,0,-pk); coord(1,3,0,-hp); coord(1,4,0,-hp/2+1); coord(1,5,ktl/2,0); coord(2,6,hl/2,0); coord(3,7,ray/2,0); coord(1,9,-ktl/2,0); coord(2,10,-hl/2,0); coord(3,11,-ray/2,0); coord(10,13,ktl/2,0); coord(6,16,-ktl/4,0); center(5,16,15); center(9,13,14); center(7,3,18); y[18]=y[18]-.5; center(11,3,17); y[17]=y[17]+.5; group_obj[8]=newobject("poly"); addpoint((x[6])/2.54, (y[6])/2.54, "xarc_start"); addpoint((x[16])/2.54, (y[16])/2.54, "xarc_corner"); addpoint((x[15])/2.54, (y[15])/2.54, "xarc_start"); addpoint((x[5])/2.54, (y[5])/2.54, "xarc_corner"); addpoint((x[1])/2.54, (y[1])/2.54, "xarc_start"); addpoint((x[9])/2.54, (y[9])/2.54, "xarc_corner"); addpoint((x[14])/2.54, (y[14])/2.54, "xarc_start"); addpoint((x[13])/2.54, (y[13])/2.54, "xarc_corner"); addpoint((x[10])/2.54, (y[10])/2.54, "line"); addpoint((x[11])/2.54, (y[11])/2.54, "xarc_start"); addpoint((x[17])/2.54, (y[17])/2.54, "xarc_corner"); addpoint((x[3])/2.54, (y[3])/2.54, "xarc_start"); addpoint((x[18])/2.54, (y[18])/2.54, "xarc_corner"); addpoint((x[7])/2.54, (y[7])/2.54, "line"); group_obj[9]=newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "line"); addpoint((x[4])/2.54, (y[4]-2)/2.54, "line"); addpoint((x[4]-.5)/2.54, (y[4])/2.54, "line"); addpoint((x[4])/2.54, (y[4]-2)/2.54, "line"); addpoint((x[4]+.5)/2.54, (y[4])/2.54, "open"); group_obj[10]=newobject("poly"); addpoint((x[18]-1)/2.54, (y[18])/2.54, "line"); addpoint((x[18]-1)/2.54, (y[18]+5)/2.54, "line"); coord(11,1,0,-5); coord(1,2,1,0); coord(2,3,ray-4,0); coord(3,4,1,0); coord(4,5,0,-5); coord(3,6,0,-5); coord(2,7,0,-5); coord(1,8,0,-5); group_obj[11]=newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "line"); addpoint((x[2])/2.54, (y[2])/2.54, "line"); addpoint((x[3])/2.54, (y[3])/2.54, "line"); addpoint((x[4])/2.54, (y[4])/2.54, "line"); addpoint((x[5])/2.54, (y[5])/2.54, "line"); addpoint((x[6])/2.54, (y[6])/2.54, "line"); addpoint((x[7])/2.54, (y[7])/2.54, "line"); addpoint((x[8])/2.54, (y[8])/2.54, "line"); group_obj[12]=newobject("poly"); addpoint((x[4])/2.54, (y[4]-2.5)/2.54, "line"); addpoint((x[1])/2.54, (y[1]-2.5)/2.54, "open"); kp=kpe+kpt; coord(120,71,-5,0); coord(71,72,-kp,.5); coord(72,73,0,5); coord(71,74,0,7); coord(71,75,-kp/6,0); coord(71,76,-kp/6*2,0); coord(71,77,-kp/6*3,0); coord(71,78,-kp/6*4,0); coord(71,79,-kp/6*5,0); cont(74,73,80,+1); cont(72,80,81,-1); group_obj[13]=newobject("poly"); addpoint((x[71])/2.54, (y[71]-5+2)/2.54, "line"); addpoint((x[75])/2.54, (y[75]-5+2)/2.54, "xarc_start"); addpoint((x[76])/2.54, (y[76]-5+2)/2.54, "xarc_corner"); addpoint((x[77])/2.54, (y[77]-5+1)/2.54, "xarc_start"); addpoint((x[78])/2.54, (y[78]-5)/2.54, "xarc_corner"); addpoint((x[79])/2.54, (y[79]-5)/2.54, "line"); addpoint((x[72])/2.54, (y[72]-5)/2.54, "LINE"); addpoint((x[81])/2.54, (y[81]-5)/2.54, "line"); addpoint((x[80])/2.54, (y[80]-5)/2.54, "line"); addpoint((x[73])/2.54, (y[73]-5)/2.54, "line"); addpoint((x[75])/2.54, (y[74]-5)/2.54, "line"); addpoint((x[74])/2.54, (y[74]-5)/2.54, "line"); if (sv!=0) { //back offset_mark(0); group(current_selection); deselect(current_selection); //back neck offset_mark(1); group(current_selection); deselect(current_selection); //front offset_mark(2); select(current_selection,group_obj[3]); select(current_selection,group_obj[4]); select(current_selection,group_obj[6]); group(current_selection); deselect(current_selection); //neck offset_mark(5); group(current_selection); deselect(current_selection); //pocket offset_mark(7); group(current_selection); deselect(current_selection); //arm offset_mark(8); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); //waist band offset_mark(11); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); //collar offset_mark(13); group(current_selection); deselect(current_selection); } else { //back mark(0); //back neck mark(1); //front mark(2); current_selection=newselection("OBJECT"); select(current_selection,group_obj[2]); select(current_selection,group_obj[3]); select(current_selection,group_obj[4]); select(current_selection,group_obj[6]); group(current_selection); deselect(current_selection); //neck mark(5); //pocket mark(7); //arm mark(8); current_selection=newselection("OBJECT"); select(current_selection,group_obj[8]); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); //waist band mark(11); current_selection=newselection("OBJECT"); select(current_selection,group_obj[11]); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); //collar mark(13); } 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"); } 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) { double save_x, save_y; current_point=last_point(group_obj[pass_index]); if (is_open(current_point)) { current_selection=newselection("OBJECT"); select(current_selection,group_obj[pass_index]); sel_push(current_selection); run_command("TOFRONT"); deselect(current_selection); current_object=last_obj(); save_x = pointx(current_point); save_y = pointy(current_point); remove_point(current_object, current_point); addpoint(save_x, save_y, "LINE"); } 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(); current_point=last_point(current_object); if (is_open(current_point)) { save_x = pointx(current_point); save_y = pointy(current_point); remove_point(current_object, current_point); addpoint(save_x, save_y, "LINE"); } 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 == 1) && (unit_mode() == 1) ) { index = index + 1; } if ( (index == 2) && (unit_mode() == 0) ) { index = index + 1; } if (index == 3) { done = 1; } } Backward() { index = index - 1; } Popup1() { if (language == 0) { start_pict_dialog("CHOOSE MEASUREMENT UNITS"); add_pict_item("Baby's height in inches","blank.jpg"); add_pict_item("Baby's height in centimeters","blank.jpg"); run_pict("Next"); sizes=get_pict_result(); Forward(); } } Popup2() { if (language == 0) { start_pict_dialog("SELECT CLOSEST HEIGHT"); add_pict_item("24.5","blank.jpg"); add_pict_item("26.75","blank.jpg"); add_pict_item("29","blank.jpg"); add_pict_item("31.5","blank.jpg"); add_pict_item("34","blank.jpg"); add_pict_item("36.25","blank.jpg"); add_pict_item("38.5","blank.jpg"); run_pict("Next"); size=get_pict_result(); Forward(); } } Popup3() { if (language == 0) { start_pict_dialog("SELECT CLOSEST HEIGHT"); add_pict_item("62","blank.jpg"); add_pict_item("68","blank.jpg"); add_pict_item("74","blank.jpg"); add_pict_item("80","blank.jpg"); add_pict_item("86","blank.jpg"); add_pict_item("92","blank.jpg"); add_pict_item("98","blank.jpg"); run_pict("Next"); size=get_pict_result(); Forward(); } } 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; } } newobj_dot(double x, double y) { object temp; line("CENTER_LINE"); temp = NEWOBJECT ("POLY"); addpoint(x, y, "line"); line("SOLID_LINE"); return temp; }