CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (https://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [DesignModeler] DesignModeler Scripting: How to get Full Command Access (https://www.cfd-online.com/Forums/ansys-meshing/105109-designmodeler-scripting-how-get-full-command-access.html)

vigges May 26, 2015 05:31

Hi KAPI,

thanks for your fast reply, but unfortunately, it's not working.
Any other ideas? Otherwise, I'm gonna try it from within Ansys Meshing.

Best regards,
Victor

Kapi May 26, 2015 18:28

Hi Victor,

I have used similar code with bodies and it worked, possible that they have some different code for selecting faces.
I got no other idea to select NS except below code(working code for body)
Code:

agb.AddSelect(agc.TypeBody, NamedSelect1);
So I suggest you go ahead with Ansys meshing and see if it pans out for ya.

Cheers
KAPI

USER1234 August 11, 2015 10:07

Quote:

Originally Posted by BaoBab (Post 494516)
case 2067: sName="ANS_FEATURE_FACE_SPLIT ";break;

Hi,
do you know how to use the FaceSplit function?

I already managed to insert "Split Face":

Code:

ag.gui.CreateFaceSplit();
but I don't actually know how to insert the selected face and the selected spline I want to use for the split function.

Best regards,
Max

Kapi August 12, 2015 21:01

sorry mate, no idea

USER1234 August 19, 2015 06:44

Hi,

I want to change the ModelTolerance (Designmodeler>Units>Model Tolerance>Tight.

I found the following in the "agConstants.js" Script:
Code:

ag.c.ModelTightTol = ag.m.constant("MODEL_TIGHT");
But I actually don't know how to use this code.

Just copy and past the code into my code doesn't work:

Code:

# encoding: utf-8
SetScriptVersion(Version="15.0")
template1 = GetTemplate(
    TemplateName="Static Structural",
    Solver="ANSYS")
system1 = template1.CreateSystem()
geometry1 = system1.GetContainer(ComponentName="Geometry")
geometry1.Edit()
geometry1.SendCommand(Command = """

    ag.gui.NewFile();
    ag.m.ClearAllErrors();
    ag.m.NewSession (true);
    ag.gui.setUnits(ag.c.UnitMillimeter, ag.c.UnitDegree, ag.c.No);

    ag.c.ModelTightTol = ag.m.constant("MODEL_TIGHT");

""")

Best regards
Max

vigges August 19, 2015 07:21

Hey Max,

as far as I can remember (not entirely sure though) the following code snippet should do the trick
Code:

ag.m.ModelPrefs.ModelToleranceType = ag.c.ModelTightTol;
Regards,
Victor

USER1234 August 19, 2015 07:24

thank you .. this one helped me a lot! :)

Best regards,
Max

USER1234 August 20, 2015 04:48

Hi,

does anybody know how to change the number of imported points by scripting? Manually you can achive this by change "Point Feature Limit" (Designmodeler>Tools>Options>DesignModeler>Miscell ane ous)

I found the following code:

Code:

ag.m.PointFeatureLimit
but actually don't know how to use it.

I've tried to do this:

Code:

ag.m.PointFeatureLimit = 3000;
Best regards,
Max

USER1234 September 1, 2015 10:25

Hi,

I have a quite simple question, I guess:

I want to create 2 Points with X,Y,Z in DESIGNMODELER for a FaceSplit feature (I want to AddSelect this 2 Points).

1. How can I create 2 simple Points? I've already managed to insert Points from CoordinateFile but I struggle to insert this 2 points now - I've tried this code, but no point appears in the tree:

Code:

var Pt1 = agb.FPoint(agc.FPointConstruction,agc.FPointManual);
I want to continue to insert the X,Y,Z by listview in Detailsview later, but I need the feature in the Tree first.

2. When I want to AddSelect one of my construction points from the coordinateFile instead, the following code doesn't work (nothing happens):

Code:

var Point1 = GetPoint(1,1);
agb.AddSelect(agc.TypeFPoint,Point1);

I hope somebody can help me.

Best regards,
Max

USER1234 September 3, 2015 03:09

Select Vertices by scripting
 
Hi,
is there any possibility to select the vertices in Designmodeler by scripting?
This one doesn't work :

Code:

var Vertice1 = ag.m.ModelVertices(1);
agb.AddSelect(agc.TypeVertice,Vertice1);

Best regards,
Max

Lainua June 27, 2016 13:52

Create Projection
 
Dear All,

I'm trying to use javascript to automatize a Design Modeler Geometry. Following this post, I've manage to write a significant part of it.

But now, I need to use the command Projection( type: edges on face, direction vector: none, imprint faces: yes and extend edges:No). and, frankly, I don't know how.

Making some research I've found this with OLECOM viewer :
[id(0x00000107), helpstring("method CreateProjection")]
HRESULT CreateProjection([out, retval] IDispatch** piProjection);
and the command:
ag.gui.CreateProjection()

But I don't know how to define the inputs of these functions. I made use of name selection in edges and faces. Maybe it could be easier using names instead of edge and face IDs.

Have you ever used projection command by javascript? Could you provide me with an example?

Thank you very much in advance for your help.

Allen Latt July 25, 2016 02:22

Hello there,

I would like to ask for some Information about python Scripting tutorials or useful documents that can help for my Thesis.
The python script I would like to write is for the Automation of creation of 3D model.
the 3D geometry has been developed and created by manually in Designmodeller. And the steps for creation are always the same. But some parameteters will Change. So, I would like to write a python script to do all the steps that has been created in DM with another Parameters.
Do you know how can i write it? or any useful tutorial where i can find out?

Kapi July 28, 2016 02:03

I dont have any tutorial for it but you can use "help" section in Ansys as they have examples.
Also you can search thru the threads on this website and you will get lot of information

Allen Latt July 29, 2016 04:32

Thanks for your Information ,Kapi.
If I have any question more, please help if you can . :)

Best Regards,
Allen

Kapi July 31, 2016 18:42

sure mate, we are here to help each other

Allen Latt August 10, 2016 06:52

Specific Python Script+Ansys Workbench
 
1 Attachment(s)
Hello Dear all,

Good Afternoon!

I would like to request for help from you all. If someone can help me, I would be really glad. I am stuck on this thing. I will mention about what I would like to do. And you all can give me your suggestion or opinion or commands for this.
It is about Python script for AnsysWorkbech.

Let me tell you details.

The description below is what I would like to do;

"In AnsysWorkbench, I created the geometry domain . In this domain, I created the geometry. And then I took out the Input Parmaters as Parameter Set. In that Parameter Set, there are variable parameters than can change some parts of geometry.

And then I have Excel Sheet outside of the AnsysWorkbench. In this Excel Sheet, I have the table of the variable parameters as the same as Parameters (in AnsysWorkbench Parameter Set).


And then I would like to write a python script file in my computer.


When I run that python script, the following work has to be done automatically;

1-The Workbench file should be open automatically

2-The variable parameters from Table of my excel sheet should be placed automatically Input Parameters (in the Parameter Set) in Workbench

3-The edited geometry should be done in Geometry Domain."


or may be there is another input type for variable can be done.

"In AnsysWorkbench, I created the geometry domain . In this domain, I created the geometry. And then I took out the Input Parmaters as Parameter Set. In that Parameter Set, there are variable parameters than can change some parts of geometry.

And then I have .txt file outside of the AnsysWorkbench. In this text file , I have variable parameters as the same as Parameters (in AnsysWorkbench Parameter Set).


And then I would like to write a python script file in my computer.


When I run that python script, the following work has to be done automatically;

1-The Workbench file should be open automatically

2-The variable parameters from .txt file(text file) should be placed automatically Input Parameters (in the Parameter Set) in Workbench

3-The edited geometry should be done in Geometry Domain."

Thanks for giving your time to read and answer this. I am stuck in this.
And please kindly find the attached document to know my workflow in Ansys Workbench

Best Regards,Attachment 49801

Kapi August 10, 2016 18:57

hey mate,

I suggest you to first go thru few tutorials of DM and Mesh and
look up scripting in help section of Ansys
look up scripting on this website
look up how to create script in Ansys on google

something like this Link

Once you are done with this, you will have good clue what to do!!
reading and reading and understanding can only help in scripting!!

Do you have some basic knowledge of Python?

Kapi August 10, 2016 19:05

Check this Link as well

Allen Latt August 16, 2016 14:16

Thank you so much! Kapi
I have read these books.

I am a new user to Python.

I have a question again. :D
how to open .bat file by running python script(command lines)? Can someone have an idea with that?

Kapi August 16, 2016 19:15

post below line in your .bat file and it should open your .WBJN file!

Code:

"C:\Program Files\ANSYS Inc\v160\Framework\bin\Win64\RunWB2.exe" -I -R project1.wbjn


All times are GMT -4. The time now is 01:08.