CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSA (https://www.cfd-online.com/Forums/ansa/)
-   -   Import stp file ANSA scripting (https://www.cfd-online.com/Forums/ansa/223901-import-stp-file-ansa-scripting.html)

m.signo3 January 31, 2020 03:53

Import stp file ANSA scripting
 
Hi everyone, I'm a beginner in ANSA scripting.
I need to import an stl file in ANSA but when I write the code the program opens a window in which I have to manually choose the file. Considering that I need to run an optimization procedure which must be completely automatized I need the program to open the specific file without my intervention. is that possible?
To open the file I used those two commands
shell = utils.OpenSelectFile(0,'(file-name.stp)')
base.Open(shell(0))
Did I miss something?

thanks in advance

greg.cfd February 6, 2020 10:36

For STL files you need to use:
base.InputStereoLithography(filename)


For STP files:
base.Open(filename)


The utils.SelectOpenFile() function opens the file manager window, so it should not be used for automated processes.


All times are GMT -4. The time now is 21:43.