Support Forum

[Frage] Replacing old files with new .surf files.

Schlagworte:
  • Visual
  • Scripting
  • File
  • Types
  • Path
  • .surf

Hello,

I am new to allplan visual scripting and I am trying to make a script where the old files are replaced by new files. I made this in dynamo but in allplan I am not sure if there is a possibility to do so. Eg. I have File_1 (old file) in Folder_1 and File_2 in Folder_2. Now I have to save my final file in Folder_3. So i want to write a script where i can select between Folder_1 and Folder_2 and save one of those in Folder_3.

Thank you in advance.

If i understand correctly, you have both in Folder_1 and Folder_2 some .surf files, and want to copy some of those to the new Folder_3. Do you want to do that interactively (e.g. by choosing the source folder manually if a .surf file exists in both folders) or automatically base on some rules?

Basically, PythonPart (incl. Visual Scripting) is designed to interact with Allplan not with raw files directly. Therefore, I want to make sure I understand your wish correctly.

Product Owner API, Allplan GmbH

Thank you for the answer,
Yes you understand me correctly.
If visual scripting doesnt interact with raw files then is there a work around to change the surfaces not manually but automatically using Visual scripting or so? I tried using the assign surface but everytime i have to filter the elements manually. I have attached a picture below of the script that i made. I am not sure if this is the correct way to do it or is there a easier way to filter the elements?

Thank you in advance

Anhänge (1)

Typ: image/png
36-mal heruntergeladen
Größe: 81,40 KiB

For some reason I did not get a notification when you replied.

Yes, it is possible to change object surface automatically with VS. The easiest way is to use/modify the example script “Attributes\AssignAreaElmentsWithFile.pyp” and change the rules based on your requirements. If you do not know where to find the example script, please check the attached Example.png.

What the example script does is to change 2D/3D visual representations of existing elements in Allplan based on some rules (e.g. attribute values), which are pre-defined in an external csv/excel table.

In your case, we just need some rules for changing surfaces. As an example, I created some basic rules (check attached Rules.csv) for applying different .surf to different columns in Allplan based on their value of the attribute “Material” (check attached AssignSurface.gif).

There is currently no detail information about how a rule should look like in that table. But you can check the csv file from the example script to help understand it a little bit… That csv file can be found together with the example script.

P.S. the example script will change all active elements, which meets the rules in that table. To avoid unnoticed changes, please try that with a drawing file or in a project, which is for testing only.

Product Owner API, Allplan GmbH

Anhänge (3)

Typ: image/gif
40-mal heruntergeladen
Größe: 321,70 KiB
Typ: text/plain
1083-mal heruntergeladen
Größe: 480,00 B
Typ: image/png
26-mal heruntergeladen
Größe: 175,67 KiB