赋值关键字
以下关键字描述包括关键字函数的简要介绍、受关键字影响的元素类型(如果适用)、有效数据类型(如果适用)以及有关如何使用关键字的示例。赋值关键字后面的部分说明了如何在赋值语句中指定颜色。
area_fill
对于支持多边形填充的绘图机,area_fill 关键字在设置为 true 时绘制闭合元素出图。设置赋值关键字 fill_color 或 pattern 意味着将 area_fill 设置为 true。area_fill 关键字可用于出图原本以轮廓填充方式出图的元素。任何闭合元素(除文本外)都可以使用此关键字进行控制,包括闭合 b 样条曲线、复杂形状、椭圆和形状。
语法:
area_fill = true area_fill = false
示例:
! ! Area fill all shapes. ! if (type == shape) then area_fill = true endif
boundary_color
boundary_color 关键字用于指定某个区域填充或图案填充的多边形的边界颜色。Boundary_color 只影响 border_display 设置为 true 的填充元素。有关指定颜色的详细描述,请参阅本部分末尾的在赋值语句中指定颜色。
语法:
boundary_color = integer
(其中 integer 是 0 到 255 范围内的一个颜色索引)
boundary_color = "string"
(其中 string 是颜色库中的一个颜色名)
boundary_color = (R,G,B)
(其中 RGB 在 0 到 255 的范围内)
示例:
! ! Set boundary_color and boundary_display for ! shapes on level 7. ! if ((type == shape) and (level == 7)) then area_fill = true color = 'blue' boundary_display = true boundary_color = 'red' endif
boundary_display
对于在设计文件中填充或在设计脚本中使用 area_fill 关键字填充的元素,boundary_display 关键字指定是否对填充多边形的边界出图。boundary_display 关键字对未填充的元素没有影响。
语法:
boundary_display = true boundary_display = false
示例:
! ! Set boundary_color and boundary_display for ! shapes on level 7. ! if ((type == shape) and (level == 7)) then area_fill = true color = 'blue' boundary_display = true boundary_color = 'red' endif
case_sensitive
case_sensitive 关键字确定在使用 characters 比较关键字进行字符串比较是否注重字母大小写。缺省值为 false。
语法:
case_sensitive = true case_sensitive = false
示例:
! !Replace text elements having !characters "TITLE" with all-caps, and !replace "Title" with first letter caps title. ! case_sensitive = true if (characters == "TITLE") then characters = "FIRST FLOOR DESIGN" else if (characters == "Title") then characters = "First Floor Design" endif
characters
characters 关键字让您将文本元素中的字符串替换为新字符串。通过将文本元素放在设计文件中充当占位符,稍后可以使用有用信息(例如文件的出图日期或设计文件名)来替换这些字符串。如果新字符串比原始字符串短,则用空格填充。如果新字符串较长,则原始字符串将扩展以容纳额外字符。
替换文本可以是几个标记的值:
以下关键字表示可用于注明出图的打印定义的值。
关键字 |
值 |
---|---|
am_pm |
时间:上午或下午。(示例:AM) |
date |
执行打印处理以进行预览或打印的日期。(示例:05-APR-1996) |
day_abbreviation |
一周某天的三字符缩写。(示例:Fri) |
day_name |
一周某天的全名。(示例:Friday) |
day_number |
以数字格式表示的某天。(示例:05) |
dgnspec |
主设计文件的文件规范。(示例:C:\MYPROJ\E1.DGN) |
hour |
执行打印处理以进行预览或打印的小时数。(示例:11) |
hour_12 |
基于 12 小时周期的小时数。(示例:05) |
hour_24 |
基于 24 小时周期的小时数。(示例:17) |
ip_color_table |
存储在设计文件中的颜色表字符串。(示例:C:\MISC\COLOR.CTB) |
ip_design |
设计文件名。(示例:C:\MYPROJ\PLAN.DGN) |
ip_design_script |
与出图作业相关联的设计脚本的名称。如果文件是特征表,则返回空白。 |
ip_feature_table |
与出图作业相关联的特征表的名称。如果文件是设计脚本,则返回空白。 |
ip_logical_name |
当前元素的参考逻辑名称。(示例:C:\PROJ\BORDER.DGN) |
ip_mirror |
存储在打印定义中的镜像设置。有效值为 X、Y、BOTH 或 NONE。 |
ip_model |
在打印定义中指定的模型。(示例:sheetone) |
ip_origin |
X 和 Y 原点(采用由 ip_units 关键字指定的单位)。(示例:1.500000,2.000000) |
ip_origin_x |
X 原点(采用由 ip_units 指定的单位)。(示例:1.500000) |
ip_origin_y |
Y 原点(采用由 ip_units 指定的单位)。(示例:5.000000) |
ip_pen_table |
与出图作业相关联的设计脚本的名称。 |
ip_plot_rescale |
打印定义中的 X 和 Y 出图重新缩放值。(示例:3.000000,2.000000) |
ip_plot_rescale_x |
打印定义中的 X 出图重新缩放值。(示例:3.000000) |
ip_plot_rescale_y |
打印定义中的 Y 出图重新缩放值。(示例:2.000000) |
ip_project |
在打印定义中指定的项目。(示例:Baldwinsville) |
ip_queue |
返回 Windows 系统打印机的名称(如果已定义),否则返回一个空字符串。 |
ip_ref_filename |
当前元素的完整参考文件规范。(示例:C:\PROJ\FLOOR.DGN) |
ip_rotation |
出图旋转,指定为以度为单位的角度,范围为 0 到 360。(示例: 45.000000) |
ip_scale |
MS_PLT_SCALE_METHOD 指定格式的出图比例。也返回与 MS_PLTSCALE_SHORT 计算变量相同的值。(示例:4.000000:1.000000) |
ip_short_color_table |
不带目录的颜色表名称。(示例:COLORS.TBL) |
ip_short_design |
不带目录名的主文件名。(示例:FLOOR27.DGN) |
ip_short_design_script |
不带目录的设计脚本名称。(示例:STANDARD.PEN) |
ip_short_pen_table |
不带目录的设计脚本名称。(示例:STANDARD.PEN) |
ip_short_feature_table |
不带目录的特征表名称。(示例:DECATUR.FTB) |
ip_short_ref_filename |
不带当前元素文件夹的参考文件名。(示例:FLOOR.DGN) |
ip_short_scale |
返回与 ip_scale 相同的值。 |
ip_units |
为大小和原点等值指定的单位。(示例:英寸) |
ip_view |
视图名称或视图号。(示例:2) |
ip_viewgroup |
当前视图组。(示例:sheetone 视图) |
ip_workspace |
激活工作空间的名称,例如 Example。 |
ip_workset |
激活工作集的名称,例如 Civil。 |
ip_xsize |
出图的 X 向大小(采用由 ip_units 指定的单位)。(示例:34.000000) |
ip_xysize |
出图的 X 和 Y 向大小(采用由 ip_units 指定的单位)。(示例:34.000000, 44.000000) |
ip_ysize |
出图的 Y 向大小(采用由 ip_units 指定的单位)。(示例:75.000000) |
long_date |
长字符格式的日期。(示例:Friday, April 05, 1996) |
long_time |
执行打印处理以进行预览或打印的长时间格式的时间。(示例:11:59:17 PM) |
minute |
执行打印处理以进行预览或打印的分钟数。(示例:59) |
month_abbreviation |
月份的三字符缩写。(示例:Apr) |
month_name |
月份的全名。(示例:April) |
month_number |
月份的数字。(示例:04) |
ms_pen_table |
与出图作业相关联的笔表的名称。如果未定义笔表,则返回空字符串。(示例:C:\PROJ\E5.TBL) |
ms_pltcfg_file |
|
ms_short_pltcfg_file |
不带目录的打印机驱动程序配置文件。(示例:PDF.PLTCFG) |
ms_short_pen_table |
不带目录的笔表名称。(示例:DECATUR.TBL) |
page_number |
文档中出图的序号。 |
plan_set_name |
打印集名称的文件规范。(示例:C:\plans\myplan.pset) |
plan_set_short_name |
不带文件夹名称的打印集名称。(示例:myplan.pset) |
plot_name |
打印对话框或打印管理器中的打印定义名称。(示例:border)出图的名称。 |
second |
秒数。(示例:17) |
short_date |
数字格式的日期。(示例:04/05/96) |
short_time |
短时间格式的时间。(示例:11:59) |
short_year |
两位数格式的年份。(示例:96) |
sytime |
执行打印处理以进行预览或打印的系统日期和时间。(示例:5-APR-1996 09:47) |
time |
执行打印处理以进行预览或打印的时间。(示例:09:47) |
total_pages |
文档中出图的总数。 |
username |
提交预览或打印的用户的用户名。(示例:jdoe) |
year |
执行打印处理以进行预览或打印的四位数格式的年份。(示例:1996) |
语法:
characters = "string"
(其中 string 是上表中描述的任何有效字符串或关键字)
示例 1:
! ! Change "preliminary" to "final" for text on ! level 10. ! if (characters eq "preliminary" and type==text and level==10) then characters = "final" endif
示例 2:
! Replace the text string "PAGE" with ! a new string that contains the actual ! page number and total sheets in the set. if (characters == "PAGE") then characters = PAGE_NUMBER + "of" + TOTAL_PAGES endif
示例 3:
! ! Replace the string "Project Number" with ! the actual project number stored in ! the PROJECT_NUM environment variable. ! if (characters == "Project Number") then envr_variable = "PROJECT_NUM" characters = envr_value endif
示例 4:
! Substitute the queue name from the print definition for ! the text string "$$queue$$." ! if ((type == text) and (characters == '$$queue$$')) then characters = ip_queue endif
示例 5:
! Substitute the Windows Username for the ! text string "$USER$" and include a literal ! text sting in the replacement string. if ((type == text) and (characters == "$USER$")) then characters = "User:$(USERNAME)" endif
示例 6:
! Substitute the value of the Named Expression ! _Author for the text string $AUTHOR$. if ((type == text) and (characters == "$AUTHOR$")) then characters = "<expr?name=_Author>" endif
class
class 关键字更改元素的类。如果在打印定义中或通过等效的 Bentley Descartes 显示标志禁用了新类,则元素将不会出图。
语法:
class = integer
(其中 integer 的取值范围为 0 到 6)
class = constant
其中 constant 为以下之一:
0 primary |
1 pattern_component |
2 construction |
3 dimension |
4 primary_rule |
5 linear_pattern |
6 construction_rule |
示例:
! ! Change construction class elements on level 5 ! to primary class elements. if ((class == construction) and (level == 5)) then class = primary endif
cls_end_width
cls_end_width 关键字设置与当前元素相关联的自定义线型的结尾宽度(采用主设计文件单位)。当为 cls_origin_width 和 cls_end_width 指定相同的值时,线型的划线笔划宽度均匀地变窄或变宽。当为这两个关键字指定不同的值时,划线笔划由粗变细。
宽度是自定义线型的每个划线笔划的可选属性。此关键字对没有将宽度作为属性的线型划线笔划没有影响。
语法:
cls_end_width = real number
示例:
! ! Change the width of the wide strokes in ! the "{ Wide Dash }" line style to 2 master ! design units. ! if (cls_name == '{ Wide Dash }') then cls_origin_width = 2.0 cls_end_width = 2.0 endif
cls_name
cls_name 关键字为当前元素分配自定义线型。出图服务器上使用的线型资源文件必须包含线型。
语法:
cls_name = string
示例:
! ! Assign the "{ Diamond }" custom line ! style to all elements using line code 3. ! if (style == 3) then cls_name = '{ Diamond }' endif
cls_origin_width
cls_origin_width 关键字设置与当前元素相关联的自定义线型的起始宽度(采用主设计文件单位)。当为 cls_origin_width 和 cls_end_width 指定相同的值时,线型的划线笔划宽度均匀地变窄或变宽。当为这两个关键字指定不同的值时,划线笔划由粗变细。
宽度是自定义线型的每个划线笔划的可选属性。此关键字对没有将宽度作为属性的线型划线笔划没有影响。
语法:
cls_origin_width = real number
示例:
! ! Change the width of the wide strokes ! in the "{ Wide Dash }" line style to 2 master ! design units. ! if (cls_name == '{ Wide Dash }') then cls_origin_width = 2.0 cls_end_width = 2.0 endif
cls_scale
cls_scale 关键字缩放与当前元素相关联的自定义线型。
语法:
cls_scale = real number
示例:
! ! Scale all linestyles by 1/2. ! if (cls_name .ne. 'none') then cls_scale = 0.5 endif
cls_shift_distance
cls_shift_distance 关键字移动与当前元素相关联的自定义线型。移动距离以主设计文件单位指定。
语法:
cls_shift_distance = real number
示例:
! ! Shift the linestyle origin by 1 master ! design unit. ! if (cls_name == '{Batten}') then cls_shift_distance = 1.0 endif
cls_shift_fraction
cls_shift_fraction 关键字移动与当前元素相关联的自定义线型。
语法:
cls_shift_fraction = real number
示例:
! ! Shift the custom linestyle by 1/2 of the ! pattern length. ! if (cls_name .ne. 'none') then cls_shift_fraction = 0.5 endif
color
color 关键字会更改未填充元素的当前元素颜色。如果未使用 boundary_color、fill_color 和 pattern_color 关键字特别设置边界颜色、填充色和图案前景色,则为颜色赋值也会更改闭合多边形的这些值。有关指定颜色的详细描述,请参见本部分末尾的在赋值语句中指定颜色。
语法:
color = integer
(其中 integer 是 0 到 255 范围内的一个颜色索引)
color = "string"
(其中 string 是颜色库中的一个颜色名)
color = (R,G,B)
(其中 RGB 在 0 到 255 的范围内)
示例:
! ! Change color of lines, strings, and curves using ! the various methods for defining color. ! if (type eq line) then color = 1 ! Set the color to be index value 1. else if (type == line_string) then color = 'blue' ! Set the color to blue. else if (type == curve) then color = (0,0,255) ! Set the color to RGB value 0,0,255. endif
endcap
endcap 关键字控制非闭合元素的终点的显示。Endcap 有以下显示选项:
语法:
endcap = endcap_type
(其中 endcap_type 为 butt、extend 和 circle)
示例:
! ! Specify the endcap type based on the element ! type. ! if (type == line) then endcap = butt else if (type == line_string) then endcap = extend else if (type == arc) then endcap = circle endif
envr_value
envr_value 赋值关键字将当前 envr_variable 设置为指定的字符串。然后将此 envr_variable = 值对写入计算文件,也可以用作数字档案中的特性数据。
语法:
envr_value=string
示例 1:
! !This design script sets a plot sheet attribute !based on the characters stored in text elements !in the design file. The criteria to determine which !text contains the appropriate characters is !based on MicroSation tags. tag_set='dpr' tag_name='sheet' if ((type eq text) and (tag_character eq 'drawingno'))then envr_variable = "Drawingno" envr_value = characters else if ((type eq text) and (tag_character eq 'title')) then envr_variable = "Title" envr_value = characters else if ((type eq text) and (tag_character eq 'sheetno')) then envr_variable = "Sheetno" envr_value = characters endif
示例 2:
! !This design script sets a plot sheet attribute !based on the characters stored in text elements !in the design file. The criteria to determine which !text contains the appropriate characters is !based on level. if ((type eq text) and (level eq 2)) then envr_variable = "Account" envr_value = characters else if ((type eq text) and (level eq 4)) then envr_variable = "Project" envr_value = characters else if ((type eq text) and (level eq 6)) then envr_variable = "Revision" envr_value = characters endif
envr_value_num
您可以使用 envr_value_num 关键字将 envr_variable 的值设置为实数。Envr_value 和 envr_value_num 在同一设计脚本中是可互换的。例如,如果将 envr_value 设置为字符串值4,则 envr_value_num 将自动设置为实数 4。这使您可以从设计文件中提取字符串(例如页码),将其转换为一个实数,以便可使用 1 为增量增加该值,然后将其显示回为字符串。以下示例设计脚本演示此过程。
envr_variable = 值对也写入计算文件,并可用作数字档案中的特性数据。
语法:
envr_value_num = real
(其中 real 为任何实数)
示例:
! This following design script increments the ! page number in the title block by 1. The page number ! is a text string on level 5. ! envr_variable = "pagenum" if ((type eq text) and (level eq 5)) then envr_value = characters envr_value_num = envr_value_num + 1 characters = envr_value endif
envr_variable
envr_variable 赋值关键字选择要在设计脚本中使用的打印定义环境变量。比较关键字 envr_value 和 envr_value_num 可用于检查变量的值。
语法:
envr_variable = string
示例:
! !If SKIP_TEXT is defined (as anything, e.g. !"iplot mod MY_IPARM -environment = [SKIP_TEXT=1]") !in the IPARM environment, ignore text and !text_node elements. ! envr_variable = "SKIP_TEXT" if (envr_value <> "") then if (type .IN. text, text_node) then ignore = true endif endif
fill_color
fill_color 关键字设置区域填充多边形的填充色。它还指定图案元素的背景色。使用此关键字自动启用 area_fill。元素的缺省填充色是其元素颜色。缺省情况下,图案背景是透明的。有关指定颜色的详细描述,请参见本部分末尾的在赋值语句中指定颜色。
语法:
fill_color = integer
(其中 integer 是 0 到 255 范围内的一个颜色索引)
fill_color = "string"
(其中 string 是颜色库中的一个颜色名)
fill_color = (R,G,B)
(其中 RGB 在 0 到 255 的范围内)
示例:
! ! Define fill color for shapes, complex shapes, ! and ellipses. ! if (type == shape) then fill_color = 5 else if (type == complex_shape) then fill_color = 'blue' else if (type == ellipse) then fill_color = (0,0,255) endif
font
font 关键字设置文本元素的字体编号。
语法:
font = integer
(其中 integer 的取值范围为 0 到 255)
示例:
! ! Change font for certain text strings. ! if ((type == text) and (font == 1)) then font = 2 else if ((type == text) and (font == 3)) then font = 7 endif
font_name
font_name 关键字设置文本元素的字体名称。
语法:
font_name = string
(其中 string 是线符资源文件中的字体名称。)
示例:
! ! Change font name for certain text strings. ! if ((type == text) and (font == 1)) then font_name = "Architectural" else if ((type == text) and (font == 3)) then font_name = "FONT060" endif
ignore_element
ignore_element 关键字确定元素是否被出图。如果此关键字设置为 true,则当前元素不会被出图。
语法:
ignore_element = true ignore_element = false
示例:
! ! Do not plot text elements on level 63. ! if ((type == text) and (level == 63)) then ignore_element = true endif
midline_joint
midline_joint 关键字控制未填充和已填充元素的节点的显示。如果对填充的元素禁用 boundary_display,则设置 midline_joint 关键字不起作用。以下列表描述了此关键字的选项:
miter |
两个段的对应边延伸到它们的交点(缺省值)。 |
bevel |
与 miter 类似,不过段以对接端帽结束。 |
butt |
每个段的末端显示为矩形节点。 |
extend |
与 butt 类似,不过每个段延伸其宽度的一半。 |
circle |
在每个段的末尾显示一个半圆。 |
语法:
midline_joint = midline_joint_type
(其中 midline_joint_type 为 butt、bevel、extend、circle 或 miter)
示例:
! ! Set the midline_joint based on the reference ! file attachment number. ! if (file == 0) then ! Test for elements in the master file. midline_joint = butt else if (file == 1) then ! Test for elements in the first reference file. midline_joint = extend else if(file == 2)then ! Test for elements in the second reference file. midline_joint = circle else if(file == 3)then ! Test for elements in the third reference file. midline_joint = miter endif
pen
pen 关键字选择笔绘图机上的笔。设置此关键字等效于设置当前元素的颜色,但笔编号等于颜色编号加 1。
语法:
pen = integer
(其中 integer 的取值范围为 1 到 256)
示例:
! ! Set pen number based on element's level. if (level == 1) then pen = 1 else if (level == 2) then pen = 2 else if (level == 3) then pen = 3 endif
pen_width_nn
(其中 nn 是从 0 到 31 的值)
pen_width_nn 关键字将打印线宽(物理粗细,使用设计脚本单位)赋值为 32 个标准产品线宽。这些设计脚本赋值关键字替代打印机驱动程序配置 (.pltcfg) 文件中定义的线宽到宽度映射,等同于可以在笔表中定义的线宽到宽度映射。这些关键字的行为与 weight_base/weight_delta 关键字类似,但 pen_width_nn 关键字允许对每个线宽独立赋值。
! ! Specify the weight-to-width maps based on paper size. ! units = mm if (first_time) then if (ip_xsize_num > 17) then pen_width_00 = 0.169 pen_width_01 = 0.375 pen_width_02 = 0.5 pen_width_03 = 0.625 pen_width_04 = 0.75 pen_width_05 = 0.875 pen_width_06 = 1 pen_width_07 = 1.125 pen_width_08 = 1.25 pen_width_09 = 1.375 pen_width_10 = 1.5 pen_width_11 = 1.625 pen_width_12 = 1.75 pen_width_13 = 1.875 pen_width_14 = 2 pen_width_15 = 2.125 pen_width_16 = 2.25 pen_width_17 = 2.375 pen_width_18 = 2.5 pen_width_19 = 2.625 pen_width_20 = 2.75 pen_width_21 = 2.875 pen_width_22 = 3 pen_width_23 = 3.125 pen_width_24 = 3.25 pen_width_25 = 3.375 pen_width_26 = 3.5 pen_width_27 = 3.625 pen_width_28 = 3.75 pen_width_29 = 3.875 pen_width_30 = 4 pen_width_31 = 4.125 else pen_width_00 = 0.12675 pen_width_01 = 0.28125 pen_width_02 = 0.375 pen_width_03 = 0.46875 pen_width_04 = 0.5625 pen_width_05 = 0.65625 pen_width_06 = 0.75 pen_width_07 = 0.84375 pen_width_08 = 0.9375 pen_width_09 = 1.03125 pen_width_10 = 1.125 pen_width_11 = 1.21875 pen_width_12 = 1.3125 pen_width_13 = 1.40625 pen_width_14 = 1.5 pen_width_15 = 1.59375 pen_width_16 = 1.6875 pen_width_17 = 1.78125 pen_width_18 = 1.875 pen_width_19 = 1.96875 pen_width_20 = 2.0625 pen_width_21 = 2.15625 pen_width_22 = 2.25 pen_width_23 = 2.34375 pen_width_24 = 2.4375 pen_width_25 = 2.53125 pen_width_26 = 2.625 pen_width_27 = 2.71875 pen_width_28 = 2.8125 pen_width_29 = 2.90625 pen_width_30 = 3 pen_width_31 = 3.09375 endif endif
priority
priority 关键字修改元素出图的顺序。缺省情况下,元素按照其在设计文件中出现的顺序进行出图。使用 priority 关键字,低优先级元素早于较高优先级元素出图,使得较高优先级元素出图后位于较低优先级元素上方。出图区域填充元素时,这可能很有用。例如,如果您想要文本字符串出图在填充多边形内,则文本必须比多边形具有更高的优先级,以使文本不被覆盖。元素的缺省优先级为 0。
请注意重要的一点,无优先级的元素会首先打印,接着按元素优先级打印具有优先级的元素;因此,具有负优先级以向下推送元素的笔表可能需要更改。
语法:
priority = integer
(其中 integer 的取值范围为 -1,000,000 到 1,000,000)
示例:
! ! Set priority of elements based on their color. if (type == shape) then area_fill = true if (color == 1) then priority = 10 else if (type == text) then !Plot text on top of the shapes. priority = 20 endif endif
scale
scale 关键字指定单元(普通和共享)、弧、椭圆、文本和文本节点等具有局部原点的元素所应用的比例因子。文本和文本节点按其对齐点进行缩放。缺省比例为 1.0。
语法:
scale = real
(其中 real 是任何正实数)
示例:
! ! Scale text by a factor of 1.5. ! if (type == text) then scale = 1.5 endif
screen_relative
screen_relative 关键字用于修改当前元素属性字中的 screen_relative 位。Bentley Descartes 将屏幕相对性称为视图无关。
语法:
screen_relative = true screen_relative = false
示例:
! ! If element is a cell named 'LOGO', set the screen ! relative bit in the properties word. ! if ((type == cell) and (cellname == 'LOGO')) then screen_relative = true endif
screening
Screening 让您可以指定在打印输出中将颜色洗白。虽然 100% 淡显意味着原样打印颜色,但是,例如 50% 的淡显会将颜色打印为半白。此关键字可用于节省墨水,或用于弱化以该颜色出图的元素。
语法:
screening = integer
(其中 integer 的取值范围为 1 到 99)
示例:
! ! If element is an ellipse, set a 50% screening. if (type == ellipse) then screening = 50 endif
size
size 关键字用于修改文本和文本节点元素的大小。
语法:
size = working units
示例:
! ! Set text size for text elements on level 1. ! if ((type == text) and (level == 1)) then size = 0:0:250 endif
style
style 关键字修改当前元素的线型。通过为元素赋值 0 到 7 范围内的索引来指定新线型,该线型对应于预定义的 Bentley Descartes 线型之一。可以通过从线型库中指定线型的名称或通过指定一系列打开/关闭过渡来使用用户定义的线型。如果未启用边界显示,则设置线型对区域填充或图案填充的元素没有影响。缺省情况下,禁用边界显示。
语法:
style = integer
(其中 integer 是 0 到 7 范围内的一个线型索引)
style = "string"
(其中 string 是由 MS_DATA 定义的文件夹中提供的名为DesignScriptStyles.slb的线型库中的线型名称)
style = line style definition
(on, off, on, off...)
示例:
! ! Set the element's style based on its color using ! the various methods for defining a line style. ! units = mm switch (color) case 1 ? style = 3 case 2 ? style = 'dash-dot' case 3 ? style = (0.5, 0.3, 0.75, 0.3) endswitch
style_n
(其中 n 是从 1 到 7 的数值)
style_n 关键字修改七种标准线型的笔上/笔下图案定义。这些设计脚本赋值关键字替代打印机驱动程序配置 (.pltcfg) 文件中定义的线型图案。可以使用线型库中定义的线型的名称或通过指定一系列打开和关闭过渡来指定该模式。此语法与 style 赋值关键字相同。
语法:
style_<number> = "string"
(其中 number 是 1 到 7 的值,string 是由 MS_DATA 定义的文件夹中提供的 DesignScriptStyles.slb 线型库中的线型名称)
style_<number> = line style definition
(其中 number 是从 1 到 7 的值,而 line style definition 为使用设计脚本单位的 on, off, on, off 等模式)
对于线和形状等简单元素,style 和 style_n 关键字将产生相同的结果。style 关键字可用于针对每个元素赋予不同的模式。但是,当应用于具有多个线型的复合元素(例如尺寸标注或多线元素)时,style 赋值会更改元素内每条线的线型。style_n 赋值可用于指定七个标准线型的模式,而不会影响复合元素中的线型数量。
示例:
! ! Specify the pattern for the seven standard line styles based on paper size. ! units = inches if (first_time) then if (ip_xsize_num > 17) then style_1 = (0.03, 0.03) style_2 = (0.062, 0.062) style_3 = (0.125, 0.062) style_4 = (0.125, 0.062, 0.03, 0.062) style_5 = (0.045, 0.045) style_6 = (0.125, 0.062, 0.03, 0.062, 0.03, 0.062) style_7 = (0.0125, 0.045, 0.062, 0.045) else style_1 = (0.0225, 0.0225) style_2 = (0.0465, 0.0465) style_3 = (0.09375, 0.0465) style_4 = (0.09375, 0.0465, 0.0225, 0.0465) style_5 = (0.03375, 0.03375) style_6 = (0.09375, 0.0465, 0.0225, 0.03375, 0.0225, 0.03375) style_7 = (0.009375, 0.03375, 0.0465, 0.03375) endif endif
tags
TAG_SET 和 TAG_NAME 赋值关键字用于指定标记集和标记名,以供稍后用于其中一个比较关键字。
数据类型:
示例:
! ! Assuming the design file uses two tag sets, ! "Home address" and "Work address," each ! containing a character tag named "City," ! change the color of all elements whose tags ! specify a home address of "Huntsville" or a ! work address of "Madison." ! ! Start by looking for "City" tags belonging to ! the "Home address" tag set. ! tag_set = 'Home address' tag_name = 'City' if (tag_char == 'Huntsville') then color = 4 endif ! Now look for tags in the "Work address" ! tag set. Note that the tag name is still "City". tag_set = 'Work address' if (tag_char == 'Madison') then color = 4 endif
thickness
thickness 关键字使您能够以物理单位而不是线宽指定线宽。存储在打印定义中的单位值是 thickness 关键字的缺省值,但可以在设计脚本中使用单位关键字进行修改。指定 thickness 不会更改线宽比较关键字使用的线宽。
语法:
thickness = positive real number
示例:
! ! Set line thickness based on the element's color. ! units = inches switch (color) case 1 - 5 ? thickness = 0.125 case 6 - 10 ? thickness = 0.075 default ? thickness = 0.05 endswitch
translucent
如果将 translucent 关键字设置为 true,则出图当前元素,以使其下面的任何元素不完全隐藏。此关键字的缺省值为 false。translucent 关键字只会影响非填充元素和填充元素的边界(如果边界已打开)。translucent 关键字不适用于矢量设备或使用 Microsoft 打印机驱动程序驱动的设备。
注释: translucent 关键字的效果类似于值为 50 的新 transparency 关键字。translucent 关键字会影响填充和非填充元素以及填充元素的边界(如果边界已打开)。有关详细信息,请参见 transparency 关键字。
语法:
translucent = true translucent = false
示例:
! ! Plot elements on level 10 with heavily weighted ! red lines and allow elements underneath to ! show through. ! if (level == 10) then color = "red" weight = 10 translucent = true endif
translucent_fill
如果设置为 true,则 translucent_fill 关键字指定区域填充和图案填充元素的填充色是半透明的。pattern_filled 元素的前景色和背景色都是半透明的。translucent_filled 元素下面的元素仍然可见。此关键字的缺省值为 false。translucent_fill 关键字不适用于矢量设备或使用 Microsoft 打印机驱动程序驱动的设备。
注释: translucent_fill 关键字的效果类似于值为 50 的新 transparency 关键字。translucent_fill 关键字影响非填充、区域填充和图案填充元素以及填充元素的边界(如果边界已打开)。有关详细信息,请参见 transparency 关键字。
语法:
translucent_fill = true translucent_fill = false
示例:
! ! Set fill color to be translucent. ! area_fill = true translucent_fill = true fill_color = (255,0,0)
transparency
transparency 赋值关键字使您能够为当前元素设置透明度。您可以在 1 到 100 的范围内设置透明度的值。该值越高,元素越透明。
语法:
transparency = value
(其中 value 为 1–100)
示例:
! ! Set transparency for lines on level 2. ! if ((level eq 2) and (type eq line)) then transparency = 50 endif
units
units 关键字用于指定粗细和线型等关键字的尺寸。务必在设计脚本的开头设置 units 关键字,并且只在设计脚本中设置一次。该关键字的缺省值是来自打印定义的单位值。
语法:
units = units_constant
(其中 units_constant 为以下之一:
示例:
! ! Set line thickness to 0.5 millimeters. ! units = mm thickness = 0.5
weight
weight 关键字修改当前元素的线宽。对于填充元素,必须为此关键字启用 boundary_display 以影响元素边界。
语法:
weight = integer
(其中 integer 的取值范围为 0 到 31)
示例:
! ! Set line weight based on element's color. ! switch (color) case 1-10 ? weight = 2 case 11-20 ? weight = 1 default ? weight = 0 endswitch
weight_base/weight_delta
weight_base 和 weight_delta 关键字将线宽映射到出图上的物理粗细。使用这些关键字,您可以在各种绘图机上获得一致的线条粗细。weight_base 关键字为线宽为 0 的元素指定线条粗细。weight_delta 关键字指定要为 0 以上的每个线宽添加的附加线条粗细。使用以下公式以使用 weight_base 和 weight_delta 关键字计算线条粗细:
出图粗细 = weight_base + (元素线宽 * weight_delta)
例如,如果 weight_base 是 0.1 cm 并且 weight_delta 是 0.05 cm,则使用以下值。
语法:
weight_base = positive_real weight_delta = positive_real
示例:
! ! Map element's line weight to a thickness on ! the plot. ! weight 0 = 0.10 mm ! weight 1 = 0.15 mm ! weight 2 = 0.20 mm ! weight 3 = 0.25 mm ! . ! . ! . ! weight 31 = 1.65 mm units = mm weight_base = 0.1 weight_delta = 0.05