icon

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

CreateElements with ~4000 PythonParts gets slower with every run in a session, resets only after leaving the project


Hi, I generate a pipe network with a PythonPart script (Allplan 2026, Windows 11, 15 GB RAM, RTX 4050 set to high performance). One run creates about 4100 independent PythonParts (straight pipes, elbows, fittings), around 8200 elements, in a single AllplanBaseEle.CreateElements(doc, Matrix3D(), model_elements, [], None) call. Each PythonPart has unique parameter values (so that identical-PythonPart matching does not link them), a 3D view, a 2D plan view, and distortion_state(True).

Timing of that one call, same drawing, same ~8200 elements:

right after leaving and re-entering the project: ~20 s (2.5 ms/element)
runs afterwards in the same session: 113 s, 220 s, 121 s, 103 s (up to 50 ms/element)

Ctrl+S does not help, leaving the project does. The Python part of my script (calculation and building the elements) stays constant at ~25–30 s, so the growth is inside CreateElements.

What I tried without effect:

AllplanIFW.UndoRedoService(doc, True, True, True) + CreateElements(..., False) for createUndoStep + CreateUndoStep() at the end
DrawingService.LockGraphicsEngineUpdate(doc, True/False) around delete and create
DrawingFileService.LoadFile to passive and back to active (took 0.4 s, no effect)

Questions:

Is the undo history kept in RAM, and is there any documented way to clear it or reduce its growth from a PythonPart?
Does each PythonPart with unique parameters create its own definition in the drawing file, and do the unused ones stay until the project is closed? Is there a purge?
What is the recommended way to create thousands of independent PythonParts quickly (PythonPartGroup, other transaction settings)?
Which lines in Allplan Trace would show where the time goes during CreateElements?
Thanks!

Hello,

I imagine this must be because Allplan checks whether another identical PythonPart already exists in the project.
When the project has just been opened and the file is empty, Allplan doesn’t have many other elements to search for and compare.
However, if you repeat the process several times, all instances are analysed and the process takes increasingly longer.

Unfortunately, I have no idea how to avoid this.
Support might have some suggestions...