Include parameter

Within a pyp file it’s possible to include the parameters of another file. This can be be used e.g. to include

  • files with general PythonPart parameter

  • files with parameter blocks for indexing

into the current pyp file. The use of the include allows to define these parameters only once, avoids a lot of typing and simplifies the modification of the pyp file.

Syntax

<Page>
<Name>FirstPage</Name>
<Text>Page text 1</Text>
<TextId>1001</TextId>

#include IncludeParameter.incpyp;Left,1002;2-4;Right,1003

<Parameter>
</Parameter>
</Page>

The include statement must be added to the <Page> tag of the pyp file. When the entries in the file IncludeParameter.incpyp are

<Parameter>
<Name>Length</Name>
<Text>Length #</Text>
<TextId>2000</TextId>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>

and the text IDs defined as

<Item>
<TextId>1002</TextId>
<Text>links</Text>
</Item>
<Item>
<TextId>1003</TextId>
<Text>rechts</Text>
</Item>
<Item>
<TextId>2000</TextId>
<Text>Länge #</Text>
</Item>

the above include statement creates the parameter in the current pyp file as

<Parameter>
<Name>LengthLeft</Name>
<Text>Länge links</Text>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>
<Parameter>
<Name>Length2</Name>
<Text>Länge 2</Text>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>
<Parameter>
<Name>Length3</Name>
<Text>Länge links</Text>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>
<Parameter>
<Name>Length4</Name>
<Text>Länge 4</Text>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>
<Parameter>
<Name>LengthRight</Name>
<Text>Länge rechts</Text>
<Value>0</Value>
<ValueType>Length</ValueType>
</Parameter>

The general form of the include statement is:

#include _file_name;index1,text1;index2,text2;…|LanguageFile=IncludeParameter_incpyp

with the following definition

file_name

Path and name of the file to include. The path can be defined locally to the current pyp file or with a leading etc\, std\, usr\ or prj\ to make it globally a standard Allplan path.

index…

Index of the parameter which will be added to the name value in all existing <Name> tags from the include file. The value can be a string, a single number or an index range.

text…

Text, which will replace the # character in all existing <Text> tags from the include file. The text can be a text ID like 1002. In case of an index range like 2-4, the index replaces the #.

LanguageFile=…

Definition of the language file for the <TextId> tags from the include file. The path can be defined locally to the current pyp file or with a leading etc\, std\, usr\ or prj\ to make it globally a standard Allplan path.

If the language file is not defined, the text for the IDs is taken from the resource file of the pyp file.

If the index value is an index range, the index can also be used to replace the # in a <Visible> or <Enable> tag defined like

<Visible>CoordCount >= #</Visible>

The use of the include statement is shown in the example

…\etc\Examples\PythonParts\PaletteExamples\IncludeParameter.pyp
…\etc\PythonPartsExampleScripts\PaletteExamples\IncludeParameter.py