// 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; point 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; 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."); } //Default measurements (Scandinavian 42) ky=39.25; //neck circ. ry=96; //bust circ vy=78; //waist circ. yly=95; //abdomen circ. aly=102; //hip circ. rkkv=21; //bust span rk=36.8; //bust height vk=53.4; //waist height //53.4 =oikea pituus sp=39.3; //back length //oikea 41.3 sl=37.6; //back width op=13.5; //shoulder length ylk=9; //Waist - Abdomen alk=19; //Waist - Hip kay=30; //biceps circ. ray=18.5; //wrist circ. hp=60.4; //sleeve length pit=35; 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("default_women")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("BASIC BODICE, women"); } 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("Bust span", rkkv, "w_meas_bustspan"); } if (language == 0) { add_picture_input("Bust height",rk, "w_meas_bustht"); } if (language == 0) { add_picture_input("Waist height",vk, "w_meas_waistht"); } 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("Waist - Abdomen",ylk, "w_meas_waist-abdm"); } if (language == 0) { add_picture_input("Waist - Hip",alk, "w_meas_waist-hip"); } 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 { //MEASUREMENTS DIALOG BOX if (language == 0) { dialog_box( "BASIC BODICE, women", "Neck circumference",ky, "Bust circumference", ry, "Waist circumference", vy, "Abdomen circumference",yly, "Hip circumference",aly, "Bust span", rkkv, "Bust height",rk, "Waist height",vk, "Back length",sp, "Back width",sl); } if (language == 0) { dialog_box("BASIC BODICE, women", "Shoulder length",op, "Waist - Abdomen",ylk, "Waist - Hip",alk, "Biceps circumference",kay, "Wrist circumference",ray, "Overarm length",hp); } } } if (is_function("start_picture_input")) { if (language == 0) { start_picture_input("BASIC BODICE, women"); } 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("WOMENS' BODICE BLOCK", "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; } if (ry < 76) { oke=4.6; } else { if (ry < 80) { oke=4.4; } else { if (ry < 84) { oke=4.2; } else { if (ry < 88) { oke=4.0; } else { if (ry < 92) { oke=3.8; } else { if (ry < 96) { oke=3.6; } else { if (ry < 100) { oke=3.4; } else { if (ry < 104) { oke=3.2; } else { if (ry < 110) { oke=3.0; } else { if (ry < 116) { oke=2.8; } else { if (ry < 122) { oke=2.6; } else { oke=2.4; } } } } } } } } } } } if(ry < 76) { okt=2.35; } else { if (ry < 80) { okt=2.4; } else { if (ry < 84) { okt=2.45; } else { if (ry < 88) { okt=2.5; } else { if (ry < 92) { okt=2.55; } else { if (ry < 96) { okt=2.6; } else { if (ry < 100) { okt=2.65; } else { if (ry < 104) { okt=2.7; } else { if (ry < 110) { okt=2.75; } else { if (ry < 116) { okt=2.8; } else { if (ry < 122) { okt=2.85; } else { okt=2.9; } } } } } } } } } } } if (ry < 76) { rl=4.3; } else { if (ry < 80) { rl=5.1; } else { if (ry < 84) { rl=5.8; } else { if (ry < 88) { rl=6.6; } else { if (ry < 92) { rl=7.3; } else { if (ry < 96) { rl=8.1; } else { if (ry < 100) { rl=8.8; } else { if (ry < 104) { rl=9.6; } else { if (ry < 110) { rl=10.8; } else { if (ry < 116) { rl=12.1; } else { if (ry < 122) { rl=13.3; } else { rl=14.6; } } } } } } } } } } } if (ry < 76) { ktk=20.4; } else { if (ry < 80) { ktk=20.8; } else { if (ry < 84) { ktk=21.2; } else { if (ry < 88) { ktk=21.6; } else { if (ry < 92) { ktk=22; } else { if (ry < 96) { ktk=22.4; } else { if (ry < 100) { ktk=22.8; } else { if (ry < 104) { ktk=23.2; } else { if (ry < 110) { ktk=23.8; } else { if (ry < 116) { ktk=24.4; } else { if (ry < 122) { ktk=25; } else { ktk=25.6; } } } } } } } } } } } //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]; //kaavat---------------------------------------------------- pts=ky/5+0.5; ptl=ky/5-1; ktl=ry/8-1.5; eml=3; tml=3; sml=(ry/2-vy/2)-6; smlyly=(ry/2-yly/2)-3; smlaly=(ry/2-aly/2); if(aly0) { //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 save_rx, save_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 (ct=1; ct < 12; ct = ct + 1) { fts(start, corner, end, ct); a_dist = a_dist + distance(save_rx, save_ry, last_x, last_y); last_x=save_rx; last_y=save_ry; } return a_dist; } double A1, A2, B1, B2; 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) { save_rx=x[start]; save_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]); save_rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; save_ry = t1[0]*(xar[pos])+t1[1]*(yar[pos])+ ftc[1]; } else { if (pos>10) { save_rx=x[end]; save_ry=y[end]; } else { save_rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; save_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; } }