CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSYS (https://www.cfd-online.com/Forums/ansys/)
-   -   Automating Workbench with excel (https://www.cfd-online.com/Forums/ansys/143039-automating-workbench-excel.html)

kar.coep October 15, 2014 05:06

Automating Workbench with excel
 
Hello,
I am trying to drive and automate workbench (opening project file, Design modeler, mesher, setup, postprocessor and customized report generation) with excel. I have just started on it. Has anyone worked on something like this? Even automation of a module (like mesher/designmodeler) would work. Also ansys has capability to record macros/journals..if I create a journal involving excel, where to see its programming?

Any help would be appreciated, as I am just starting out and need to complete it by 2 months.

Thanks.
:)

Kapi October 21, 2014 20:16

Hi kar.coep,

I suggest you to go to help section of Ansys and go to "Updating a Workbench Project and Parameters from Excel" in Workbench Scripting Guide.
This guide will help you to start with scripting with excel

kar.coep October 22, 2014 11:19

Thanks Kapi!!! I am going through the guide..
The guide says about updating the workbench file. but I need to create a program from scratch..
Is there a way to manipulate the coding with micros like we can in Excel.. In excel we can create a macro of desired actions and copy it and edit it accordingly.. macros would just give us basics to start with.. can we do that in ansys journaling?

Kapi October 28, 2014 20:58

Hi kar.coep,

Yes you can do it. You can create a button or any UI which will run the batch file which in turn run workbench journal file.
A .wbjn file typically look like this:

Quote:

# encoding: utf-8
SetScriptVersion(Version="15.0")
template1 = GetTemplate(TemplateName="Mesh")
system1 = template1.CreateSystem()
geometry1 = system1.GetContainer(ComponentName="Geometry")
geometry1.Edit()
script = open('geometry.js', 'r')
geometry1.SendCommand(Command=script.read())
script.close();
geometry1.Exit()
component1 = system1.GetComponent(Name="Mesh")
component1.Refresh()
mesh1 = system1.GetContainer(ComponentName="Mesh")
mesh1.Edit()
script = open('mesh.js', 'r')
mesh1.SendCommand(Command=script.read())
script.close();
mesh1.Exit()
This WBJN file then go into respective geometry and mesh javascripts to execute the command to give you final mesh.

Hope this helps.

You can go to Ansys website and look for documents on scripting. These documents detail lot many things which is not thr in HELP section.


Cheers,
Kapi

ashtonJ May 7, 2015 20:54

Hi Kar,

Just wondering if you had any luck in automating workbench with excel. If yes, I would be very grateful if you would let me know how to do it.

Thanks
AshtonJ


All times are GMT -4. The time now is 04:45.