Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

Differentiating between using a matched PythonPart and creating a new one [Gelöst]


How can I differentiate between using a match function and creating a new one in coding? Are there any variables or other indicators that can specify this?

Lösung anzeigen Lösung verbergen

Hi,

there are no specific variables indicating this, but you can create one.

When "match" is used, the PythonPart is started with parameter values taken over from the "matched" PythonPart, but the element pointing to the "modified PythonPart" remains empty. What you can do, is just create a bool parameter with default value set to False and change it's value to True when PythonPart is placed. This way, every "placed" PythonPart will have this parameter set to True, but the default value in the PYP file will be False. Now you can determine how your PythonPart gets started:

  • extra_parameter = False AND modification_element is Null --> PythonPart started from the library
  • extra_parameter = True AND modification_element is Null --> PythonPart started by match
  • extra_parameter = True AND modification_element is not Null --> PythonPart started in modification mode

Remember to set this additional parameter to be persistent in the model only:

<Persistent>Model</Persistent>
More about persistency here. More about modification mode here.

Hope that helps.

Best,
Bart

Hi,

there are no specific variables indicating this, but you can create one.

When "match" is used, the PythonPart is started with parameter values taken over from the "matched" PythonPart, but the element pointing to the "modified PythonPart" remains empty. What you can do, is just create a bool parameter with default value set to False and change it's value to True when PythonPart is placed. This way, every "placed" PythonPart will have this parameter set to True, but the default value in the PYP file will be False. Now you can determine how your PythonPart gets started:

  • extra_parameter = False AND modification_element is Null --> PythonPart started from the library
  • extra_parameter = True AND modification_element is Null --> PythonPart started by match
  • extra_parameter = True AND modification_element is not Null --> PythonPart started in modification mode

Remember to set this additional parameter to be persistent in the model only:

<Persistent>Model</Persistent>
More about persistency here. More about modification mode here.

Hope that helps.

Best,
Bart