RECSCRIPT、STOPSCRIPT、脚本
“记录脚本”对话框随即打开。
例如:
: RECTANG
Select first corner of rectangle or [Chamfer/Fillet/Rotated/Square/Elevation/Thickness/Width of line/Area/Dimensions]: 0,0
Other corner of rectangle: 36,24: ZOOM
Zoom [zoom In/zoom Out/All/Center/Dynamic/Extents/Left/Previous/Right/Scale (nx/nxp)/Window/OBject] <Scale (nX/nXP)>: E注意:您可以在记录时使用鼠标在执行命令时拾取绘图中的点。THCAD®将拾取点记录为x,y坐标。
您可以使用 SCRIPT 命令运行脚本,如下所示:
脚本会立即绘制矩形,然后将绘图缩放到新绘制的边框的范围。
虽然THCAD®具有用于创建和运行脚本的命令,但它没有用于编辑脚本的命令。如果要更改 RECTANG 命令使用的坐标,则必须使用文本编辑器编辑脚本文件,例如 Windows 中的记事本、Linux 中的文本编辑或 macOS 中的文本编辑。
请注意您在脚本录制会话期间输入的命令和选项:
更改命令如下:
-层
做
边境
颜色
红
▄ <-- 一行空行
▄ <-- 第二行空行
有四个命令专门与脚本相关。事实上,这些命令对于任何其他目的都毫无用处。此外,THCAD®具有用于记录脚本的RECSCRIPT命令,如本章前面所述。
四个基本命令是:
SCRIPTThe SCRIPT command performs double-duty: (1) it loads a script file and (2) immediately begins running it.Note: Remember to turn off (set to 0) the FILEDIA system variable so that the prompts appear at the Command line, instead of the dialog box.
RSCRIPTShort for "repeat script", this command reruns whatever script is currently loaded inTHCAD®. A great way to create infinite loops.
RESUMEThis command resumes a paused script file. Pause a script file by pressing the Backspace key.
DELAYTo create a pause in a script file without human intervention, use the DELAY command along with a number. The number specifies the pause in milliseconds, where 1,000 milliseconds equal one second.Note: The minimum delay is 1 millisecond. The maximum is 32767 milliseconds, which is just under 33 seconds.The DELAY command is used in a script file to wait while a slide file is displayed or to slow down the script file enough for humans to watch the process.
In addition to the script-specific commands, there are some special characters and keys.
输入 -- (空格)最重要的特殊字符是不可见的。空格和回车符(或行尾)都等效于按空格键或 Enter 键时的回车符。事实上,两者是可以互换的。但棘手的部分是它们是看不见的。有时,编写脚本需要大量空格,因为该命令需要连续按几次 Enter 键。ATTEDIT 命令就是一个很好的例子:; Edit the attributes one at a time: attedit 1,2attedit 和坐标 1,2 之间有多少个空格?因此,最好每行放置一个脚本项,如下所示:; Edit the attributes one at a time: attedit 1,2现在更容易计算四个空格,因为每行有一个空格。
评论--;分号允许您在脚本文件中插入注释。注意:THCAD®忽略分号后面的任何内容。
透明 -- '脚本可以在命令期间透明地运行。只需在 SCRIPT 命令前面加上撇号,即可在另一个命令处于活动状态时运行脚本,如下所示:: LINE Start of line: 'script Script to run: filenameTHCAD®的所有四个特定于脚本的命令都是透明的,甚至包括DELAY命令,它允许您在命令作期间创建延迟。
暂停 -- 退格键表示前面提到的用于暂停脚本文件的键。
停止 -- esc停止脚本文件在其轨道上失效。使用 RSCRIPT 命令从头开始重新启动它。