icon

Support Forum

[Frage] Using .incpyp in pyp file: "Name" tag with string

Schlagworte:
  • Pythonpart
  • Include
  • Incpyp

Hello everyone,

Have you tried using strings in the <Name> tag to implement a code from an .incpyp file?
There is an example in the documentation like this:

<Parameter>
    <Name>Left;2-4;Right</Name>
    <Text></Text>
    <TextId>1002;;1003</TextId>
    <Value>IncludeParameter.incpyp</Value>
    <LanguageFile>IncludeParameter_incpyp</LanguageFile>
    <ValueType>Include</ValueType>
</Parameter>

In my case, it works correctly with simple integer indexes or ranges, but I cannot achieve the behavior shown in the documentation when using strings.
I also tried running the .py and .pyp files as in the example, but it still does not work for me as described :/ -> string do not replaces the # symbol (like integer does).

Source:
https://pythonparts.allplan.com/2026/manual/key_components/palette/?h=include#multiple-include

Best regards
Karol

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Hi Karol,

alternatively, if you don't want to localize your PythonPart, you have to provide the texts in the Text tag. In your example, the tag is empty. But you can fill it the same way, as Name tag:

<Parameter>
    <Name>Left;2-4;Right</Name>
    <Text>Left;2-4;Right</Text>
    <Value>IncludeParameter.incpyp</Value>
    <ValueType>Include</ValueType>
</Parameter>

Cheers,
Bart

Hello Karol,

can you tell your ALLPLAN Version? I launched the example you pointed out in ALLPLAN 2026 and everything seems to work fine - the # character is replaced with integers as well as strings. Maybe there is a problem in the specific version you are using?

Cheers,
Bart

Hi Karol,

As discussed with my colleague, in order for your text to be correctly replaced, you have to create a local localization file (eg <your_pyp_name>_eng.xml) with TextID like:

TemplateScriptObject.pyp

            <Parameter>
                <Name>Left;2-4;Right</Name>
                <Text/>
                <TextId>1001;;1002</TextId>
                <Value>IncludeParameter.incpyp</Value>
                <ValueType>Include</ValueType>
            </Parameter>

and into TemplateScriptObject_eng.xml

<Item>
<TextId>1001</TextId>
<Text>Left</Text>
</Item>
<Item>
<TextId>1002</TextId>
<Text>Right</Text>
</Item>

with this it will work

Best Regards
Christophe

Anhänge (2)

Typ: image/png
6-mal heruntergeladen
Größe: 6,95 KiB
Typ: application/zip
46-mal heruntergeladen
Größe: 2,39 KiB

Hi Karol,

alternatively, if you don't want to localize your PythonPart, you have to provide the texts in the Text tag. In your example, the tag is empty. But you can fill it the same way, as Name tag:

<Parameter>
    <Name>Left;2-4;Right</Name>
    <Text>Left;2-4;Right</Text>
    <Value>IncludeParameter.incpyp</Value>
    <ValueType>Include</ValueType>
</Parameter>

Cheers,
Bart