Support Forum

[Frage] Is there any utility to modify drawing files in the building structure with python API ? [Gelöst]

Schlagworte:
  • PythonAPI
  • Scripting
  • Pythonpart

Hi,
I've found utility in the documentation (https://pythonparts.allplan.com/) to load and unload drawing files (DrawingFileService LoadFile/UnloadFile functions) ,
but not to remove, add, move, rename, reindex drawings in the building structure.

Is there any way to modify the building structure drawings via Python code?

or perhaps if I rename/move .ndw files in the project folder could I achieve these operations?

Thank you in advance

Lösung anzeigen Lösung verbergen

Hi,

firstly I make sure, we are talking about the same thing: drawing files or layouts. I suppose you are referring to the drawing files, but they cannot be reindexed. Layouts can.

At the moment there is no possibility to move, copy or rename a drawing file using the Python API. The same applies to the layouts. However renaming the drawing files is going to be implemented soon in the API. Other functionalities are going to be implemented step by step in a long term.

I would not recommend renaming the .ndw files directly in the project folder, as it may cause problems ex. with the associated elements like labels. I am afraid, a can't offer you any solution at the moment.

Hi,

firstly I make sure, we are talking about the same thing: drawing files or layouts. I suppose you are referring to the drawing files, but they cannot be reindexed. Layouts can.

At the moment there is no possibility to move, copy or rename a drawing file using the Python API. The same applies to the layouts. However renaming the drawing files is going to be implemented soon in the API. Other functionalities are going to be implemented step by step in a long term.

I would not recommend renaming the .ndw files directly in the project folder, as it may cause problems ex. with the associated elements like labels. I am afraid, a can't offer you any solution at the moment.

Hi,

Is there already a function to rename, move, or copy drawing files or layouts?

Thank you

Zitiert von: Markus_Leitner
Hi,
Is there already a function to rename, move, or copy drawing files or layouts?
Thank you

Hi Markus,

not yet. We will probably implement it in the Q2 of 2025. But this means, you can use the functionality in ALLPLAN 2026.

FYI, what we plan to expose in the API:

  • rename a drawing file / print layout file
  • drawing file selection dialog (similar to what you see, when you are exporting to IFC)
  • print layout selection dialog
  • move/copy content from one drawing file to another
  • move/copy content from one print layout to another
  • copy drawing file / print layout file
  • modify layout attributes
  • allow to start a PythonPart also in the print layout mode

The order matters: the top entries are given the highest priority.

Feel free to give us feedback: Which features from the above mentioned are important for you to be accessible via API? Should we focus on something first?
Please also bare in mind, that the fact, that we plan to implement these. Plans can change, so please do not take this post as a guarantee.

What we will not implement (at least not in the near future): modifying the building structure. So stuff like: create a building, create a floor, assign DFs to a floor, etc. If your task is e.g. to reassign a drawing file from one floor to another, you can do it, but it would require you to modify the XML file describing the building structure yourself. The XML file is located in
Prj/$name_of_your_project$.prj/BIM/Allplan_BIM_BuildingStructure.xml
I know, this is reversed engineering, but currently there is no other way.

Best,
Bart