Run from command line

A PythonPart can be started and executed from the Allplan command line as follows

C:\Allplan\Allplan_2021.exe -o “@Z:\IFCExportByFileList.pyp” “Z:\Settings\IFCExport.csv”

The script must be defined by

-o “@xxx”

where xxx is the full path and name of the pyp file. After the script additional parameter for the execution of the PythonPart can be added.

A PythonPart can be used for manual startup or automatic startup from the command line. The type of execution can be checked within the py file as follows:

if not sys.argv or sys.argv == ['']:
    # normal start
else:
    # start by command line

The additional parameters from the command line can be taken like

if len(sys.argv) > 1:
      settings_file = sys.argv[1]
      settings_path = os.path.dirname(sys.argv[1]) + "\\"

By calling

AllplanBaseElements.ProjectService.CloseAllplan()

Allplan will be closed.