// Copyright (C) 1996 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2011/11/04 double x[300],y[300]; point current_point; selection current_selection; object group_obj[200]; double index, done; object marker_array[20]; double marker_count, loop; double result; object current_object; //VARIABLES double ry, vy, aly, ky, ktk, sp, lk, pp, sl, ktl, op, ptkt, ptke, ptl, ptse, okt, oke, rke; double hp, pk, hl, ray, sip, jsp, ik; double pap, language; double sv; 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."); } ry=87; vy=74; aly=90; ky=37.5; op=13.5; sl=37; sp=43; hp=61.5; ray=18; double metric; if (is_function("unit_mode")==1) { metric = unit_mode(); } else { metric=2*pop_up("Units","Inches","Centimeters"); // 0 = inches, 2=cm } if (metric<1) // If inches, convert cm to inches for dialog box { sv=3/8; ry=ry/2.54; vy=vy/2.54; aly=aly/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 { sv = 1; } //Measurements table double read; read = 0; if (is_function("measure_table")==1) { if (measure_table("default_youths")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { start_picture_input("BOY'S SHIRT"); 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("Neck circumference", ky, "m_neck_circumference"); add_picture_input("Shoulder length",op, "m_shoulder_length"); //added picture ENG add_picture_input("Back width",sl, "m_back_width"); add_picture_input("Overarm length",hp, "m_arm_length"); add_picture_input("Cuff circumference", ray, "m_cuff_circumference_jacket"); add_picture_input("Back length", sp, "m_back_length"); if (language == 0) { run_picture_input(); } } else { dialog_box("BOY'S SHIRT", "Chest circumference", ry, "Waist circumference", vy, "Hip circumference",aly, "Neck circumference", ky, "Shoulder length",op, "Back width",sl, "Overarm length", hp, "Cuff circumference", ray, "Back length", sp); } } if (is_function("start_picture_input")) { start_picture_input("CUSTOM MEASUREMENTS"); add_picture_input("Seam Allowance",sv, "meas_seamallow"); if (language == 0) { run_picture_input(); } } else { dialog_box( "CUSTOM MEASUREMENTS", "Seam Allowance",sv); } if (metric<1) { ry=ry*2.54; vy=vy*2.54; aly=aly*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; } //ease ry= ry+12; vy= vy+8; aly= aly+8; ray=ray+2; //matikka ktk=ry/4-2; lk=ktk-2; ktl=ry/8-.25; ptl=ky/5-.5; ptse=ky/5; rke=ry/10; pp=60; if(ry<82) { ptkt=1.75; } else { ptkt=2; } if(ry<88) { ptke=2.5; } else { ptke=2; } oke=2; okt=1.5; //STARTING POINT x[0]=0; y[0]=30; //1 coord(0,1,0,0); //2 coord(1,2,0,-ktk); //3 coord(1,3,0,-sp); //4 coord(3,4,0,-lk); //5 coord(1,5,0,-pp); //6 coord(2,6,-sl/2,0); //7 coord(6,7,-ktl,0); //8 coord(2,8,-ry/2,0); //9 x[9]=x[8]; y[9]=y[3]; //10 coord(9,10,-.5,0); //11 coord(1,101,-100,0); cont(10,8,111,100); line_intersect (8,111,1,101,11); //12 coord(4,104,-100,0); cont(8,10,113,100); line_intersect(8,113,4,104,12); //13 coord(5,105,-100,0); line_intersect(8,113,5,105,13); //14 coord(1,14,-sl/2,0); //15 coord(14,15,-ktl,0); //16 center(6,7,16); //17 coord(1,17,-ptl,0); //18 coord(17,18,0,ptkt); //19 coord(14,19,0,-1); //20 coord(19,119,-50,0); coord(18,20,-sqrt((op+.5)*(op+.5)-(ptkt+okt)*(ptkt+okt)),-ptkt-okt); //220 coord(17,220,-2,-5); //118 cont(20,18,118,-2.5); cont(220,118,118,+.3); //218 cont(20,18,218,-3.5); cont(218,220,218,-dist(220,118)); //21 cont(8,11,21,ptke); //22 coord(21,22,ptl,0); //23 cont(10,21,23,-ptse); //123 //x[123]=x[22]; //y[123]=y[23]; cont(11,23,123,ptl); rotate (123,23,angle (x[123],y[23],x[123],y[23])+3.14/180); //24 coord(15,24,0,-oke); //25 //linecirc(22,24,124,op+.5,1,25); coord(22,25,sqrt((op+.5)*(op+.5)-(ptke+oke)*(ptke+oke)),-ptke-oke); //26 coord(7,26,0,ktk/3); //125 coord(7,125,0,ktk/2); //27 coord(6,27,0,ktk/3); //120 coord(6,120,0,ktk/3*2); //28 coord(16,28,0,-pp+ktk); double sivu; sivu=dist(16,28); //40 coord(16,40,0,-sp+ktk); //41 coord(40,41,0,0); //takakappale 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[41])/2.54, (y[41]-pp+sp)/2.54, "LINE"); addpoint((x[3])/2.54, (y[3]-pp+sp)/2.54, "LINE"); addpoint((x[3])/2.54, (y[3])/2.54, "LINE"); addpoint((x[2])/2.54, (y[2])/2.54, "LINE"); //etukappaleen pyoritys niin etta ke on pystysuora double ang; 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); rotate(40,8,ang); double nv; nv=1.5; //taite-viiva group_obj[1] = newobj_dot(); addpoint((x[23]-5-nv)/2.54, (y[23])/2.54, "line"); addpoint((x[23]-5-nv)/2.54, (y[10]-(pp-sp))/2.54, "line"); //ke-viiva group_obj[2] = newobject("poly"); addpoint((x[23]-5)/2.54, (y[23])/2.54, "line"); addpoint((x[23]-5)/2.54, (y[10]-(pp-sp))/2.54, "line"); //etukappale group_obj[3] = newobject("poly"); addpoint((x[22]-5)/2.54, (y[22])/2.54, "xarc_start"); addpoint((x[123]-5)/2.54, (y[123])/2.54, "xarc_corner"); addpoint((x[23]-5)/2.54, (y[23])/2.54, "line"); addpoint((x[23]-5-nv)/2.54, (y[23])/2.54, "xarc_start"); addpoint((x[23]-5-2*nv)/2.54, (y[23])/2.54, "xarc_corner"); addpoint((x[23]-5-3*nv)/2.54, (y[23]+.5)/2.54, "line"); addpoint((x[23]-5-3*nv)/2.54, (y[10]-(pp-sp))/2.54, "line"); addpoint((x[10]-5)/2.54, (y[10]-pp+sp)/2.54, "xarc_start"); addpoint((x[15]-5)/2.54, (y[10]-pp+sp)/2.54, "xarc_corner"); addpoint((x[40]-5)/2.54, (y[40]-pp+sp)/2.54, "LINE"); addpoint((x[16]-5)/2.54, (y[16])/2.54, "xarc_start"); addpoint((x[7]-5)/2.54, (y[7])/2.54, "xarc_corner"); addpoint((x[26]-5)/2.54, (y[26])/2.54, "xarc_start"); addpoint((x[125]-5)/2.54, (y[125])/2.54, "xarc_corner"); addpoint((x[25]-5)/2.54, (y[25])/2.54, "line"); init_xarc_array(); // making this call for doing arclength calculation //KAULUKSEN MUUTTUJA double kp; //kaula-aukon mitattu pituus kp=arclength(22,123,23)+arclength(1,17,18); //kauluksen koordinaatit //60) 1->laht�piste coord(1,60,0,5); //61) 60-> kaula-aukon mitattu pituus coord(60,61,-kp,0); //62) 61-> nappivara coord(61,62,-nv,0); //63) 61-> n. 4 cm=vakio coord(61,63,4,0); //64) 60-> 0.7 cm=vakio coord(60,64,0,0.7); //65) 64-> kaaren kulmapiste coord(64,65,-kp/3,0); //66) 62-> 0.5 cm=vakio coord(62,66,0,.5); //67) 66-> kaulurin korkeus edessa 2.5 cm coord(66,67,.5,2.5); //68) 64-> kaulurin korkeus takana 3-3.5 cm coord(64,68,0,3.5); //69) 65-> kaaren kulmapiste coord(65,69,0,3.5); //70) 67-> nappivara+1.2 coord(67,70,nv+0.2,0); //71) 68-> 1 cm=vakio coord(68,71,0,1); //72) 69-> kaaren kulmapiste coord(69,72,0,1); //73) 71-> kauluksen korkeus takana 4 cm coord(71,73,0,4); //74) 69-> kaaren kulmapiste coord(69,74,-kp/2,4); //75) 70-> kauluksen korkeus edessa 5-7 cm coord(70,75,-2,6); //76) 73->kauluksen suora osuus kt:sta coord(73,76,-kp/4,0); //kauluri group_obj[4] = newobject("poly"); addpoint(x[64]/2.54, y[64]/2.54, "xarc_start"); addpoint(x[65]/2.54, y[65]/2.54, "xarc_corner"); addpoint(x[63]/2.54, y[63]/2.54, "line"); current_point=addpoint(x[61]/2.54, y[61]/2.54, "line"); notch_type(current_point,"NOTCH",0); addpoint(x[66]/2.54, y[66]/2.54, "line"); addpoint(x[67]/2.54, y[67]/2.54, "line"); addpoint(x[70]/2.54, y[70]/2.54, "xarc_start"); addpoint(x[69]/2.54, y[69]/2.54, "xarc_corner"); addpoint(x[68]/2.54, y[68]/2.54, "line"); //kaulus group_obj[5] = newobject("poly"); addpoint(x[71]/2.54, (y[71]+4)/2.54, "xarc_start"); addpoint(x[72]/2.54, (y[72]+4)/2.54, "xarc_corner"); addpoint(x[70]/2.54, (y[70]+4)/2.54, "LINE"); addpoint(x[75]/2.54, (y[75]+4)/2.54, "xarc_start"); addpoint(x[74]/2.54, (y[74]+4)/2.54, "xarc_corner"); addpoint(x[76]/2.54, (y[76]+4)/2.54, "LINE"); addpoint(x[73]/2.54, (y[73]+4)/2.54, "LINE"); //hiha pk=ry/10; pap=ry/4-0.5; //1 //x[1]=[1]+pap; x[1]=pap; //2 coord(1,2,0,-pk); //3 coord(1,3,0,-hp); //4 coord(2,102,-100,0); coord(2,202,100,0); coord(2,4,-sqrt(pap*pap-pk*pk),0); //5 coord(2,5,sqrt(pap*pap-pk*pk),0); //6 x[6]=x[4]+2; y[6]=y[3]; //7 x[7]=x[5]-2; y[7]=y[3]; //10 coord(4,10,dist(1,4)/4,0); //11 coord(1,11,-5,0); //12 coord(5,12,-dist(1,5)/4,0); y[12]=y[12]+1; //13 coord(1,13,5,0); //8 center(10,11,8); //9 center(12,13,9); //14 center(3,6,14); y[14]=y[14]+1; //15 center(3,7,15); //y[15]=y[15]11; group_obj[6] = newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "xarc_start"); addpoint((x[11])/2.54, (y[11])/2.54, "xarc_corner"); addpoint((x[8])/2.54, (y[8])/2.54, "xarc_start"); addpoint((x[10])/2.54, (y[10])/2.54, "xarc_corner"); addpoint((x[4])/2.54, (y[4])/2.54, "line"); addpoint((x[6])/2.54, (y[6])/2.54, "xarc_start"); addpoint((x[14])/2.54, (y[14])/2.54, "xarc_corner"); addpoint((x[3])/2.54, (y[3])/2.54, "xarc_start"); addpoint((x[15])/2.54, (y[15])/2.54, "xarc_corner"); addpoint((x[7])/2.54, (y[7])/2.54, "line"); addpoint((x[5])/2.54, (y[5])/2.54, "xarc_start"); addpoint((x[12])/2.54, (y[12])/2.54, "xarc_corner"); addpoint((x[9])/2.54, (y[9])/2.54, "xarc_start"); addpoint((x[13])/2.54, (y[13])/2.54, "xarc_corner"); //grain line group_obj[7] = newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "line"); addpoint((x[3])/2.54, (y[3])/2.54, "open"); group_obj[8] = newobj_dot(); addpoint((x[15])/2.54, (y[15])/2.54, "line"); addpoint((x[15])/2.54, (y[15]+7)/2.54, "line"); //mansetti coord(14,1,0,-5); coord(1,2,1.5,0); coord(2,3,ray+2,0); coord(3,4,1.5,0); coord(4,5,0,-4); coord(3,6,0,-4); coord(2,7,0,-4); coord(1,8,0,-4); group_obj[9] = 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[10] = newobj_dot(); addpoint((x[2])/2.54, (y[2])/2.54, "line"); addpoint((x[7])/2.54, (y[7])/2.54, "line"); group_obj[11] = newobj_dot(); addpoint((x[3])/2.54, (y[3])/2.54, "line"); addpoint((x[6])/2.54, (y[6])/2.54, "line"); // set_obj_color(group_obj[6], "RED"); // set_obj_color(group_obj[7], "GREEN"); // set_obj_color(group_obj[8], "BLUE"); if(sv>0) { offset_mark(9); select(current_selection,group_obj[10]); select(current_selection,group_obj[11]); group(current_selection); deselect(current_selection); } else { mark(9); current_selection=newselection("OBJECT"); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); select(current_selection,group_obj[11]); group(current_selection); deselect(current_selection); } if(sv>0) { offset_mark(6); select(current_selection,group_obj[7]); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } else { mark(6); current_selection=newselection("OBJECT"); select(current_selection,group_obj[6]); select(current_selection,group_obj[7]); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } if(sv>0) { offset_mark(3); select(current_selection,group_obj[1]); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); } else { mark(3); current_selection=newselection("OBJECT"); select(current_selection,group_obj[3]); select(current_selection,group_obj[1]); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); } if(sv>0) { offset_mark(0); group(current_selection); deselect(current_selection); } else { mark(0); } if(sv>0) { offset_mark(4); group(current_selection); deselect(current_selection); } else { mark(4); } if(sv>0) { offset_mark(5); group(current_selection); deselect(current_selection); } else { mark(5); } 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"); //LOPPU } newobj_dot() { object temp; line("CENTER_LINE"); temp = newobject("poly"); 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(); } } } 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) { // PA = center of circle, PB and PC determine line, dradius is radius of // circle, "which" is 0 or 1 (which of 2 possible intersections) // PD is output point i.e. 4 means put results in Point 4. double mslope, dist0, dist1, dist2, xtemp; double tx, ty; //coordinates of Point T // Since we will use slope calculations, horizontal or vertical lines // have to be handled separately to avoid dividing by 0. xtemp = (x[PB]-x[PC])*(x[PB]-x[PC]); if (xtemp > 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 from_tspace 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 each of the segments that comprises the arc, find // the endpoints of the segment and add the segment length // to the total 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; } ////////////////////////////////////// // These global variables are used by from_tspace for repeated calls. double A1, A2, B1, B2; //transformation vectors 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) { // This routine finds the x and y coordinates of a point in an xarc. // "pos" gives the number of the point i.e. 7th. An xarc is // made up of 12 line segments. 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; //Take the negatives of these vectors because we are basing everything on //a unit circle in the third quadrant(not usual unit vectors) A1=-A1; B1=-B1; A2=-A2; B2=-B2; tspace_0[0]=A1; tspace_0[1]=B1; tspace_1[0]=A2; tspace_1[1]=B2; //This is the transformation matrix. Just multiply it by the //point you want to transform and add the center point // 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 { // Transformation matrix is already calculated 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() { // Must be called before calling from_tspace(). 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, 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; } //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; } } 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; }