home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1996 April
/
BYER_0496.iso
/
buisapp
/
cad
/
ecad.ma_
/
ecad.ma
Wrap
Text File
|
1995-07-03
|
3KB
|
210 lines
\\* sample EasyCAD for Windows macros *\\
\\* only text betwen MACRO/ENDM gets executed
macro match
gp p1 ^DPick entity to match:
setlayer like;p1
setstyle like;p1
color like;p1
endm
macro matchfont
tspecf like;^DPick text to match:
endm
macro bricks
newstyle transparent bricks
1+2+4;;;;9;;;
setstyle transparent bricks
box ^DBox corner:
endm
\\* Demonstrates select by commands in macros
Draw something, then type spokes! *\\
macro spokes
selsave
selbyp
cary 7;;@0,0;@0,0;
selrest
zext
endm
\\*Divide macro (updated from EasyCAD 2.72) *\\
macro DIVIDE
GP PickPt ^DSelect entity:
GN Seg ^DNumber of segments?
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
endm
\\* try SPIRAL 0,0 10 2 0.02
macro SPIRAL
gp p1 ^Dorigin
gv angd ^Dangle delta
gv dist ^Dlength
gv distd ^Drate
gv ang 0
point p1;
:Again
line @0,0;<ang,dist;
gv dist dist-distd
gv ang ang+angd
IFP dist again
zext
ENDM
//* Macros that test various text commands
and macro facilities *//
macro testlines
gp P1 ^DLine start:
gp P2 ^DLine end:
gdist $D P1 P2
gbrng $A P1 P2
line P1 P2 ~$A,$D ~$A,$D ~$A,$D;
endm
macro testpart
gp P1 ^D Insert at:
partm #square .5 45 P1;
endm
macro test2
gv a ^D
gv b ^D
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
endm
macro test3
gp _P1 ^DPut box at:
getx a _P1
gety b _P1
setstyle solid fill
box a,b b,a
zext
endm
macro TestText
gp p1 ^DText origin:
tspech 0.5
tspecf Times New Roman
tspecj 4
tspecs 16+32
textm Middle-centered bold italic text?
P1
endm
Macro TestVarText
gp p1 ^DText origin:
gw UName Charles
tspech 0.5
tspecf Courier
textm UName
P1
endm
//* These two drive Select dialogs w/single
keypresses (but the SelBy commands
as shown in Spokes, above, are easier *//
macro MoveAll
move AD 0,0 3,2
endm
macro MoveGreen
move C 1
D0,0 -3,-2
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