|
[Sponsors] |
April 1, 2014, 22:49 |
SCRIPT for geometry / meshing
|
#1 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi guys,
I am starting this new thread to talk to people who are doing scripting for geometry and meshing like me. Query: When we run .wbjn file thru batch file and call .js files to do geomtry and mesh. After it finishes meshing we use... mesh1.Exit() and mesh closes. Now my problem is when I run multiple .wbjn files one after the other from the same batch file. The second .wbjn file dosent execute unless I close the first WB. Do you guys have any idea how to automatically close WB after meshing is done? I think it cant be done from .wbjn file, there shud be some function to run in batch file itself to close first WB and start next .wbjn file. Any help will be highly regarded Thanks in advance Cheers KAPI |
|
April 2, 2014, 09:46 |
|
#2 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hi Kapi,
you can close WB by simply adding -X to the command you start ANSYS with. -X closes WB as soon as the script is completely executed. Then you can open WB again for your other journal files. Greets Nigirim |
|
April 2, 2014, 18:56 |
|
#3 | |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Thanks for reply Nigirim,
Quote:
"C:\Program Files\ANSYS Inc\v145\Framework\bin\Win64\RunWB2.exe" -I -R File_name.wbjn what you are suggesting is to add -X in the above code and run? like this? "C:\Program Files\ANSYS Inc\v145\Framework\bin\Win64\RunWB2.exe" -I -R -X File_name.wbjn Edit: I just ran the above code using -X, what it is doing is opening the WB and closing straight after. so basically it dosent run the .js code I have provided to make geometry and mesh and closes. Could you provide the code which uses -X , I will try few things as well to get it working. Cheers Kapi Last edited by Kapi; April 2, 2014 at 19:15. Reason: tried code with -X |
||
April 2, 2014, 19:38 |
|
#4 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Got it working!!
Just add some code in Fil_name.wbjn and saved the WB as "check.wbpj" then ran the below code "C:\Program Files\ANSYS Inc\v145\Framework\bin\Win64\RunWB2.exe" -I -R File_name.wbjn -X check.wbpj Thanks heaps for your suggestion Nigirim Cheers KAPI |
|
April 2, 2014, 20:33 |
Script Selective Meshing
|
#5 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
New Query:
There are code available to run mesh thru java script, the problem is it meshes the whole thing in 1 go. We can pick bodies manually one by one and mesh them or we can create worksheet inside for selective meshing. I want my java script to pick bodies one by one from the tree(Model>Geomtry>Part>Body1) and mesh it, this way meshing is lot quicker when it comes to large model with lot of bodies and a coarse mesh. The code I am using to mesh is below, it meshes everything in 1 go ds.Script.doModelPreviewMesh(); I checked help and all in my model is having "Part" because if we go in Mesh help it says: In a multibody part, if any child bodies have been meshed and refined, another child body is unmeshed, and you subsequently mesh the unmeshed body, the mesh state of all refined bodies in the part will be invalidated and re-meshed during mesh generation. Similarly, if one body is unmeshed and refinement is needed on another, generating the mesh will result in meshing and refinement of the entire part Does that mean I cant do selective meshing in a part? I tried doing this manually and it works without any problem. So now I need code which can go into "Part" and select bodies one by one and mesh it. Anyone with ideas? Thanks in advance Cheers Kapi |
|
April 3, 2014, 08:44 |
|
#6 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hi Kapi,
how does your script work in general? Are you creating a new Workbenchprojekt every time you start the script or are you loading and modifying a existing project? In general I would say it is possible, everything you can do in the GUI is handeld by XML and JScript. But I am not 100% certain it works this way. There are JScript commands that select the bodies in the Tree, I have never tried to select and then mesh the bodies one by one. I have loaded a existing Workbenchproject and modified it. To mesh I just used the Worksheet I once created for every single body. Greets Nigirim |
|
April 3, 2014, 19:26 |
|
#7 | |||
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Nigirim,
Thanks for replying back. Quote:
Quote:
Quote:
Could you please share your JS command to select bodies in tree, may b that can help in my case. Is it possible to create worksheet thru JS commands and make that worksheet select the bodies from geomtery 'part'? I see a problem in selecting bodies from tree when there is Part with multiple bodies because what we actually need the code should go in the tree, select part, go inside part and select bodies from top to bottom and mesh them. I hope I am able to explain my problem. Thanks Kapi |
||||
April 4, 2014, 08:33 |
|
#8 | |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Quote:
its been a while since i last used the command for the Meshing tool, so I am not 100% certain that it is the same as for DesignModeler (This one i used way too much) Code:
ag.guiScript.SelectFeatureNodeByID(BODY_ID) I used this command in a loop to select threw the bodies to give them Bodythickness. I never made a Worksheet by Script and never took a look if it is possible, so I can't tell you if it works or not. Hope this helps Greets Nigirim |
||
April 6, 2014, 19:40 |
|
#9 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Thanks Nigirim
the below code is for geometry not mesh sadly. "ag" is used in geometry and "ds" is used in meshing to prefix the function Code:
ag.guiScript.SelectFeatureNodeByID(BODY_ID) so basically if I manually select a "body" in the tree and run my JS file it work smoothly but it dosent do anything if I select "geometry" or "Model" in the tree. Making worksheet is outta question cuz I will not be able to give any specifics of bodies to work on it. the only thing left is to force my JS script to select a body and then run the script. Lets c if I am able to do that. If anyone else has any input here then it wil be really helpful Cheers KAPI |
|
April 16, 2015, 02:32 |
|
#10 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 12 |
Hello Kapi,I am trying to achieve the same process as you are saying in this post. I have searched a lot, contacted Ansys guys but doesn't seem to get any documentation on DM and meshing programming as such. Can you give a intro on how to start with this programming or provide relative Jscript coding if it is easy? It would be really helpful.In DM what I am trying to achieve is:1. import external geometry from Creo2. Create inlet and outlet surfaces and have Fill3. Create named selections for inlet and outlet4. suppressing the body5. forming new part with new generated domainsAlso, is there a way to record Jscript coding in DM and Meshing?Thanks.
|
|
April 16, 2015, 03:11 |
|
#11 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
Good Day! There is no way to actually record the script but to hard code it. Are you using Ansys 15 or 16? I was told recently that in 16 there has been lot of documentation on scripting To start with you need to go "Help" section and read about scripting("Ansys Customization"), its quiet useful and then Ansys Customer portal for examples which are very useful to understand the process! Ansys Customization Toolkit (ACT) is the fully documented in Ansys 16 This way you will not only be able to script but will understand how to decode/ debug Ansys functions. If you are stuck at some point then let me know, I can help you get functions for your JS. Cheers KAPI |
|
April 16, 2015, 04:58 |
|
#12 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 12 |
Thanks for the quick reply!!!
I am using Ansys 15 What I want to do in DM is 1. Import external geometry 2. Create Fill with 2 surface 3. Create named selections for inlet and outlet 4. Suppress geometry and form new part of domains |
|
April 16, 2015, 19:48 |
|
#13 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
In Ansys 15: Help> Workbench>Scripting Guide, you should be able to find answers to your questions. They have Usage Examples in that scripting guide as well. Have a go at it and check Customer Portal for Examples. Hope it helps Cheers KAPI |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[ICEM] Problem with ICEM Script Meshing | asal | ANSYS Meshing & Geometry | 2 | March 23, 2013 20:11 |
[ICEM] script for cylinder hexa meshing in ICEM | Far | ANSYS Meshing & Geometry | 0 | May 25, 2012 08:55 |
Singularity of grid?Volume meshing vs face meshing | Ken | Main CFD Forum | 0 | September 4, 2003 12:09 |
Volume Meshing & Face Meshing? singularity of grid | ken | FLUENT | 0 | September 4, 2003 12:08 |