home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1996 April / BYER_0496.iso / buisapp / cad / ecad.ma_ / ecad.ma
Text File  |  1995-07-03  |  3KB  |  210 lines

  1. \\* sample EasyCAD for Windows macros *\\
  2. \\* only text betwen MACRO/ENDM gets executed
  3.  
  4. macro match
  5. gp p1 ^DPick entity to match:
  6. setlayer like;p1
  7. setstyle like;p1
  8. color like;p1
  9. endm
  10.  
  11. macro matchfont
  12. tspecf like;^DPick text to match:
  13. endm
  14.  
  15. macro bricks
  16. newstyle transparent bricks
  17. 1+2+4;;;;9;;;
  18. setstyle transparent bricks
  19. box ^DBox corner:
  20. endm
  21.  
  22. \\* Demonstrates select by commands in macros
  23.      Draw something, then type spokes! *\\
  24. macro spokes
  25. selsave
  26. selbyp
  27. cary 7;;@0,0;@0,0;
  28. selrest
  29. zext
  30. endm
  31.  
  32. \\*Divide macro (updated from EasyCAD 2.72) *\\
  33. macro DIVIDE
  34. GP PickPt ^DSelect entity:
  35. GN Seg ^DNumber of segments?
  36. IFZ Seg Done
  37. GV Spc 100/Seg
  38. GN Seg Seg-1
  39. IFZ Seg Done
  40. GV Pct 0
  41. GBRNG Ang % 0 PickPt % 100 PickPt
  42. GDIST Len % 0 PickPt % 100 PickPt
  43. GV Ang Ang+90
  44. GV Len Len/20
  45. :Loop
  46. GV Pct Pct+Spc
  47. GP InsPt % Pct PickPt
  48. line REF InsPt <Ang,len/2 ~180,Len;
  49. GN Seg Seg-1
  50. IFP Seg Loop
  51. :Done
  52. endm
  53.  
  54. \\* try SPIRAL 0,0 10 2 0.02
  55. macro SPIRAL
  56. gp p1 ^Dorigin
  57. gv angd ^Dangle delta
  58. gv dist ^Dlength
  59. gv distd ^Drate
  60. gv ang 0
  61. point p1;
  62. :Again
  63. line @0,0;<ang,dist;
  64. gv dist dist-distd
  65. gv ang ang+angd
  66. IFP dist again
  67. zext
  68. ENDM
  69.  
  70. //* Macros that test various text commands
  71.     and macro facilities *//
  72.  
  73. macro testlines
  74. gp P1 ^DLine start:
  75. gp P2 ^DLine end:
  76. gdist $D P1 P2
  77. gbrng $A P1 P2
  78. line P1 P2 ~$A,$D ~$A,$D ~$A,$D;
  79. endm
  80.  
  81. macro testpart
  82. gp P1 ^D Insert at:
  83. partm #square .5 45 P1;
  84. endm
  85.  
  86. macro test2
  87. gv a ^D
  88. gv b ^D
  89. gv x1 a+b
  90. gv y1 a-b
  91. gv x2 0-a-b
  92. gv y2 b-a
  93. gp p1 x1,y1
  94. gp p2 x2,y2
  95. box p1 p2
  96. zext
  97. endm
  98.  
  99. macro test3
  100. gp _P1 ^DPut box at:
  101. getx a _P1
  102. gety b _P1
  103. setstyle solid fill
  104. box a,b b,a
  105. zext
  106. endm
  107.  
  108. macro TestText
  109. gp p1 ^DText origin:
  110. tspech 0.5
  111. tspecf Times New Roman
  112. tspecj 4
  113. tspecs 16+32
  114. textm Middle-centered bold italic text?
  115. P1
  116. endm
  117.  
  118. Macro TestVarText
  119. gp p1 ^DText origin:
  120. gw UName Charles
  121. tspech 0.5
  122. tspecf Courier
  123. textm UName
  124. P1
  125. endm
  126.  
  127.  
  128. //* These two drive Select dialogs w/single
  129.      keypresses (but the SelBy commands
  130.      as shown in Spokes, above, are easier *//
  131.  
  132. macro MoveAll
  133. move AD 0,0 3,2
  134. endm
  135.  
  136. macro MoveGreen
  137. move C 1
  138. D0,0 -3,-2
  139. endm
  140.  
  141. //* Assigning values and commands 
  142.     to function keys. Note: fkeys can also 
  143.     be defined through menu file. *//
  144.  
  145. MACRO SF2
  146. color 2
  147. ENDM
  148.  
  149. MACRO CF3
  150. color 3
  151. ENDM
  152.  
  153. MACRO SCF12
  154. color red
  155. ENDM
  156.  
  157. MACRO aaa
  158. LINE ^Dstart:
  159. @1,1;
  160. ENDM
  161.  
  162. MACRO Q
  163. 4,5
  164. ENDM
  165.  
  166. MACRO gc
  167. COLOR ^D
  168. ENDM
  169.  
  170. \* Try "a red" for nested macros, live input, that input expanded
  171. \* Try "a" then pick color in cbar 
  172.  
  173. MACRO a
  174. gc
  175. LINE 2,2 10,2;
  176. ENDM
  177.  
  178. \* Proof that macro "c" picks the right :CC label
  179.  
  180. MACRO b
  181. line 3,3 4,4;
  182. :CC
  183. line 4,3 5,5;
  184. ENDM
  185.  
  186. \* fwd & back GOTO & EXITM works if line drawn in color 10
  187. \* omit ; after line cmd and EXITM is gobbled - endless loop
  188.  
  189. MACRO c
  190. color 8
  191. GOTO CC
  192. :BB;line 2,2 10,2;
  193. EXITM
  194. :CC
  195. COLOR 10
  196. GO BB
  197. ENDM
  198.  
  199. \* red,green,blue text macros for use with COLOR command
  200.  
  201. macro red
  202. 2
  203. endm
  204. macro blue
  205. 3
  206. endm
  207. macro green
  208. 1
  209. endm
  210.