Import automatically by code .STL files

Moderator: GiD Team

Post Reply
Freddy
Posts: 3
Joined: Wed Oct 04, 2017 2:17 am

Import automatically by code .STL files

Post by Freddy »

It is possible to import several files in .stl format by code :?:
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Import automatically by code .STL files

Post by escolano »

You can select multiple .stl files in the Windows file browser and draw them over GiD. All of them fill be imported as stl.

By code, at Tcl level, you can import a stl file with
GiD_Process MEscape Files STLRead $filename escape
if there is some previous mesh, before get the name GiD will ask a question:
"Old mesh exists: Erase, Append, Cancel"
you must anticipate it and provide the answer you want, e.g. to append must use the word AddNoShare:
GiD_Process MEscape Files STLRead AddNoShare $filename escape

Note: You can know if a previous mesh exists with [lindex [GiD_Info mesh] 0] that is the number of meshes

Note: In general, you can know the keywords of the process commands used by GiD doing the operation as user and opening the 'Undo' window (Utilities->Undo...), here you will see in this case the words MEscape Files STLRead AddNoShare $filename escape (where filename is the final name, not a Tcl variable like my code example)
Freddy
Posts: 3
Joined: Wed Oct 04, 2017 2:17 am

Re: Import automatically by code .STL files

Post by Freddy »

Perfect. Thank you very much! :D
Post Reply