home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 June A
/
Pcwk6A98.iso
/
Wtestowe
/
Easycad
/
ECAD.MA_
/
ECAD.MA
Wrap
Text File
|
1995-11-29
|
3KB
|
261 lines
\\* sample EasyCAD for Windows macros *\\
\\* only text betwen MACRO/ENDM gets executed
macro match
ecoff
gp p1 ^DPick entity to match:
IFERR done
setlayer like;p1
setstyle like;p1
color like;p1
:done
econ
endm
macro matchfont
ecoff
tspecf like;^DPick text to match:
econ
endm
macro bricks
ecoff
newstyle transparent bricks
1+2+4;;;;9;;;
setstyle transparent bricks
box ^DBox corner:
econ
endm
\\* Demonstrates select by commands in macros
Draw something, then type spokes! *\\
macro spokes
ecoff
selsave
selbyp
cary 7;;@0,0;@0,0;
selrest
zext
econ
endm
\\*Divide macro (updated from EasyCAD 2.72) *\\
macro DIVIDE
ecoff
GP PickPt ^DSelect entity:
IFERR Done
GN Seg ^DNumber of segments?
IFERR Done
IFZ Seg Done
GV Spc 100/Seg
GN Seg Seg-1
IFZ Seg Done
GV Pct 0
GBRNG Ang % 0 PickPt % 100 PickPt
GDIST Len % 0 PickPt % 100 PickPt
GV Ang Ang+90
GV Len Len/20
:Loop
GV Pct Pct+Spc
GP InsPt % Pct PickPt
line REF InsPt <Ang,len/2 ~180,Len;
GN Seg Seg-1
IFP Seg Loop
:Done
econ
endm
\\* try SPIRAL 0,0 10 2 0.02
macro SPIRAL
ecoff
gp p1 ^Dorigin
IFERR Done
gv angd ^Dangle delta
IFERR Done
gv dist ^Dlength
IFERR Done
gv distd ^Drate
IFERR Done
gv ang 0
point p1;
:Again
line @0,0;<ang,dist;
gv dist dist-distd
gv ang ang+angd
IFP dist again
zext
:Done
econ
ENDM
//* Macros that test various text commands
and macro facilities *//
macro testlines
ecoff
gp P1 ^DLine start:
IFERR Done
gp P2 ^DLine end:
IFERR Done
gdist $D P1 P2
gbrng $A P1 P2
line P1 P2 ~$A,$D ~$A,$D ~$A,$D;
:Done
econ
endm
macro testpart
ecoff
gp P1 ^D Insert at:
IFERR Done
partm #square .5 45 P1;
:Done
econ
endm
macro test2
gv a ^D
IFERR quit
gv b ^D
IFERR quit
ecoff
gv x1 a+b
gv y1 a-b
gv x2 0-a-b
gv y2 b-a
gp p1 x1,y1
gp p2 x2,y2
box p1 p2
zext
:quit
econ
endm
macro test3
ecoff
gp _P1 ^DPut box at:
IFERR Done
getx a _P1
gety b _P1
setstyle solid fill
box a,b b,a
zext
:Done
econ
endm
macro TestText
ecoff
gp p1 ^DText origin:
IFERR Done
tspech 0.5
tspecf Times New Roman
tspecj 4
tspecs 16+32
textm Middle-centered bold italic text?
P1
:Done
econ
endm
Macro TestVarText
ecoff
gp p1 ^DText origin:
IFERR Done
gw UName Charles
tspech 0.5
tspecf Courier
textm UName
P1
:Done
econ
endm
//* These two drive Select dialogs w/single
keypresses (but the SelBy commands
as shown in Spokes, above, are easier *//
macro MoveAll
ecoff
move AD 0,0 3,2
econ
endm
macro MoveGreen
ecoff
move C 1
D0,0 -3,-2
econ
endm
//* Assigning values and commands
to function keys. Note: fkeys can also
be defined through menu file. *//
MACRO SF2
color 2
ENDM
MACRO CF3
color 3
ENDM
MACRO SCF12
color red
ENDM
MACRO aaa
LINE ^Dstart:
@1,1;
ENDM
MACRO Q
4,5
ENDM
MACRO gc
COLOR ^D
ENDM
\* Try "a red" for nested macros, live input, that input expanded
\* Try "a" then pick color in cbar
MACRO a
gc
LINE 2,2 10,2;
ENDM
\* Proof that macro "c" picks the right :CC label
MACRO b
line 3,3 4,4;
:CC
line 4,3 5,5;
ENDM
\* fwd & back GOTO & EXITM works if line drawn in color 10
\* omit ; after line cmd and EXITM is gobbled - endless loop
MACRO c
color 8
GOTO CC
:BB;line 2,2 10,2;
EXITM
:CC
COLOR 10
GO BB
ENDM
\* red,green,blue text macros for use with COLOR command
macro red
2
endm
macro blue
3
endm
macro green
1
endm