Title: Writing InterPlot Design Scripts
1Writing InterPlot Design Scripts
- Kevin van Haaren
- HNTB Corporation
- kvanhaaren_at_hntb.com
2Agenda
- What is a Design Script?
- How design scripts are processed
- Statements
- Operators
- Expressions
- General rules for writing design scripts
- Common mistakes
- Useful Commands
- Questions
3What are Design Scripts?
- A design script is a text file containing a
series of instructions that the InterPlot server
can use to change the appearance of elements for
printing - Also known as pen tables, not to be confused with
MicroStation Pen Tables used with MicroStation
Print/Plot
4How Design Scripts are Processed
- Top Down Processing
- Instructions lower in list can override
instructions higher in list - Example
lines of color 10 and style 0 plot yellow IF
(COLOR 10) THEN COLOR black ENDIF IF
(STYLE 0) THEN COLOR yellow ENDIF
5Statements
- Design Scripts are a series of statements telling
InterPlot how to plot elements - Statements consist of combinations of keywords,
constants, operators, and expressions - Comment Statements
- Start with !, , or to end of line is a comment
- This is a comment
- Can be on same line with another statement
- COLOR(0,0,0) Set color to black
- comments do not affect processing speed (stripped
out at compile time)
6Statements
- Assignment Assign a value to something
- Keyword Value
- COLOR(0,0,0)
- IGNORE_ELEMENTTRUE
- THICKNESS .0125
7Comparison Statements
- Comparison Compare two items
- if-then-else-endif
- Switch
IF (COLOR 10) THEN COLOR (100,100,100)
thickness .125 fill_color red ENDIF
SWITCH (COLOR) CASE 10 ? COLOR(100,100,100) EN
DSWITCH
8Statements
- Stop statement
- A Stop statement causes the design script to halt
further processing of script for this element - Very hard to debug -- avoid
9Operators
- Arithmetic Operators
- - (Negate, i.e. -10)
- , -, , / (standard math)
- Example
- PRIORITY ((- FILE) 1000) LEVEL
- Sets priority of elements to the level for master
file (FILE 0) - Sets priority of elements in reference file 1
between -999 and -937 - Priority of elements in reference file 2 between
-1999 and -1937
10Operators
- String Concatenation with
- Example
replace string containing LONGDATE with date
in format Monday January 1, 2002 switch
(characters) case 'longdate' ? characters
day_name" "month_name" "day_number",
"year endswitch
11Operators
- Relational Operators
- Used to compare two values
- Valid operators
- .EQ., EQ, Tests equality
- .NE, NE, ltgt Tests inequality
- .GE., GE, gt Greater than or equal
- .LE., LE, lt Less than or equal
- .GT., GT, gt Greater than
- .LT., LT, lt Less than
12Operators
- String Comparison wild cards
- Match zero or more of any character
- ? Match one occurrence of any character
- \ Treat next character as regular character
(i.e. \? for ?, \ for )
13Expressions
- Logical Expressions
- Used to compound relational tests
- .AND., AND,
- .OR., OR,
- .NOT., NOT
- Example
14Expressions
All color 10 solid line elements will be
green IF ((COLOR 10) AND (STYLE 0))
THEN COLOR green ENDIF
All color 10 elements NOT solid line style
will be red IF ((COLOR 10) AND NOT (STYLE
0)) THEN COLOR red ENDIF
15Expressions
- List Expressions
- .IN., IN - test for inclusion in a list
- .NI., NI - test for exclusion from a list
- Lists
- inclusive ranges separated with
- 10-60 range 10 through 60, including 10 and 60
- individual elements separated with ,
- 10,15,20 elements 10, 15 20 individually
16Expressions
Screen elements on levels 1-10 IF (LEVEL IN
1-10) THEN COLOR(75,75,75) ENDIF
Screen elements not on levels 1-4 IF (LEVEL NI
1-4) THEN COLOR(75,75,75) ENDIF
17General Rules for Design Scripts
- Start with a template
- Not a Design Script from a previous job
- Hard to keep track of stuff from current job and
old job - Format for readability
- Lots of comments
- Indenting
- General to Specific
- The more elements an instruction will change, the
higher in the Design Script it should appear - Statements affecting all elements in all files at
very top - Placing general statements at bottom of file may
override more specific statements earlier in the
design script
18General Rules for Design Scripts
- Group related statements
- All changes to master file under one section
- IF (FILE 0) THEN
GOOD Only changes master file IF (file 0)
then if (level .in. 1-10) then prioirty
100 endif endif
BAD Changes all files IF (level .in. 1-10)
then prioirty 100 endif
19Rules of Thumb Ref Files
- Group settings for reference files under logical
name.
BAD IF (lname .eq. ROW) then priority
100 endif if (lname .eq. hatch) then priority
90 endif if (lname .eq. ROW) then priority
80 color(100,100,100) endif
GOOD IF (lname .eq. ROW) then priority
100 color(100,100,100) IF (LEVEL 10)
THEN PRIORITY120 COLOR (25,25,25) ENDIF en
dif if (lname .eq. hatch) then priority
90 endif
20Rules of Thumb Ref Files
- Settings for multiple reference files should come
before settings for specific reference files
IF (lname .eq. hatch) then prioirty
100 color(100,100,100) endif if (lname .eq.
hatch-row) then priority 110 color(75,75,75
) endif
21Rules of Thumb - Comparisons
- Avoid long if-then-else if-else if constructs
- Difficult logic
- No more than one else if per comparison
- Use Switch statement instead
22Rules of Thumb - Comparisons
BAD hard to read, contains logic flaw IF
((lname .eq. ROW) and (level .in. 1-10))
then prioirty 100 else if (level .in. 11-20)
then priority 50 endif
GOOD IF ((lname .eq. ROW) then if (level .in.
1-10) then prioirty 100 else if (level .in.
11-20) then priority 50 endif endif
23Rules of Thumb - Comparisons
BAD IF (level 1) then priority 40 else if
(level 2) then priority 50 else if (level
3) then priority 60 else if (level 4)
then priority 70 else priority 80 endif
GOOD switch (level) case 1 ? priority
40 case 2 ? priority 50 case 3 ? priority
60 case 4 ? priority 70 default
? priority 80 endif
24Common Mistakes
- Unless specified, statement applied to all
elements that meet criteria
GOOD change color level 1 in master only if
(file 0) then if (level 1) then color
green endif endif
BAD This applies to all elements on all
level 1s. Usually only want to apply to
level 1 in master IF (level 1) then color
green endif
25Common Mistakes
- fill_color COLOR turns on fill for shape
- translucent_fill has same effect
BAD all closed shapes/complex shapes will fill
red, even if not drawn as filled shape if
(level 1) then fill_color red endif
GOOD only fill red on shapes drawn filled if
((level 1) and (area_fill true))
then fill_color red endif
26Common Mistakes
- Not turning off (or plotting white) plot outlines
- different plotters handle lines printing at edge
of paper different ways - Some shift one direction, others shift the other
way - Plot rotation can affect which direction the
shift is
GOOD dont plot border outlines if ((lname
bord) and (level 63)) then ignore_element
true endif
27Common Mistakes
- Not turning off plot outlines
- HP 1055 IP CMYK
GOOD dont plot border outlines if ((lname
bord) and (level 63)) then color
(0,0,0) endif
28Common Mistakes
- Units
- Numbers in Design Scripts are in units specified
in IPlot dialog box - Set IPlot dialog box to meters or inches and
above weights will be very thick
weight_base .1 units should be
mm weight_delta .1 units should be mm
29Common Mistakes
- Translucent Fills
- Translucent fills only work on InterPlot Plot
Drivers - Wont work on PostScript or HPGL/2 devices
- Usually unnecessary, same affect by properly
assigning priorities - MicroStation XM Transparancies change this
30Useful Commands
- cellname
- if (cellname test) then
- cls_name custom line style name
- if (cls_name Diamond ) then
- cls_name New Diamond
- cls_scale custom line style scale
- cls_scale 20
- tag_character
- Type Named types (instead of numbers)
- arc, assoc_dim, cell, complex_shape, etc...
31Useful Commands
- boundary_color
- can set outline color of shape seperately from
fill_color - cool on text (white outline with black fill)
- doesnt always work (check font)
- pattern
- not cell hatches, built into interplot
- pattern_color
- priority
- can go from -1,000,000 to 1,000,000
32Useful Commands
- thickness
- specify exact thickness of element
- useful for odd standards where weight_base
weight_delta dont work - useful for overriding weight_base weight_delta
33PDF Commands
- All normal commands apply
- Keywords for Active Renditions used in making
PDFs
34InterPlot Help File
- More detailed information at
- StartAll ProgramsInterPlot UtilitiesInterPlot
Reference Help - Plotting MicroStation Data section
- Using Design Scripts/Pen Tables
35Questions