[Frage] Allplan start now - PythonParts script not running [Gelöst]


Hello Everyone,

I would like to get into developing PythonParts for the office I work for over 13 years.
After following Allplan start now - PythonParts course contents (by the way, great material, congrats to the creators), I have tried to reproduce the scripts.

I have also downloaded the scripts for Chapter 1 - Simple PythonPart.
In the Std folder of Allplan, I have copied the .pyp and .py files from Lesson 4 in the directories as described in the course.
After I open the SimplePythonPart.pyp in Allplan 2024, the interaction window with the dimensions appears, but no cuboid preview is displayed.
I have modified the default dimensions by entering different values in the interaction window, still nothing is diplayed in the drawing interface.

I have saved the trace window contents, and attached it to this thread.

Has anybody got an idea what could be the problem? I have been struggling for days.

Thank you in advance,
Csaba

Anhänge (1)

Typ: text/plain
279-mal heruntergeladen
Größe: 2,97 KiB

Lösung anzeigen Lösung verbergen

Hi Lukacs,

there is one thing, that comes to my mind. It seems, that Python loads the version of SimplePythonPart.py, where no cube is generated. Check the following locations:

  • ...\Prg\Python
  • ...\Prg\Python\Lib
  • ...\Std\PythonParts-site-packages
  • ...\Usr\Local\PythonParts-site-packages
  • ...\Etc\PythonParts-site-packages
  • ...\Prg\Python\Lib\site-packages
  • ...\Prg\Python\DLLs
  • ...\Etc\PythonPartsFramework
  • ...\Etc\PythonPartsFramework\GeneralScripts
  • ...\Etc\PythonPartsScripts
  • ...\Etc\PythonPartsExampleScripts
  • ...\Etc\VisualScripts
  • ...\Etc\VisualScripts\NodeLib\Classic Library
  • ...\Etc\VisualScripts\NodeLib\Deprecated Library
  • ...\Etc\VisualScripts\NodeLib\Modernized Library
  • ...\Etc\Scripts
  • ...\Usr\Local\prj\PythonPartsScripts
  • ...\Usr\Local\prj\VisualScripts
  • ...\Usr\Local\prj\Scripts
  • ...\Std\PythonPartsScripts
  • ...\Std\VisualScripts
  • ...\Std\Scripts
  • ...\Usr\Local\PythonPartsScripts
  • ...\Usr\Local\VisualScripts
  • ...\Usr\Local\Scripts
  • ...\Prg

If there is another SimplePythonPart.py saved in any of these locations, it is possible that Python loads it before the desired script gets loaded. Note, that every time you start a PythonPart, the Python interpreter search for the .py file in these locations. As soon as it finds it, it does not search in other locations.

Also, Lukacs, if you have found another SimplePythonPart.py file, make sure to delete it and restart Allplan before trying again. Basically you can just search the entire usr/std/etc/prg folder.

Hope that helps,
Bart

Hi Lukacs,

there is literally no python error in the file you have attached. The bootstrap warnings at the beginning are normal Allplan thing. String table error is irrelevant, as you don't want to localize your PythonPart. It is indeed very strange for me, that you don't see anything in the viewport. If you say, that you can start a PythonPart and no Pop-Up appear and everything printed in the trace is what you have attached, that means PythonPart works well, you just can't see it for whatever reason.
You downloaded the last lesson 4, started it and the property palette opens, right? Click in somewhere in the viewport as you would like to place the PythonPart - after that handles should appear. The cube will be places with the current format properties. Make sure, the line color is not the same as the background. Also check out the visibility settings (see attached screenshot). Make sure, the "Foil A" is visible.

Best,
Bart!

Anhänge (1)

Typ: image/png
12-mal heruntergeladen
Größe: 20,98 KiB

Hi Bart,

Thank you for your answer.

I have checked the Visibility settings you have suggested, the three marked settings are checked.
In the hyperlink below you can find a recording made to present in detail what happens on my side:
https://mega.nz/folder/KbA01JBI#yCzcU5HibQo2btJ_ZfotIQ

Best,
Csaba

Hi Lukacs,

this is a very strange behavior. I cannot reproduce it on my machine, the problem must be somewhere in the Allplan settings, but I don't know where. However, the PythonPart seems to work.
Are other PythonParts examples running? Try to run etc/Examples/PythonParts/GeometryExamples/BasicSolids/Cuboid.pyp, as this is the most similar to the one on Allplan Learn Now platform. If that does not help, try to run the examples on a fresh Allplan installation with default settings.

Best,
Bart

Hello Bart,

I ran the BasicSolids examples suggested by you.
Everything work like clockwork.

Still, the .pyp and .py files copied from the content of Chapter1/Lesson4 don't generate the cuboid.

I have made a recording (2024-06-10 11-47-35.mp4) to present the BasicSolids example scripts.
https://mega.nz/folder/KbA01JBI#yCzcU5HibQo2btJ_ZfotIQ

I am searching in several forum threads and other discussions, with no success.
I just can not fathom where the problem lies.

Maybe it's a lost case.

Csaba

Hi Lukacs,

there is one thing, that comes to my mind. It seems, that Python loads the version of SimplePythonPart.py, where no cube is generated. Check the following locations:

  • ...\Prg\Python
  • ...\Prg\Python\Lib
  • ...\Std\PythonParts-site-packages
  • ...\Usr\Local\PythonParts-site-packages
  • ...\Etc\PythonParts-site-packages
  • ...\Prg\Python\Lib\site-packages
  • ...\Prg\Python\DLLs
  • ...\Etc\PythonPartsFramework
  • ...\Etc\PythonPartsFramework\GeneralScripts
  • ...\Etc\PythonPartsScripts
  • ...\Etc\PythonPartsExampleScripts
  • ...\Etc\VisualScripts
  • ...\Etc\VisualScripts\NodeLib\Classic Library
  • ...\Etc\VisualScripts\NodeLib\Deprecated Library
  • ...\Etc\VisualScripts\NodeLib\Modernized Library
  • ...\Etc\Scripts
  • ...\Usr\Local\prj\PythonPartsScripts
  • ...\Usr\Local\prj\VisualScripts
  • ...\Usr\Local\prj\Scripts
  • ...\Std\PythonPartsScripts
  • ...\Std\VisualScripts
  • ...\Std\Scripts
  • ...\Usr\Local\PythonPartsScripts
  • ...\Usr\Local\VisualScripts
  • ...\Usr\Local\Scripts
  • ...\Prg

If there is another SimplePythonPart.py saved in any of these locations, it is possible that Python loads it before the desired script gets loaded. Note, that every time you start a PythonPart, the Python interpreter search for the .py file in these locations. As soon as it finds it, it does not search in other locations.

Also, Lukacs, if you have found another SimplePythonPart.py file, make sure to delete it and restart Allplan before trying again. Basically you can just search the entire usr/std/etc/prg folder.

Hope that helps,
Bart

Hi Bart,

Great instincts. There was a .py file named SimplePythonPart in the Etc library.
I must have copied it when I was trying to run the Lesson04 scripts from different location.

Now everything works like a charm.

Thank you once more for you time and effort.

Csaba

Zitiert von: bmarciniec

there is one thing, that comes to my mind. It seems, that Python loads the version of SimplePythonPart.py, where no cube is generated. Check the following locations:
....

Even if this is already answered, for anyone in a similar problem, to reduce the number of Folders to search:
use "Allplan Service" Menu to get the list of used path segments for: PRG, USR and STD
Service -> Command Prompt ->

PRG (program folder) f.e. : C:\Program Files\Allplan\Allplan 2024\prg
ETC f.e.: c:\ProgramData\Nemetschek\Allplan\2024
USR: c:\users\<your_username>\Documents\Nemtschek\Allplan\2024\local
STD: d:\data\Allplan\Allplan 2024

open the command promt and search with:

dir /s/B <nameOfFile.py>

and repeat for others or, if all is installad on same HDD:

cd \
dir /s/B <nameOfFile.py>

Allplan Webentwicklung

Private messages must be private. No support request via Private message.