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!

