CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[DesignModeler] DesignModeler Scripting: How to get Full Command Access

Register Blogs Community New Posts Updated Threads Search

Like Tree14Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2015, 05:31
Default
  #21
Member
 
Join Date: Oct 2011
Posts: 36
Rep Power: 14
vigges is on a distinguished road
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
vigges is offline   Reply With Quote

Old   May 26, 2015, 18:28
Default
  #22
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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
Kapi is offline   Reply With Quote

Old   August 11, 2015, 10:07
Default
  #23
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
Quote:
Originally Posted by BaoBab View Post
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
USER1234 is offline   Reply With Quote

Old   August 12, 2015, 21:01
Default
  #24
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
sorry mate, no idea
Kapi is offline   Reply With Quote

Old   August 19, 2015, 06:44
Default
  #25
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
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
USER1234 is offline   Reply With Quote

Old   August 19, 2015, 07:21
Default
  #26
Member
 
Join Date: Oct 2011
Posts: 36
Rep Power: 14
vigges is on a distinguished road
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 likes this.
vigges is offline   Reply With Quote

Old   August 19, 2015, 07:24
Default
  #27
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
thank you .. this one helped me a lot!

Best regards,
Max
USER1234 is offline   Reply With Quote

Old   August 20, 2015, 04:48
Default
  #28
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
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 is offline   Reply With Quote

Old   September 1, 2015, 10:25
Default
  #29
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
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 is offline   Reply With Quote

Old   September 3, 2015, 03:09
Default Select Vertices by scripting
  #30
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
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
USER1234 is offline   Reply With Quote

Old   June 27, 2016, 13:52
Default Create Projection
  #31
New Member
 
Lainu
Join Date: Jun 2016
Posts: 1
Rep Power: 0
Lainua is on a distinguished road
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.
Lainua is offline   Reply With Quote

Old   July 25, 2016, 02:22
Default
  #32
New Member
 
Aung Ko Latt
Join Date: Jul 2016
Location: Germany
Posts: 12
Rep Power: 9
Allen Latt is on a distinguished road
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?
Allen Latt is offline   Reply With Quote

Old   July 28, 2016, 02:03
Default
  #33
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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
Kapi is offline   Reply With Quote

Old   July 29, 2016, 04:32
Default
  #34
New Member
 
Aung Ko Latt
Join Date: Jul 2016
Location: Germany
Posts: 12
Rep Power: 9
Allen Latt is on a distinguished road
Thanks for your Information ,Kapi.
If I have any question more, please help if you can .

Best Regards,
Allen
Allen Latt is offline   Reply With Quote

Old   July 31, 2016, 18:42
Default
  #35
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
sure mate, we are here to help each other
Kapi is offline   Reply With Quote

Old   August 10, 2016, 06:52
Red face Specific Python Script+Ansys Workbench
  #36
New Member
 
Aung Ko Latt
Join Date: Jul 2016
Location: Germany
Posts: 12
Rep Power: 9
Allen Latt is on a distinguished road
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,Workbench View.jpg
Allen Latt is offline   Reply With Quote

Old   August 10, 2016, 18:57
Default
  #37
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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 is offline   Reply With Quote

Old   August 10, 2016, 19:05
Default
  #38
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Check this Link as well
Kapi is offline   Reply With Quote

Old   August 16, 2016, 14:16
Default
  #39
New Member
 
Aung Ko Latt
Join Date: Jul 2016
Location: Germany
Posts: 12
Rep Power: 9
Allen Latt is on a distinguished road
Thank you so much! Kapi
I have read these books.

I am a new user to Python.

I have a question again.
how to open .bat file by running python script(command lines)? Can someone have an idea with that?
Allen Latt is offline   Reply With Quote

Old   August 16, 2016, 19:15
Default
  #40
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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
Kapi is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotor 67 full compressor geometry jf Main CFD Forum 3 January 28, 2024 05:14
[ICEM] ICEM Scripting Issues tylerplowright ANSYS Meshing & Geometry 33 September 27, 2021 16:35
Physical size of geometry in DesignModeler Michael Rasmussen CFX 9 June 16, 2017 03:27
[DesignModeler] find features of Gambit in DesignModeler code_source ANSYS Meshing & Geometry 13 April 30, 2014 07:33
[Other] exchange of parameter values between TurboGrid and DesignModeler in Workbench la7low ANSYS Meshing & Geometry 2 February 21, 2011 15:12


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