home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
Chip_1998-03_cd.bin
/
tema
/
MINICAD
/
MC7DEMO
/
MINICAD.1
/
SLOTS.MPC
< prev
next >
Wrap
Text File
|
1997-04-30
|
914b
|
48 lines
PROCEDURE Slots;
{
⌐1997, Diehl Graphsoft, Inc.
This procedure draws slots.
Developed by Tom Urie.
}
LABEL 5,10,99;
VAR
L,r,x0,y0,x1,y1,x2,y2,Theta : REAL;
BEGIN
5:r:=RealDialog('Slot Width:','1/2')/2;
IF DidCancel THEN GOTO 99;
IF r <= 0 THEN
BEGIN
SysBeep;
GOTO 5;
END;
Message('Click center points of slot. Double-click to quit.');
10:GetLine(x1,y1,x2,y2);
If (x1 = x2) AND (y1 = y2) THEN GOTO 99;
L:=Distance(x1,y1,x2,y2);
Theta:=ArcCos((x2-x1)/L);
IF y2 < y1 THEN
Theta:=2*PI-Theta;
x0:=x1-r*Cos(Theta)-r*Sin(Theta);
y0:=y1-r*Sin(Theta)+r*Cos(Theta);
Theta:=Rad2Deg(Theta);
Absolute;
MoveTo(x0,y0);
Relative;
AngleVar;
ClosePoly;
BeginPoly;
ArcTo((L+2*r),#Theta,r);
ArcTo((2*r),#(Theta-90),r);
ArcTo(-(L+2*r),#Theta,r);
ArcTo(-(2*r),#(Theta-90),r);
EndPoly;
NoAngleVar;
Redraw;
GOTO 10;
99:ClrMessage;
END;
RUN(Slots);