// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2011/11/04 //2016 edited shoulder lines and fly pants selection current_selection; object current_object, group_obj[100]; point current_point; double result; double index, done; object marker_array[20]; double marker_count, loop; double sizes; double metric, sv; double read; double vy, ly, sip, jsp, ik, ls, lx; double size; double t_vy[7]; double t_ly[7]; double t_sip[7]; double t_jsp[7]; double t_ik[7]; double t_ls[7]; double language; double x[300], y[300]; 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_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_ls[0]=26; t_ls[1]=26; t_ls[2]=26; t_ls[3]=26; t_ls[4]=27; t_ls[5]=28; t_ls[6]=29; 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]=21; t_jsp[1]=24; t_jsp[2]=27; t_jsp[3]=30; t_jsp[4]=33.5; t_jsp[5]=37; t_jsp[6]=40.5; vy= t_vy[size]; ly= t_ly[size]; sip= t_sip[size]; jsp= t_jsp[size]; ls= t_ls[size]; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { vy=vy/2.54; ly=ly/2.54; sip=sip/2.54; jsp=jsp/2.54; ls=ls/2.54; } } else { if (language == 0) { metric=2*pop_up("UNITS","Inches","Centimeters"); } if (metric<1) { vy=vy/2.54; ly=ly/2.54; sip=sip/2.54; jsp=jsp/2.54; ls=ls/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' TAILORED PANTS"); } 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("Outside length", sip,"bc_meas_outside"); } if (language == 0) { add_picture_input("Inside length", jsp,"bc_meas_inside"); } if (language == 0) { add_picture_input("Seam Allowance", sv, "meas_seamallow"); } run_picture_input(); } else { if (language == 0) { dialog_box("BABIES' TAILORED PANTS", "Waist circumference", vy, "Hip circumference",ly, "Outside length", sip, "Inside length", jsp, "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) { vy=vy*2.54; ly=ly*2.54; sip=sip*2.54; jsp=jsp*2.54; ls=ls*2.54; } } else { if (metric<1) { vy=vy*2.54; ly=ly*2.54; sip=sip*2.54; jsp=jsp*2.54; ls=ls*2.54; } } if(metric==2) { sv=sv/2.54; } vy= vy+2; ly= ly+4; jsp=jsp-2; ik=sip-jsp; lx=ly/20; x[0]=0; y[0]=30; coord(0,1,0,0); coord(1,2,0,-sip); coord(2,3,0,jsp); coord(3,4,0,ik/3); coord(2,5,0,2); coord(4,6,-(ly/8-1.5),0); coord(4,7,(ly/8+1.5+2),0); x[8]=x[6]; y[8]=y[3]; x[9]=x[8]; y[9]=y[1]; coord(9,10,(vy/4+1+3),0); coord(8,11,-(lx+1),0); coord(5,12,-(ls/4-0.75),0); coord(5,112,(ls/4-0.75),0); coord(4,13,0,(lx+2)); coord(13,14,-lx,0); coord(14,15,sqrt((ly/4+2)*(ly/4+2)-(lx+2)*(lx+2)),-(lx+2)); coord(6,106,2,0); cont(106,14,116,50); coord(12,20,-1.5,0); coord(112,120,1.5,0); cont(120,15,117,(dist(7,10)/2)); cont(15,117,217,(dist(7,10)/2)); x[17]=x[217]-1; y[17]=y[1]; cont(116,14,16,-dist(15,217)); coord(11,18,-(lx+1),0); coord(18,19,0,0); coord(11,119,0,0); coord(8,108,0,0); center(16,17,21); cont(17,21,24,-((dist(16,17)-(vy/4-1))/2)); cont(17,21,23,+((dist(16,17)-(vy/4-1))/2)); cont(14,16,114,-8); cont(117,114,22,-dist(16,21)); coord(9,109,-3,0); coord(6,106,-3,1); //group_obj[0]=newobject("poly"); //addpoint((x[109])/2.54, (y[109])/2.54, "line"); //addpoint((x[106])/2.54, (y[106])/2.54, "line"); //addpoint((x[6])/2.54, (y[6])/2.54, "line"); //addpoint((x[9])/2.54, (y[9])/2.54, "line"); group_obj[0]=newobject("poly"); addpoint((x[6])/2.54, (y[6])/2.54, "line"); addpoint((x[9])/2.54, (y[9])/2.54, "open"); center(7,10,110); x[110]=x[7]; coord(1,101,2.5,0); cont(101,10,210,-7); x[211]=x[210]; y[211]=y[110]; cont(26,7,213,-5); x[212]=x[1]; y[212]=y[213]-3; group_obj[1]=newobject("poly"); addpoint((x[1]-vy/2)/2.54, (y[1])/2.54, "line"); addpoint((x[1]+2.5-vy/2)/2.54, (y[1])/2.54, "line"); current_point=addpoint((x[210]-vy/2)/2.54, (y[210])/2.54, "line"); notch_type(current_point,"NOTCH",0); addpoint((x[10]-vy/2)/2.54, (y[10])/2.54, "line"); current_point=addpoint((x[110]-vy/2)/2.54, (y[110])/2.54, "line"); notch_type(current_point,"NOTCH",0); addpoint((x[7]-vy/2)/2.54, (y[7])/2.54, "xarc_start"); addpoint((x[212]-vy/2)/2.54, (y[212])/2.54, "xarc_corner"); group_obj[2]=newobject("poly"); addpoint((x[1]+5-vy/2)/2.54, (y[210]-2)/2.54, "line"); addpoint((x[1]+5-vy/2)/2.54, (y[7])/2.54, "open"); group_obj[3]=newobject("poly");//inkijk addpoint((x[1]-vy/2)/2.54, (y[1]-20)/2.54, "line"); addpoint((x[1]+2.5-vy/2)/2.54, (y[1]-20)/2.54, "line"); addpoint((x[210]-vy/2)/2.54, (y[210]-20)/2.54, "xarc_start"); addpoint((x[211]-vy/2)/2.54, (y[211]-20)/2.54, "xarc_corner"); addpoint((x[110]-vy/2)/2.54, (y[110]-20)/2.54, "line"); addpoint((x[7]-vy/2)/2.54, (y[7]-20)/2.54, "xarc_start"); addpoint((x[212]-vy/2)/2.54, (y[212]-20)/2.54, "xarc_corner"); group_obj[4]=newobject("poly"); addpoint((x[1]+5-vy/2)/2.54, (y[110]-20)/2.54, "line"); addpoint((x[1]+5-vy/2)/2.54, (y[7]-20)/2.54, "open"); group_obj[5]=newobject("poly");//Front pants addpoint((x[1])/2.54, (y[1])/2.54, "line"); current_point=addpoint((x[1]+3)/2.54, (y[1])/2.54, "line"); notch_type(current_point,"NOTCH",0); center(7,10,110); x[110]=x[10]; addpoint((x[210])/2.54, (y[210])/2.54, "xarc_start"); addpoint((x[211])/2.54, (y[211])/2.54, "xarc_corner"); addpoint((x[110])/2.54, (y[110])/2.54, "line"); addpoint((x[7])/2.54, (y[7])/2.54, "line"); addpoint((x[112])/2.54, (y[112])/2.54, "line"); addpoint((x[5])/2.54, (y[5])/2.54, "line"); addpoint((x[12])/2.54, (y[12])/2.54, "line"); addpoint((x[11])/2.54, (y[11])/2.54, "xarc_start"); addpoint((x[8])/2.54, (y[8])/2.54, "xarc_corner"); addpoint((x[6])/2.54, (y[6])/2.54, "line"); addpoint((x[106])/2.54, (y[106])/2.54, "line"); addpoint((x[109])/2.54, (y[109])/2.54, "line"); addpoint((x[9])/2.54, (y[9])/2.54, "line"); group_obj[6]=newobject("poly"); addpoint((x[5])/2.54, y[5]/2.54, "line"); addpoint((x[1])/2.54, y[1]/2.54, "line"); group_obj[7]=newobject("poly"); addpoint((x[1])/2.54, (y[1]-1)/2.54, "line"); addpoint((x[1]+3)/2.54, (y[1]-1)/2.54, "line"); addpoint((x[1]+2)/2.54, (y[1]-0.5)/2.54, "line"); addpoint((x[1]+3)/2.54, (y[1]-1)/2.54, "line"); addpoint((x[1]+2)/2.54, (y[1]-1.5)/2.54, "open"); group_obj[8]=newobject("poly"); addpoint((x[16]+ly/2)/2.54, (y[16])/2.54, "line"); addpoint((x[23]+ly/2)/2.54, (y[23])/2.54, "line"); addpoint((x[22]+ly/2)/2.54, (y[22])/2.54, "line"); addpoint((x[24]+ly/2)/2.54, (y[24])/2.54, "line"); addpoint((x[17]+ly/2)/2.54, (y[17])/2.54, "xarc_start"); addpoint((x[117]+ly/2)/2.54, (y[117])/2.54, "xarc_corner"); addpoint((x[15]+ly/2)/2.54, (y[15])/2.54, "line"); addpoint((x[120]+ly/2)/2.54, (y[120])/2.54, "line"); addpoint((x[5]+ly/2)/2.54, (y[5])/2.54, "line"); addpoint((x[20]+ly/2)/2.54, (y[20])/2.54, "xarc_start"); center(19,20,121); x[121]=x[121]+2; addpoint((x[121]+ly/2)/2.54, (y[121])/2.54, "xarc_corner"); addpoint((x[19]+ly/2)/2.54, (y[19])/2.54, "line"); addpoint((x[119]+ly/2)/2.54, (y[119])/2.54, "xarc_start"); addpoint((x[108]+ly/2)/2.54, (y[108])/2.54, "xarc_corner"); addpoint((x[14]+ly/2)/2.54, (y[14])/2.54, "line"); group_obj[9]=newobject("poly"); addpoint((x[5]+ly/2)/2.54, (y[5])/2.54, "line"); addpoint((x[5]+ly/2)/2.54, (y[16]-1)/2.54, "line"); coord(20,1,0,-5); coord(1,2,vy+3+3,0); coord(2,3,0,-6); coord(1,4,0,-6); group_obj[10]=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"); group_obj[11]=newobject("poly"); addpoint((x[2]-3)/2.54, (y[2])/2.54, "line"); addpoint((x[3]-3)/2.54, (y[3])/2.54, "line"); group_obj[12]=newobject("poly"); addpoint((x[1]+3)/2.54, (y[1])/2.54, "line"); addpoint((x[4]+3)/2.54, (y[4])/2.54, "line"); if (sv!=0) { //fly // offset_mark(0); // select(current_selection,group_obj[14]); // group(current_selection); // deselect(current_selection); //pocket offset_mark(1); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); //pocket2 offset_mark(3); select(current_selection,group_obj[4]); group(current_selection); deselect(current_selection); //pants front offset_mark(5); select(current_selection,group_obj[6]); select(current_selection,group_obj[7]); select(current_selection,group_obj[0]); group(current_selection); deselect(current_selection); //pants back offset_mark(8); select(current_selection,group_obj[9]); group(current_selection); deselect(current_selection); //waist band offset_mark(10); select(current_selection,group_obj[11]); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); } else { //fly // mark(0); //pocket mark(1); current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); //pocket2 mark(3); current_selection=newselection("OBJECT"); select(current_selection,group_obj[3]); select(current_selection,group_obj[4]); group(current_selection); deselect(current_selection); //pants front mark(5); current_selection=newselection("OBJECT"); select(current_selection,group_obj[5]); select(current_selection,group_obj[6]); select(current_selection,group_obj[7]); select(current_selection,group_obj[0]); group(current_selection); deselect(current_selection); //pants back mark(8); current_selection=newselection("OBJECT"); select(current_selection,group_obj[8]); select(current_selection,group_obj[9]); group(current_selection); deselect(current_selection); //waist band mark(10); current_selection=newselection("OBJECT"); select(current_selection,group_obj[10]); select(current_selection,group_obj[11]); select(current_selection,group_obj[12]); 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) { 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 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 (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; } 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) { 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() { 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; } } 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; } } // ************************************************************ // ************************************************************ // SUMMARY OF DEBUG FUNCTIONS: // // print_var() 1 variable standalone // print_vars() 1 line (needs start_... & run_...) // // print_ang() 1 angle standalone // print_angs() 1 line (needs start_... & run_...) // // print_point() 1 x-y point standalone // print_points() 1 line (needs start_... & run_...) // // print_range() many x-y points, standalone // // ************************************************************ // // Add these functions to the end of the .mac (or .pat ?) file // // May need to comment out end of main (just before zoomall) // to prevent printed point numbers from being offset. // // Last Revised 2015-06-29 // ************************************************************ print_var(string var_name, double var_index) { // Prints a single variable. // Subroutine can be called alone without any other supporting statements. // Sample call: print_var("Bicep var[3]", var_index[3]); start_picture_input("print_var"); add_picture_input(var_name, var_index, ""); // 3rd arg is null pic file run_picture_input(); } // ************************************************************ print_vars(string var_name, double var_index) { // Prints multiple variables. // Depends on added start.. and run... lines // Sample call: // start_picture_input("print_vars"); // print_vars("Bicep Var[3] ", var_index[3]); // print_vars("Leg Var[4] ", var_index[4]); // run_picture_input(); add_picture_input(var_name, var_index, ""); } // ************************************************************ print_ang(string ang_name, double ang_radians) { // Prints a single angle and converts from radians to degrees // Note that angles are measured from the postive x-axis going CounterClockWise // Subroutine can be called alone without any other supporting statements // Sample call: print_ang("Bicep Var[3]", Var[3]) double ang_degrees; start_picture_input("print_ang"); ang_degrees = ang_radians * 360/(2 * 3.14159); add_picture_input(ang_name, ang_degrees, ""); // 3rd arg is null pic file run_picture_input(); } // ************************************************************ print_angs(string ang_name, double ang_radians) { // Prints multiple angles and converts from radians to degrees // Note that angles are measured from the postive x-axis going CounterClockWise // Depends on added start.. and run... lines // sample call: // start_picture_input("print_angs"); // print_vars("Bicep Var[3] ", Var[3]); // print_vars("Leg Var[4] ", Var[4]); // run_picture_input(); double ang_degrees; ang_degrees = ang_radians * 360/(2 * 3.14159); add_picture_input(ang_name, ang_degrees, ""); } // ************************************************************ print_point(string caption, double index) { // Prints the value of one point // and may attempt to label the point on the drawing. // Subroutine can be called alone without any other supporting statements string x_prompt, y_prompt; // dialog box start_picture_input("print_point"); x_prompt = "x[" + index + "] " + caption + " X"; y_prompt = "y[" + index + "] " + caption + " Y"; add_picture_input(x_prompt, x[index],""); add_picture_input(y_prompt, y[index],""); run_picture_input(); // print point #'s on drawing if(1 == 1) { current_object=newobject("text", caption, 0.0, 0.5, 0.5, "SIMP.CHR"); // ,,height,width, if (metric==1) { addpoint (x[index]/2.54, y[index]/2.54, "line"); // METRIC } else { addpoint (x[index], y[index], "line"); // US INCHES } } } // ************************************************************ print_points(string caption, double index) { // Prints the value of one point // and may attempt to label the points on the drawing // Depends on added start.. and run... lines // start_picture_input("print_points"); all points showing in one form // print_points("var1", var1); // print_points("var2", var2); // run_picture_input(); string x_prompt, y_prompt; // dialog box x_prompt = "x[" + index + "] " + caption + " X"; y_prompt = "y[" + index + "] " + caption + " Y"; add_picture_input(x_prompt, x[index],""); add_picture_input(y_prompt, y[index],""); // Print point #'s on drawing //Change to 0 to disable printing point numbers on drawings print_pnt_numbers = 1; // 1 to print pnt numbers on drawing if(print_pnt_numbers == 1) // enable or suppess printing of point numbers on drawings current_object=newobject("text", caption, 0.0, 0.5, 0.5, "SIMP.CHR"); // ,,height,width, if (metric==1) // metric is 1 { addpoint (x[index]/2.54, y[index]/2.54, "line"); // METRIC } if (metric==0) { addpoint (x[index], y[index], "line"); // US INCHES } } // ************************************************************* print_range(double start, double end) { // Prints the value of a range of x-y points // and may attempt to label the points on the drawing. // Subroutine can be called alone without any other supporting statements // Sample call: print_range(11,15); double index; string x_prompt, y_prompt; double print_pnt_numbers; start_picture_input("print_range"); // dialog box for (index=start; index <= end; index = index + 1) { x_prompt = "x[" + index + "] X"; y_prompt = "y[" + index + "] Y"; add_picture_input(x_prompt, x[index], ""); add_picture_input(y_prompt, y[index], ""); } run_picture_input(); // print point #'s on drawing //Change to 0 to disable printing point numbers on drawings print_pnt_numbers = 1; // 1 to print pnt numbers on drawing if(print_pnt_numbers == 1) // enable or suppess printing of point numbers on drawings { for (index=start; index <= end; index = index + 1) { current_object=newobject("text", index, 0.0, 0.5, 0.5, "SIMP.CHR"); if (metric==1) // labels points in drawing! { addpoint (x[index]/2.54, y[index]/2.54, "line"); // METRIC } else { addpoint (x[index], y[index], "line"); // US INCHES } } } } //************************************************************