设计脚本是 ASCII 文件,其中包含用于重新符号化设计文件打印输出的指令。这些指令包含在设计脚本内的语句中。设计脚本通过记事本等文本编辑器进行创建或修改。
设计脚本包含两种语句:比较语句和赋值语句。比较语句根据指定的条件测试单个元素特性。如果此特性满足该条件,则赋值语句通过更改元素的特性对元素进行修改。
设计脚本将重新符号化设计文件中经过打印系统处理的元素。例如,您可以编写设计脚本来检查该元素,看看它是否在特定的层上。如果是,则重新符号化该元素的显示特性。
如果已为要出图的设计或参考文件启用层线符,则在执行设计脚本之前先应用层线符。设计脚本将替代为该文件启用的任何其他显示特性。例如,即使 area_fill 显示特性已禁用,设计脚本填充的元素仍将始终填充出图。
以下设计脚本示例说明了用于重新符号化设计文件的两种技巧:文本替换和淡显。第一个示例说明了如何在 dtf 文件中搜索特定的文本字符串元素并将其替换为另一个字符串。在示例 1 中,设计文件的名称和当前日期分别替换文本字符串 $DGNFILENAME$ 和 mmddyy。
示例 1:
! NAME
! txtsubst.pen
!
! DESCRIPTION
! Design Script to substitute the design filename and
! the current date for the strings
! $DGNFILENAME$ and mmddyy, respectively.
!
! If the current element is a text element, see if
! it contains one of the special place-holder
! strings. If it does, substitute an
! automatically-generated string for it.
if (type == text) then
if (characters == '$DGNFILENAME$') then
characters = ip_design
else if (characters == 'mmddyy') then
characters = date
endif
endif
示例 2 说明了如何通过以浅灰色出图来淡显特定元素。以下设计脚本通过淡显所有其他元素,高亮显示了层 15 上的绘图图纸、文本和家具。
示例 2:
! NAME
! screen.pen
!
! DESCRIPTION
! This design script demonstrates screening.
!
! Highlight all text, the sheet border (Level 1),
! and furniture (Level 15) by plotting it in pure
! black on top of all other elements. Screen
! (de-emphasize) all other elements by plotting
! them with a gray dither (halftone) pattern.
!
if ((level .in. 1, 15) || (type == text)) then
color = (0, 0, 0) ! R=0, G=0, B=0 is pure black
priority = 100
else
color = (200, 200, 200) ! R=200, G=200, B=200 is light gray
weight = 4
priority = 10
endif