デザインスクリプト
デザインスクリプトは、デザインファイルの印刷出力を再記号化するための命令が指定されたASCIIファイルです。命令は、デザインスクリプト内の文に含まれています。デザインスクリプトは「メモ帳」のようなテキストエディタを使用して作成または編集できます。
デザインスクリプトは、比較文と代入文という2種類の文から成ります。比較文は、特定の条件に照らして1つの要素属性をテストします。属性がその条件に一致した場合、次に代入文が要素の属性を変更することで要素を修正します。
デザインスクリプトは、デザインファイルからの要素が印刷システムによって処理される際、要素を再記号化します。たとえば、要素が特定の画層にあるかどうかを確認し、特定の画層にあれば、要素の表示属性を再記号化するというデザインスクリプトを書くことができます。
プロットするデザインまたは参照ファイルに対して画層ごとの線属性を有効化する場合、その画層ごとの線属性はデザインスクリプトの実行前に適用されます。デザインスクリプトは、ファイルに対して有効化されているその他すべての表示属性より優先されます。たとえば、デザインスクリプトによって塗り潰された要素は、area_fill表示属性が無効化されていても、常に塗り潰されてプロットされます。
次のデザインスクリプトの例は、デザインファイルの再記号化で用いられている2つの方法であるテキスト置換とスクリーニングを示しています。1つ目の例は、DGNファイル内で特定のテキスト文字列要素を検索して他の文字列に置き換える方法を示しています。例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