BASIC DRAWING MODULE Panel_1( ! ! This module makes a dimensioned drawing of a panel containing ! an array of holes. ! ! The total area of the array of holes is equal to ! the area of a hole into which a fan is installed. ! ! The size of text and length of dimension lines are ! automatically proportioned to the size of the model. ! ! The automatic proportional spacing isn't fully worked out, ! but it's pretty good. FLOAT FAN_DIA:=349.2 > "Fan Diameter"; FLOAT PANEL_W:=1030.0 > "Panel Width "; FLOAT PANEL_H:=490.0 > "Panel Height "; FLOAT WALL_TH:=15.0 > "Panel Wall Thickness "; FLOAT ARRAY_BORDER:=40 > "Array Border"; INT ARRAY_COLS:=8 > "Array Columns"; INT ARRAY_ROWS:=4 > "Array Rows"); FLOAT ARR_COL_CNTRS; FLOAT ARR_ROW_CNTRS; FLOAT FAN_AREA; FLOAT HOLE_DIA; FLOAT HOLE_RAD; FLOAT OFFSET; INT ORIGIN; INT Size; INT i; INT j; VECTOR POS; BEGINMODULE cacc_view(50); ! Auto proportions: Size:=trunc(sqrt(PANEL_H * PANEL_W)/30); set(PEN=Size,WIDTH=2); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Draw the panel and array border: ! The panel: lin_ang(#1,vec(0, 0), 90.0, PANEL_W); lin_perp(#2,startp(#1), #1, PANEL_H); lin_perp(#3,endp(#1), #1, PANEL_H); lin_free(#4,endp(#2), endp(#3)); ! The border: lin_offs(#5,#4, -ARRAY_BORDER:LFONT=1,LDASHL=Size); lin_offs(#6,#2, -ARRAY_BORDER:LFONT=1,LDASHL=Size); lin_offs(#7,#1, ARRAY_BORDER:LFONT=1,LDASHL=Size); lin_offs(#8,#3, ARRAY_BORDER:LFONT=1,LDASHL=Size); trim(#6, 1, #5, -1); trim(#5, 0, #6, -1); trim(#7, 0, #6, -1); trim(#6, 0, #7, -1); trim(#8, 0, #7, -1); trim(#7, 1, #8, -1); trim(#5, 1, #8, -1); trim(#8, 1, #5, -1); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Find array hole diameter and radius: FAN_AREA:= ((PI/4)*(FAN_DIA**2)); HOLE_DIA:= sqrt(4*(FAN_AREA/(ARRAY_COLS*ARRAY_ROWS)/PI)); HOLE_RAD:= HOLE_DIA/2; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Find array hole centers: ! Find column (W) centerlines: ARR_COL_CNTRS:= ((arcl(#7)-HOLE_DIA)/(ARRAY_COLS-1)); for i := 1 to ARRAY_COLS do if i = 1 then OFFSET:= HOLE_RAD; ORIGIN:=8; j:=i; else OFFSET:= ARR_COL_CNTRS; ORIGIN:=9; j:=i-1; endif; lin_offs(#9, refc(ORIGIN,j), OFFSET); endfor; ! Find row (D) centerlines: ARR_ROW_CNTRS:= ((arcl(#6)-HOLE_DIA)/(ARRAY_ROWS-1)); for i := 1 to ARRAY_ROWS do if i = 1 then OFFSET:= HOLE_RAD; ORIGIN:=7; j:=i; else OFFSET:= ARR_ROW_CNTRS; ORIGIN:=10; j:=i-1; endif; lin_offs(#10, refc(ORIGIN,j), OFFSET); endfor; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Locate the holes on COL/ROW centers: for i := 1 to ARRAY_ROWS do for j := 1 to ARRAY_COLS do arc_1pos(#11, intersect(refc(10,i),refc(9,j)), HOLE_RAD); endfor; endfor; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Dimensions: ! Panel width: ldim(#13, endp(#2), endp(#3), on(#4,0.5)+vec(Size*10,0), 2:DTSIZ=Size,DASIZ=Size); ! Panel height: ldim(#14, startp(#1), startp(#4), on(#2,0.5)+vec(0,-Size*10), 2:DTSIZ=Size,DASIZ=Size); ! Diameter of array hole: cdim(#15, #11.1, intersect(#7, #11, 1)+vec(-Size*10, 0), 1:DTSIZ=Size, DASIZ=Size,DNDIG=1); ! Radius of array hole: rdim(#16, #11.1, centre(#11.1, 1), intersect(#1, #3, 1)+vec(-Size*7,Size*7) :DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Panel border, columns: ldim(#17, endp(#8), endp(#3), endp(#8)+vec(Size*7,Size*5), 1:DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Panel border, rows: ldim(#18, endp(#4), endp(#5), endp(#5)+vec(0,Size*5), 0:DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Panel edge to array border column hole centers: ldim(#19, endp(#2), endp(refc(9,ARRAY_COLS)), startp(#2)+vec(-Size*5,0), 1:DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Panel edge to array border row hole centers: ldim(#20, startp(#1), startp(#10.1), startp(#1)+vec(-Size*5,-Size*5), 0:DTSIZ=Size,DASIZ=Size,DNDIG=1); if ARRAY_COLS > 1 then ! Column centers: ldim(#21, endp(refc(9, ARRAY_COLS-1)), endp(refc(9,ARRAY_COLS)), endp(refc(9, ARRAY_COLS))+vec(Size*7,0), 1:DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Distance between holes, columns: ldim(#22, intersect(#11.1, #10, 2), intersect(#11.2, #10, 1), on(#11.2,0.5)+vec(-Size*5,0), 1:DTSIZ=Size,DASIZ=Size); endif; if ARRAY_ROWS > 1 then ! Row centers: ldim(#23, startp(refc(10,ARRAY_ROWS-1)), startp(refc(10,ARRAY_ROWS)), on(refc(10,ARRAY_ROWS-1))+vec(0,-Size*5), 0:DTSIZ=Size,DASIZ=Size,DNDIG=1); ! Distance between holes, rows: ldim(#24, intersect(#9, #11, 2), intersect(#9, refc(11,ARRAY_COLS+1), 1), on(#11,0)+vec(0,Size*5), 0:DTSIZ=Size,DASIZ=Size); endif; ENDMODULE