// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2012/08/14 double x[400], y[400]; double ang,vang,vdistance,rangle; object group_obj[200]; object current_object; point current_point; selection current_selection; double index, done, version; double metric; double read; double 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,ptl,pts,rl,pk; double okt,oke; double ktpe,ktpt,ktp,pit; double siirtox; double siirtoy; double ease; double sv; double f_ry[5],f_ky[5],f_vy[5],f_yly[5],f_aly[5],f_rkkv[5],f_sl[5]; double f_op[5],f_vk[5],f_rk[5],f_sp[5],f_ktk[5],f_kay[5],f_ray[5],f_hp[5]; double sleeve_length; double language; object marker_array[20]; double marker_count, loop; double result; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","L1macros", "This macro needs to be properly installed before running it."); } index = 0; done = 0; //Start Options while (!done) { if (index==0) { dialog_ease(); } if (index==1) { dialog_sleeve_length(); } } //End Options ry=96; ky=39.25; vy=78; yly=95; aly=102; rkkv=21; sl=37.6; ylk=9; alk=19; sp=41.3; op=13.5; hp=60.4; kay=30; ray=18.5; rk=36.8; vk=53.4; sv=1; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { 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; } } 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("LADIES' PULLOVER"); } 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 { if (language == 0) { dialog_box( "LADIES' PULLOVER, 1 of 2", "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( "LADIES' PULLOVER, 2 of 2", "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("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) { 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; } } 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; } } } } } } } } } } } f_ry[0]=ry-2; f_ky[0]=ky; f_vy[0]=vy-2; f_yly[0]=yly-2; f_aly[0]=aly-2; f_rkkv[0]=rkkv; f_sl[0]=sl-.5; f_op[0]=op-1; f_vk[0]=vk; f_rk[0]=rk; f_sp[0]=sp; f_ktk[0]=ktk-1; f_kay[0]=kay; f_ray[0]=ray; f_hp[0]=hp; f_ry[1]=ry+0; f_ky[1]=ky; f_vy[1]=vy+2; f_yly[1]=yly+2; f_aly[1]=aly+2; f_rkkv[1]=rkkv; f_sl[1]=sl; f_op[1]=op-1; f_vk[1]=vk; f_rk[1]=rk; f_sp[1]=sp; f_ktk[1]=ktk; f_kay[1]=kay+3; f_ray[1]=ray+3; f_hp[1]=hp; f_ry[2]=ry+8; f_ky[2]=ky; f_vy[2]=vy+6; f_yly[2]=yly+4+2; f_aly[2]=aly+4; f_rkkv[2]=rkkv; f_sl[2]=sl+1.6; f_op[2]=op; f_vk[2]=vk; f_rk[2]=rk; f_sp[2]=sp; f_ktk[2]=ktk+1; f_kay[2]=kay+6; f_ray[2]=ray+6; f_hp[2]=hp; 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]; sp=f_sp[ease]; ktk=f_ktk[ease]; kay=f_kay[ease]; ray=f_ray[ease]; hp=f_hp[ease]; pts=ky/5+0.5; ptl=ky/5-1; ktl=ry/8-1.5; eml=3; tml=3; sml=(ry/2-vy/2)-4; smlaly=(ry/2-aly/2); if(aly0) { offset_mark(1); select(current_selection,group_obj[7]); group(current_selection); deselect(current_selection); } else { mark(1); current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); select(current_selection,group_obj[7]); group(current_selection); deselect(current_selection); } cont(3,102,302,-4); cont(33,31,331,-4-2.5); y[331]=y[331]+.3; x[323]=x[331]; y[323]=y[302]; current_object=newobject("poly"); addpoint((x[31]+2.5-4)/2.54, (y[31])/2.54, "xarc_start"); addpoint((x[31]+2.5-4)/2.54, (y[102])/2.54, "xarc_corner"); addpoint((x[102]-4)/2.54, (y[102])/2.54, "line"); addpoint((x[302]-4)/2.54, (y[302])/2.54, "xarc_start"); addpoint((x[323]-4)/2.54, (y[323])/2.54, "xarc_corner"); addpoint((x[331]-4)/2.54, (y[331])/2.54, "line"); group_obj[3]=current_object; if (language == 0) { current_object=newobject("text","Front facing, CF, Cut 1 on fold",0.0,0.1,0.2,"SIMP.CHR"); } addpoint((x[6]-3)/2.54, (y[23]-1+siirtoy)/2.54, "line"); group_obj[8]=current_object; if(sv>0) { offset_mark(3); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } else { mark(3); current_selection=newselection("OBJECT"); select(current_selection,group_obj[3]); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } current_object=newobject("poly"); addpoint((x[21])/2.54, (y[21])/2.54, "xarc_start"); addpoint((x[122]-2.5)/2.54, (y[122])/2.54, "xarc_corner"); addpoint((x[22]-2.5)/2.54, (y[22])/2.54, "line"); addpoint((x[26])/2.54, (y[26])/2.54, "xarc_start"); addpoint((x[37])/2.54, (y[37])/2.54, "xarc_corner"); addpoint((x[35])/2.54, (y[35])/2.54, "xarc_start"); addpoint((x[9])/2.54, (y[9])/2.54, "xarc_corner"); addpoint((x[11])/2.54, (y[11]-1.3)/2.54, "line"); cont(11,49,149,-3); current_point= addpoint((x[149])/2.54, (y[149])/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); addpoint((x[49])/2.54, (y[49])/2.54, "xarc_corner"); cont(48,49,148,-3); current_point= addpoint((x[148])/2.54, (y[148])/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); addpoint((x[48])/2.54, (y[48])/2.54, "xarc_corner"); current_point= addpoint((x[47])/2.54, (y[47])/2.54, "line"); notch_type(current_point,"NOTCH",1); addpoint((x[47])/2.54, (y[47]-5)/2.54, "line"); addpoint((x[42])/2.54, (y[42]-5)/2.54, "line"); addpoint((x[15])/2.54, (y[15]-5)/2.54, "line"); current_point= addpoint((x[15])/2.54, (y[15])/2.54, "line"); notch_type(current_point,"NOTCH",1); addpoint((x[14])/2.54, (y[14])/2.54, "line"); current_point= addpoint((x[13])/2.54, (y[13])/2.54, "line"); notch_type(current_point,"NOTCH",1); addpoint((x[12])/2.54, (y[12])/2.54, "line"); group_obj[2]=current_object; if (language == 0) { current_object=newobject("text","Back piece, CB, Cut 1 on fold",-1.570796,0.15,0.2,"SIMP.CHR"); } addpoint((x[21]-1)/2.54, (y[5]-siirtoy)/2.54, "line"); group_obj[8]=current_object; if(sv>0) { offset_mark(2); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } else { mark(2); current_selection=newselection("OBJECT"); select(current_selection,group_obj[2]); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } coord(21,121,0,-4); coord(122,222,0,-4); cont(26,22,127,-5-2.5); y[127]=y[127]+.2; current_object=newobject("poly"); addpoint((x[21])/2.54, (y[21])/2.54, "line"); addpoint((x[121])/2.54, (y[121])/2.54, "xarc_start"); addpoint((x[127])/2.54, (y[222])/2.54, "xarc_corner"); addpoint((x[127])/2.54, (y[127])/2.54, "line"); addpoint((x[22]-2.5)/2.54, (y[22])/2.54, "xarc_start"); addpoint((x[122]-2.5)/2.54, (y[122])/2.54, "xarc_corner"); group_obj[4]=current_object; if (language == 0) { current_object=newobject("text","Back facing, CB, Cut 1 on fold",0.0,0.1,0.2,"SIMP.CHR"); } addpoint((x[21]-11)/2.54, (y[21]-1+siirtoy)/2.54, "line"); group_obj[10]=current_object; if(sv>0) { offset_mark(4); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); } else { mark(4); current_selection=newselection("OBJECT"); select(current_selection,group_obj[4]); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); } ktpe=arclength(33,36,34)+arclength(34,10,11); ktpt=arclength(26,37,35)+arclength(35,9,11); ktp=ktpe+ktpt; pk=ktp/3; coord(0,1,kay/2+5,0); coord(1,2,0,-pk/3); coord(2,3,0,-pk/3); coord(3,4,0,-pk/3); coord(1,5,0,-hp); center(5,1,6); y[6]=y[6]-4; coord(5,7,0,-3); coord(4,8,-kay/2,0); coord(4,9,kay/2,0); coord(4,8,-sqrt(ktpe*ktpe-pk*pk)-.5,0); coord(4,9,sqrt(ktpe*ktpe-pk*pk)+1,0); coord(5,10,-(ray/2),0); coord(5,11,+(ray/2),0); center(8,10,12); y[12]=y[6]; center(9,11,13); y[13]=y[6]; cont(12,10,14,1.5); center(5,10,15); center(5,7,16); coord(7,17,+(kay/4-2),0); cont(13,11,18,1.5); coord(8,19,ktl/2,0); coord(1,20,-5,0); cont(19,20,21,-dist(19,20)/3); cont(20,19,22,-dist(19,20)/3); coord(9,23,-ktl/4,0); coord(1,24,5,0); cont(23,24,25,-dist(23,24)/3); cont(24,23,26,-dist(23,24)/3); double pyorion_pituus_etu, pyorion_pituus_taka; pyorion_pituus_taka=arclength(9,23,26)+dist(26,25)+arclength(25,24,1); pyorion_pituus_etu=arclength(8,19,22)+dist(22,21)+arclength(21,20,1); x[8]=x[8]+(pyorion_pituus_etu-(ktpe+2)); x[9]=x[9]-(pyorion_pituus_taka-(ktpt+2)); x[33]=x[33]-(pyorion_pituus_taka-(ktpt+2)); x[31]=x[31]-(pyorion_pituus_taka-(ktpt+2)); x[32]=x[32]-(pyorion_pituus_taka-(ktpt+2)); current_object=newobject("poly"); addpoint((x[1])/2.54, (y[1])/2.54, "xarc_start"); addpoint((x[20])/2.54, (y[20])/2.54, "xarc_corner"); addpoint((x[21])/2.54, (y[21])/2.54, "line"); current_point= addpoint((x[22])/2.54, (y[22])/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); addpoint((x[19])/2.54, (y[19])/2.54, "xarc_corner"); if(sleeve_length==0) { addpoint((x[8])/2.54, (y[8])/2.54, "line"); current_point= addpoint((x[12])/2.54, (y[12])/2.54, "line"); notch_type(current_point,"NOTCH",1); addpoint((x[10])/2.54, (y[10])/2.54, "line"); addpoint((x[11])/2.54, (y[11])/2.54, "line"); current_point= addpoint((x[13])/2.54, (y[13])/2.54, "line"); notch_type(current_point,"NOTCH",1); addpoint((x[9])/2.54, (y[9])/2.54, "xarc_start"); } else { addpoint((x[8])/2.54, (y[8])/2.54, "line"); addpoint((x[8]+2)/2.54, (y[8]-10)/2.54, "line"); addpoint((x[9]-1)/2.54, (y[9]-10)/2.54, "line"); addpoint((x[9])/2.54, (y[9])/2.54, "xarc_start"); } addpoint((x[23])/2.54, (y[23])/2.54, "xarc_corner"); addpoint((x[26])/2.54, (y[26])/2.54, "line"); addpoint((x[25])/2.54, (y[25])/2.54, "xarc_start"); addpoint((x[24])/2.54, (y[24])/2.54, "xarc_corner"); group_obj[5]=current_object; if (language == 0) { current_object=newobject("text","Sleeve, Shoulder, Cut 2",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[1])/2.54, (y[1]-1+siirtoy)/2.54, "line"); group_obj[13]=current_object; if (language == 0) { current_object=newobject("text","Sleeve, Front",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[1]-kay/2+2)/2.54, (y[4]-1+siirtoy)/2.54, "line"); group_obj[11]=current_object; if (language == 0) { current_object=newobject("text","Sleeve, Back",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[1]+kay/2-5)/2.54, (y[4]-1+siirtoy)/2.54, "line"); group_obj[12]=current_object; current_object=newobject("poly"); if(sleeve_length==1) { addpoint((x[1])/2.54, (y[8]-10)/2.54, "line"); } else { addpoint((x[1])/2.54, (y[6])/2.54, "line"); } addpoint((x[1])/2.54, (y[1])/2.54, "open"); group_obj[6]=current_object; if(sv>0) { offset_mark(5); select(current_selection,group_obj[11]); select(current_selection,group_obj[12]); select(current_selection,group_obj[13]); select(current_selection,group_obj[6]); group(current_selection); deselect(current_selection); } else { mark(5); current_selection=newselection("OBJECT"); select(current_selection,group_obj[5]); select(current_selection,group_obj[11]); select(current_selection,group_obj[12]); select(current_selection,group_obj[13]); select(current_selection,group_obj[6]); 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"); } dialog_ease() { if (language == 0) { start_pict_dialog("BUST EASE"); add_pict_item("Minimum (-.75in/-2cm)"," "); add_pict_item("Medium (+0in/+0cm)"," "); add_pict_item("Maximum (+3.25in/+8cm)"," "); run_pict("Next"); ease=get_pict_result(); Forward(); } } dialog_sleeve_length() { if (language == 0) { start_pict_dialog("SLEEVE LENGTH"); add_pict_item("Long","L1_pullover_ls.jpg"); add_pict_item("Short","L1_pullover_ss.jpg"); if (run_pict("Back","Next")) //was Done { sleeve_length=get_pict_result(); Forward(); } else { sleeve_length=0; Backward(); } } } Forward() { index = index + 1; if (index==1) { done = 1; } } Backward() { index = index - 1; } 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(); } } } 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 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() { 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; } } mark_group(selection sel, object obj) { point pnt, test, index; double temp_x, temp_y; pnt = first_point(obj); temp_x = pointx(pnt); temp_y = pointy(pnt); while (loop_sel(sel)) { test = first_point(get_sel_obj()); if ( (pointx(test) != temp_x) || (pointy(test) != temp_y)) { marker_piece(get_sel_obj(),1); } } } 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; }