// Copyright (C) 1996 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2011/11/04 //valmis double index, done; double x[600], y[600]; //viimeinen 529 hihojen nappivara 531 double ang,ang2,vang,vdistance,rangle; double current_point; object group_obj[200]; //viimeinen group_obj[78] object current_object; point current_point; selection current_selection; //VARIABLES double model,ky,ry,vy,yly,aly,rkkv,rk,vk,sp,sl,op; double ylk,alk,kay,ray,hp; double eml, tml, sml, smlyly,smlaly; double ktk,ktl,ptl,ptp,pts,rl,pk; double okt,oke; double ktpe,ktpt,ktp; double pit; double ease, f_ry[10],f_ky[10],f_vy[10],f_yly[10],f_aly[10],f_rkkv[10],f_sl[10]; double f_op[10],f_vk[10],f_rk[10],f_rl[10],f_sp[10],f_ktk[10]; double f_kay[10],f_ray[10],f_hp[10]; double kpe,kpt,kp; double collar; double napit,int; double sleeve, sleeve_length; double shoulder_padding; double nv; double sv; double metric; double siirtox, siirtoy; double language, nvl; //teen aged muutokset------------------------------------------------------------ double ptke, ptkt; double pts_lis, ptl_lis; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","BB_macros", "This macro needs to be properly installed before running it."); } //Test measurements , 152 cm //ry=76,ky=34.5,vy=66,aly=82, sp=37,op=12, sl=31.5; kay=28; ray=15, hp=52; //Test measurements , 170 cm ry=85; ky=35.75; vy=72; aly=91; yly=85; sp=41.5; op=13.2; sl=36; kay=30; ray=16; //wrist circ. Added meas. ENG hp=59.5; //sleeve length Added meas. ENG pit=19.5; nvl=0; sv=1; index = 0; done = 0; //Start Options while (!done) { if (index == 0) { StyleEase(); } if (index == 1) { StyleJacket(); } } //End Options //MEASUREMENT UNITS //==================== if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { nvl=nvl/2.54; ky=ky/2.54; ry=ry/2.54; vy=vy/2.54; yly=yly/2.54; aly=aly/2.54; rkkv=rkkv/2.54; vk=vk/2.54; sp=sp/2.54; sl=sl/2.54; op=op/2.54; ylk=ylk/2.54; alk=alk/2.54; rk=rk/2.54; kay=kay/2.54; ray=ray/2.54; hp=hp/2.54; pit=pit/2.54; sv=sv/2.54; } } else { if (language == 0) { metric=2*pop_up("Units","Inches","Centimeters"); } // 0 = inches, 2=cm if (metric<1) // If inches, convert cm to inches for dialog box { nvl=nvl/2.54; ky=ky/2.54; ry=ry/2.54; vy=vy/2.54; yly=yly/2.54; aly=aly/2.54; rkkv=rkkv/2.54; vk=vk/2.54; sp=sp/2.54; sl=sl/2.54; op=op/2.54; ylk=ylk/2.54; alk=alk/2.54; rk=rk/2.54; kay=kay/2.54; ray=ray/2.54; hp=hp/2.54; pit=pit/2.54; sv=sv/2.54; } } if(metric==0) { sv=0.39; } //Measurements table double read; read = 0; if (is_function("measure_table")==1) { if (measure_table("Leena_default_juniors")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("JUNIORS' BODICE"); } if (language == 0) { add_picture_input("Neck circumference",ky, "w_meas_neckcirc"); } if (language == 0) { add_picture_input("Bust circumference", ry, "w_meas_bustcirc"); } if (language == 0) { add_picture_input("Waist circumference", vy, "w_meas_waistcirc"); } if (language == 0) { add_picture_input("Abdomen circumference",yly, "w_meas_abdmcirc"); } if (language == 0) { add_picture_input("Hip circumference",aly, "w_meas_hipcirc"); } if (language == 0) { add_picture_input("Back length",sp, "w_meas_bklength"); } if (language == 0) { add_picture_input("Back width",sl, "w_meas_bkwidth"); } if (language == 0) { add_picture_input("Shoulder length",op, "w_meas_shldr"); } if (language == 0) { add_picture_input("Biceps circumference",kay, "w_meas_biceps"); } if (language == 0) { add_picture_input("Wrist circumference",ray, "w_meas_wrist"); } if (language == 0) { add_picture_input("Overarm length",hp, "w_meas_overarm"); } run_picture_input(); } else { if (language == 0) { dialog_box( "JUNIORS' BODICE, 1 of 2", "Neck circumference",ky, "Bust circumference", ry, "Waist circumference", vy, "Abdomen circumference",yly, "Hip circumference",aly, "Back length",sp, "Back width",sl, "Shoulder length",op, "Biceps circumference",kay, "Wrist circumference",ray); } if (language == 0) { dialog_box( "JUNIORS' BODICE, 2 of 2", "Overarm length",hp); } } } if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("JUNIORS' BODICE"); } if (language == 0) { add_picture_input("Button extension width",nvl, "w_meas_button_ext_width"); } if (language == 0) { add_picture_input("Length from waist",pit, "w_meas_jacket_length"); } run_picture_input(); } else { if (language == 0) { dialog_box("JUNIORS' BODICE, 2 of 3", "Button extension width",nvl, "Length from waist",pit); } } //======== if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { pts_lis=pts_lis*2.54; ptl_lis=ptl_lis*2.54; nvl=nvl*2.54; ky=ky*2.54; ry=ry*2.54; vy=vy*2.54; yly=yly*2.54; aly=aly*2.54; rkkv=rkkv*2.54; vk=vk*2.54; sp=sp*2.54; sl=sl*2.54; op=op*2.54; ylk=ylk*2.54; alk=alk*2.54; rk=rk*2.54; kay=kay*2.54; ray=ray*2.54; hp=hp*2.54; pit=pit*2.54; // sv=sv*2.54; } } else { if (metric<1) // If inches, convert cm to inches for dialog box { pts_lis=pts_lis*2.54; ptl_lis=ptl_lis*2.54; nvl=nvl*2.54; ky=ky*2.54; ry=ry*2.54; vy=vy*2.54; yly=yly*2.54; aly=aly*2.54; rkkv=rkkv*2.54; vk=vk*2.54; sp=sp*2.54; sl=sl*2.54; op=op*2.54; ylk=ylk*2.54; alk=alk*2.54; rk=rk*2.54; kay=kay*2.54; ray=ray*2.54; hp=hp*2.54; pit=pit*2.54; // sv=sv*2.54; } } if(metric==2) { sv=sv/2.54; } //teen aged muutokset------------------------------------------------------------ //STANDARD TABLE MEASUREMENTS //FRONT SHOULDER TIP FROM BACK NECK LEVEL oke=2; //BACK SHOULDER TIP FROM BACK NECK LEVEL okt=1.5; //WIDTH OF FRONT BUST DART DEPENDING ON BUST CIRC. if (ry < 73) { rl=1.5; } else { if (ry < 76) { rl=1.75; } else { if (ry < 79) { rl=2; } else { if (ry < 82) { rl=2.25; } else { if (ry < 85) { rl=2.5; } else { if (ry < 88) { rl=2.75; } else { { rl=3; } } } } } } } if (ry < 73) { ray=14; } else { if (ry < 76) { ray=14.5; } else { if (ry < 79) { ray=15; } else { if (ry < 82) { ray=15.5; } else { if (ry < 85) { ray=16; } else { if (ry < 88) { ray=16.5; } else { { ray=17; } } } } } } } if (ry < 82) { ptke=2.75; } else { ptke=3; } //--------------------------------------------------------------------------------- //EASE / +0 f_ry[0]=ry+0; f_ky[0]=ky-3; f_vy[0]=vy+2; f_yly[0]=yly+2+2; f_aly[0]=aly+2+2; f_rkkv[0]=rkkv; f_sl[0]=sl; f_op[0]=op; f_vk[0]=vk; f_rk[0]=rk; f_rl[0]=rl-0.4; f_sp[0]=sp; f_ktk[0]=ktk; f_kay[0]=kay+2; f_ray[0]=ray+2; f_hp[0]=hp; //EASE / +4 f_ry[1]=ry+4; f_ky[1]=ky-1.5; f_vy[1]=vy+4; f_yly[1]=yly+2+3; f_aly[1]=aly+2+3; f_rkkv[1]=rkkv+0.4; f_sl[1]=sl+0.4; f_op[1]=op; f_vk[1]=vk; f_rk[1]=rk; f_rl[1]=rl-0.2; f_sp[1]=sp; f_ktk[1]=ktk; f_kay[1]=kay+4; f_ray[1]=ray+4; f_hp[1]=hp; //EASE / +8 f_ry[2]=ry+8; f_ky[2]=ky; f_vy[2]=vy+6; f_yly[2]=yly+2+4; f_aly[2]=aly+2+4; f_rkkv[2]=rkkv+0.8; f_sl[2]=sl+1.6; f_op[2]=op; f_vk[2]=vk; f_rk[2]=rk; f_rl[2]=rl; f_sp[2]=sp; f_ktk[2]=ktk; f_kay[2]=kay+6; f_ray[2]=ray+6; f_hp[2]=hp; //EASE / +10 f_ry[3]=ry+10; f_ky[3]=ky+0.75; f_vy[3]=vy+8; f_yly[3]=yly+2+6; f_aly[3]=aly+2+6; f_rkkv[3]=rkkv+1; f_sl[3]=sl+2.2; f_op[3]=op; f_vk[3]=vk; f_rk[3]=rk; f_rl[3]=rl+0.1; f_sp[3]=sp; f_ktk[3]=ktk+2; f_kay[3]=kay+8; f_ray[3]=ray+8; f_hp[3]=hp; //EASE / +12 f_ry[4]=ry+12; f_ky[4]=ky+1.5; f_vy[4]=vy+10; f_yly[4]=yly+2+8; f_aly[4]=aly+2+8; f_rkkv[4]=rkkv+1.2; f_sl[4]=sl+2.8; f_op[4]=op; f_vk[4]=vk; f_rk[4]=rk; f_rl[4]=rl+0.2; f_sp[4]=sp; f_ktk[4]=ktk+2.5; f_kay[4]=kay+9; f_ray[4]=ray+9; f_hp[4]=hp+0.5; //EASE / +14 f_ry[5]=ry+14; f_ky[5]=ky+1.5; f_vy[5]=vy+12; f_yly[5]=yly+2+10; f_aly[5]=aly+2+10; f_rkkv[5]=rkkv+1.4; f_sl[5]=sl+3.4; f_op[5]=op; f_vk[5]=vk; f_rk[5]=rk; f_rl[5]=rl+0.3; f_sp[5]=sp; f_ktk[5]=ktk+3; f_kay[5]=kay+10; f_ray[5]=ray+10; f_hp[5]=hp+0.75; //EASE / +16 f_ry[6]=ry+16; f_ky[6]=ky+3; f_vy[6]=vy+14; f_yly[6]=yly+2+12; f_aly[6]=aly+2+12; f_rkkv[6]=rkkv+1.6; f_sl[6]=sl+4; f_op[6]=op+0.2; f_vk[6]=vk+0.5; f_rk[6]=rk+0.5; f_rl[6]=rl+0.4; f_sp[6]=sp+0.5; f_ktk[6]=ktk+3.5; f_kay[6]=kay+11; f_ray[6]=ray+11; f_hp[6]=hp+1; //EASE / +18 f_ry[7]=ry+18; f_ky[7]=ky+3.75; f_vy[7]=vy+16; f_yly[7]=yly+2+14; f_aly[7]=aly+2+14; f_rkkv[7]=rkkv+1.8; f_sl[7]=sl+4.6; f_op[7]=op+0.4; f_vk[7]=vk+0.5; f_rk[7]=rk+0.5; f_rl[7]=rl+0.5; f_sp[7]=sp+0.5; f_ktk[7]=ktk+4; f_kay[7]=kay+12; f_ray[7]=ray+12; f_hp[7]=hp+1.25; //EASE / +20 f_ry[8]=ry+20; f_ky[8]=ky+4.5; f_vy[8]=vy+18; f_yly[8]=yly+2+16; f_aly[8]=aly+2+16; f_rkkv[8]=rkkv+2; f_sl[8]=sl+5.2; f_op[8]=op+0.4; f_vk[8]=vk+1; f_rk[8]=rk+1; f_rl[8]=rl+0.6; f_sp[8]=sp+1; f_ktk[8]=ktk+4.5; f_kay[8]=kay+13; f_ray[8]=ray+13; f_hp[8]=hp+1.5; //EASE / +22 f_ry[9]=ry+22; f_ky[9]=ky+5.25; f_vy[9]=vy+20; f_yly[9]=yly+2+18; f_aly[9]=aly+2+18; f_rkkv[9]=rkkv+2.2; f_sl[9]=sl+5.8; f_op[9]=op+0.8; f_vk[9]=vk+1; f_rk[9]=rk+1; f_rl[9]=rl+0.7; f_sp[9]=sp+1; f_ktk[9]=ktk+5; f_kay[9]=kay+14; f_ray[9]=ray+14; f_hp[9]=hp+1.75; ry=f_ry[ease]; ky=f_ky[ease]; vy=f_vy[ease]; yly=f_yly[ease]; aly=f_aly[ease]; rkkv=f_rkkv[ease]; sl=f_sl[ease]; op=f_op[ease]; vk=f_vk[ease]; rk=f_rk[ease]; rl=f_rl[ease]; sp=f_sp[ease]; ktk=f_ktk[ease]; kay=f_kay[ease]; ray=f_ray[ease]; //teen aged muutokset------------------------------------------------------------ //MATHEMATICS pts=ky/5; ptl=ky/5-0.5; eml=(ry/2-vy/2)/4; sml=(ry/2-vy/2)/2; smlyly=ry/2-yly/2; smlaly=ry/2-aly/2; tml=(ry/2-vy/2)/4; rkkv=ry/5; ktl=ry/8-0.5; ktk=ry/4-2; alk=ktk-2; //deleted the slashes before ylk=alk/2; rk=ktk+ptke+pts+1; vk=sp+ptke+pts+1; //--------------------------------------------------- pts_lis=1; ptl_lis=1; pts=pts+pts_lis; ptl=ptl+ptl_lis; op=op-ptl_lis; if(pit0) { //nappivara current_object=newobject("poly"); group_obj[44]=current_object; addpoint((x[102])/2.54, (y[102])/2.54, "line"); addpoint((x[102]-nvl)/2.54, (y[102])/2.54, "line"); addpoint((x[3]-nvl)/2.54, (y[102])/2.54, "line"); current_point=addpoint((x[3]-nvl)/2.54, (y[3])/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[4]-nvl)/2.54, (y[4])/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[5]-nvl)/2.54, (y[5])/2.54, "line"); notch_type(current_point,"NOTCH",1); if(pit 0) { // not vertical xtemp = (y[PB]-y[PC])*(y[PB]-y[PC]); if ( xtemp > 0) { // not horizontal mslope = (y[PC] - y[PB])/(x[PC] - x[PB]); // slope of line //plot a perpendicular line through pt. A // First, find any point on this line tx = x[PA] + 1; ty = y[PA] - 1/mslope; // Then intersection of the 2 lines (Point T) 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); // Here is a special function that calculates the third leg // of a right triangle. First two inputs give the two ends // of one short leg. The third input is the hypotenuse // (here, it equals the dradius of the circle) // Won't work if the line and circle don't intersect! dist2 = interceptline(0, dist1, dradius); // distance from T to // desired point P1 or P2 dist0 = sqrt(1+mslope*mslope); xtemp = dist2/dist0; if (which) { x[PD] = tx+xtemp; // first intersection point y[PD] = ty+ xtemp*mslope; } else { x[PD] = tx-xtemp; // second intersection point y[PD] = ty- xtemp*mslope; } } else // horizontal line { x[PD] = 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 //vertical line { y[PD] = 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); } } } //////////////////////////////////////////// // These 3 routines find the length of an xarc, given the array // numbers of the 3 points that // make it up. // These variables needed for routine fts double xar[13], yar[13]; double rx, ry; arclength(double start, double corner, double end) { double ct, last_x, last_y; double a_dist; last_x = x[start]; last_y = y[start]; a_dist=0; // For each of the segments that comprises the arc, find // the endpoints of the segment and add the segment length // to the total for (ct=1; ct < 12; ct = ct + 1) { fts(start, corner, end, ct); a_dist = a_dist + distance(rx, ry, last_x, last_y); last_x=rx; last_y=ry; } return a_dist; } ////////////////////////////////////// // These global variables are used by fts for repeated calls. double A1, A2, B1, B2; //transformation vectors double sx, sy, cx, cy, ex, ey; double t0[2], t1[2]; double ftc[2]; fts(double start, double corner, double end, double pos) { if (pos<1) { rx=x[start]; ry=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; t0[0]=A1; t0[1]=B1; t1[0]=A2; t1[1]=B2; ftc[0]= cx + (t0[0] + t0[1]); ftc[1]= cy + (t1[0] + t1[1]); rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; ry = t1[0]*(xar[pos])+t1[1]*(yar[pos])+ ftc[1]; } else { if (pos>10) { rx=x[end]; ry=y[end]; } else { rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; ry = t1[0]*(xar[pos])+t1[1]*(yar[pos])+ ftc[1]; } } } } /////////////////////////////////////// init_xarc_array() { // Must be called before calling fts(). This routine // sets the values in an array of sines and cosines. // You only need to call this routine once. double ang_start, ang_end, step, theta, ct; double XARC_PIECES; XARC_PIECES = 12; ang_start = -3.14159/2; ang_end= -3.14159; ct=0; step= (ang_end - ang_start)/(XARC_PIECES-1); for (theta=ang_start; ct < XARC_PIECES; theta = theta + step) { xar[ct] = cos(theta); yar[ct] = sin(theta); ct=ct+1; } //end init_xarc_array } 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; } }