icon

Support Forum

[Frage] How to get PySide6 work in Allplan2026 [Gelöst]


Hello all,

We are at the beginning of the development of an interactor script that will be embedding complex GUIs.
For this reason we would like to design the graphical part of the script by using PySide6.

After having installed PySide6 in our Allplan2026 Python3.13 instance, we cannot manage to have have it working, it systematically ends up with an ImportError message :
ImportError: DLL load failed while importing Shiboken : The specified module was not found.

It seems the Python engine embedded in Allplan 2026 cannot load the Qt6 DLLs required by Shiboken6.

Then we tried to

- copy all the necessary DLLs in the path ...\Allplan\Allplan2026\Prg\bin\Qt and reference this in the script using
qt_path = r"...\Allplan\Allplan2026\Prg\bin\Qt"
os.add_dll_directory(qt_path) --> not working...

- copy all the necessary DLLs in the path ...\Allplan\Allplan2026\Prg\Python\DLLs --> not working...

- even copy all the necessary DLLs in the root path ...\Allplan\Allplan2026\Prg --> not working...

Did some of you succeed at running PySide6 inside Allplan PythonPartsScripts and in this case what is the procedure,
or is it simply impossible to have PySide6 running inside Allplan ?

Thanks for your help

Lösung anzeigen Lösung verbergen

Hi,

the topic is old, but since I now have solution to use PySide6 within ALLPLAN.

And the solution is: Executing the Qt dialog in a separate Python subprocess.

Example: see attachement

The flow:

1. Subprocess Spawning (PySideExampleDialog.py:49-61)

subprocess.run(
    [self._python_exe(), __file__] + py_lib_path,
    input=input_data,
    capture_output=True,
    text=True,
)

__file__ makes the script run itself as a subprocess
py_lib_path (from sys.path) is passed as command-line args so the subprocess can import Allplan libraries
subprocess.run() blocks until the subprocess exits → inherently modal behavior

2. Inter-Process Communication
Parent → Subprocess (Input):

Current values (length, width, height) serialized to JSON
Passed via stdin to the subprocess
Subprocess → Parent (Output):

User-entered values serialized to JSON
Written to stdout before exit
Return code signals acceptance: 0 = OK, 1 = Cancel

3. Python Interpreter Detection (PySideExampleDialog.py:71-91)
Because sys.executable points to Allplan.exe (embedded Python), it searches for the actual python.exe in sys.prefix directories.

4. Subprocess Entry Point (PySideExampleDialog.py:186-195)
Only when run as subprocess does it import PySide6 and create the Qt application.

if __name__ == "__main__":
    _data = json.loads(sys.stdin.read())
    sys.path.extend(sys.argv[1:])  # Restore Allplan library paths
    from PySide6.QtWidgets import ...
    _run_dialog(_data["length"], _data["width"], _data["height"])

Hope that helps you leverage the capabilities of QT framework within ALLPLAN

Best regards,
Bart

Anhänge (1)

Typ: application/zip
69-mal heruntergeladen
Größe: 4,12 KiB
11 - 11 (11)

Hi,

the topic is old, but since I now have solution to use PySide6 within ALLPLAN.

And the solution is: Executing the Qt dialog in a separate Python subprocess.

Example: see attachement

The flow:

1. Subprocess Spawning (PySideExampleDialog.py:49-61)

subprocess.run(
    [self._python_exe(), __file__] + py_lib_path,
    input=input_data,
    capture_output=True,
    text=True,
)

__file__ makes the script run itself as a subprocess
py_lib_path (from sys.path) is passed as command-line args so the subprocess can import Allplan libraries
subprocess.run() blocks until the subprocess exits → inherently modal behavior

2. Inter-Process Communication
Parent → Subprocess (Input):

Current values (length, width, height) serialized to JSON
Passed via stdin to the subprocess
Subprocess → Parent (Output):

User-entered values serialized to JSON
Written to stdout before exit
Return code signals acceptance: 0 = OK, 1 = Cancel

3. Python Interpreter Detection (PySideExampleDialog.py:71-91)
Because sys.executable points to Allplan.exe (embedded Python), it searches for the actual python.exe in sys.prefix directories.

4. Subprocess Entry Point (PySideExampleDialog.py:186-195)
Only when run as subprocess does it import PySide6 and create the Qt application.

if __name__ == "__main__":
    _data = json.loads(sys.stdin.read())
    sys.path.extend(sys.argv[1:])  # Restore Allplan library paths
    from PySide6.QtWidgets import ...
    _run_dialog(_data["length"], _data["width"], _data["height"])

Hope that helps you leverage the capabilities of QT framework within ALLPLAN

Best regards,
Bart

Anhänge (1)

Typ: application/zip
69-mal heruntergeladen
Größe: 4,12 KiB
11 - 11 (11)