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

[ANSYS Meshing] Script Model - Mechanical

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2015, 18:35
Default
  #21
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Max,

If I understand your problem correctly, you need to call excel file by below code in your JS file and then create a button or something to send the values calculated to your new simulation.

Code:
var excel_file;
excel_file = GetObject("C:\\Users......\\excel1.xlsm");
Hi Joxen,

I hope you are calling snippet by the given names. What happens when you choose Item(2)? does it suppress the snippet you want to suppress?


Cheers
KAPI
Kapi is offline   Reply With Quote

Old   July 28, 2015, 02:39
Default
  #22
New Member
 
Joakim
Join Date: Jul 2015
Posts: 14
Rep Power: 10
joxen is on a distinguished road
Quote:
Originally Posted by Kapi View Post
Hi Max,

If I understand your problem correctly, you need to call excel file by below code in your JS file and then create a button or something to send the values calculated to your new simulation.

Code:
var excel_file;
excel_file = GetObject("C:\\Users......\\excel1.xlsm");
Hi Joxen,

I hope you are calling snippet by the given names. What happens when you choose Item(2)? does it suppress the snippet you want to suppress?


Cheers
KAPI
Hi,
It doesn't suppress when I call them with item. So if the snippet name is: Post, the code should be... DS.....AnswerSet.Code() ?

Regards
joxen is offline   Reply With Quote

Old   July 28, 2015, 18:36
Default
  #23
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Joxen,

Could you post your code here, so that we can have better look?
If it is not suppressing with item then we have to think of different approach to pick that item.

Cheers
KAPi
Kapi is offline   Reply With Quote

Old   July 30, 2015, 01:48
Default
  #24
New Member
 
Joakim
Join Date: Jul 2015
Posts: 14
Rep Power: 10
joxen is on a distinguished road
Quote:
Originally Posted by Kapi View Post
Hi Joxen,

Could you post your code here, so that we can have better look?
If it is not suppressing with item then we have to think of different approach to pick that item.

Cheers
KAPi
My command snippet is called "Pressure" qnd located at position 16.

Of course here comes the code with the item, this doesn't work.

Code:
var SelExtMoment = DS.Tree.FirstActiveBranch.Environment.Loads.Item(16);
DS.Script.changeActiveObject(SelExtMoment.ID);
ListView.ActivateItem("Suppressed");
ListView.ItemValue="No";
I've also tried:

Code:
var SelExtMoment = DS.Tree.FirstActiveBranch.Environment.Loads.Pressure(1);
DS.Script.changeActiveObject(SelExtMoment.ID);
ListView.ActivateItem("Suppressed");
ListView.ItemValue="No";
Code:
var SelExtMoment = DS.Tree.FirstActiveBranch.Environment.Loads.Commands(1);
DS.Script.changeActiveObject(SelExtMoment.ID);
ListView.ActivateItem("Suppressed");
ListView.ItemValue="No";
Code:
var SelExtMoment = DS.Tree.FirstActiveBranch.Environment.Pressure(1);
DS.Script.changeActiveObject(SelExtMoment.ID);
ListView.ActivateItem("Suppressed");
ListView.ItemValue="No";
Thanks for your help
joxen is offline   Reply With Quote

Old   July 30, 2015, 19:35
Default
  #25
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Joxen,

last 3 codes will not work cuz to pick any item in tree you have to use "Item()"
So the first code you posted is valid.
You say Pressure is located at position 16 but have you confirmed that when your code runs Item(16) goes to Pressure?
Use a debugger and see what it is doing and what value you are getting at Item(16) that way you have your solution.


Cheers
KAPI
Kapi is offline   Reply With Quote

Old   July 31, 2015, 04:04
Default
  #26
New Member
 
Joakim
Join Date: Jul 2015
Posts: 14
Rep Power: 10
joxen is on a distinguished road
Quote:
Originally Posted by Kapi View Post
Hi Joxen,

last 3 codes will not work cuz to pick any item in tree you have to use "Item()"
So the first code you posted is valid.
You say Pressure is located at position 16 but have you confirmed that when your code runs Item(16) goes to Pressure?
Use a debugger and see what it is doing and what value you are getting at Item(16) that way you have your solution.


Cheers
KAPI
Hi
That's the problem, if I have my APDL-command at position 16 and pick item 15, I access the load above (of course) but if i pick item (16) which should be the next one (the APDL Command) I'll get the load after the APDL which in the tree structure is item (17).
So my problem is, should I be able to handle the APDL command with item() or is there an other command to access the APDL Command Snippets?


Cheers
/Joxen
joxen is offline   Reply With Quote

Old   August 2, 2015, 22:28
Default
  #27
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Joxen,

You should be able to use Item() to pick the pressure but I am not sure why it is skipping it.
I am sure you have tried everything mentioned below if not then try to see
- Check if the "SelExtMoment.ID" you are using is correct for the item
- Is it Manually suppressing the item or giving error?
- try to put something else at item(16) and see if its working.
- Go to each and every line of your code and see what values you are getting at variables(check if they are empty or Null or error)

Sorry mate,not able to see why it is not working!
Keep trying!

Cheers
KAPI

Last edited by Kapi; August 7, 2015 at 00:00.
Kapi is offline   Reply With Quote

Old   August 7, 2015, 04:04
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" (Mechanical>Tools>Options>DesignModeler>Miscellane ous)

Best regards,
Max
USER1234 is offline   Reply With Quote

Old   August 9, 2015, 18:41
Default
  #29
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Max,

Just did a quick search in Help section.
For coordinate files for scripting it says:
Quote:
5. Number of points is limited to the value set in the Options dialog box (see the Point Feature Limit setting under the ANSYS DesignModeler application's Miscellaneous settings in the Options dialog box).
Which I presume means that if you are using coordinate file then "point feature limit" is same as in options, means cant be changed thru script.
Thats my interpretation, I could be wrong tho!

Cheers
KAPI
Kapi is offline   Reply With Quote

Old   August 11, 2015, 07:43
Default
  #30
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
Hi Kapi,

in default it is set to 2000 points. I just want to change it to 10000 points (this is the maximum which you can input manually).

Best regards,

Max
USER1234 is offline   Reply With Quote

Old   August 11, 2015, 18:46
Default
  #31
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Max,

I understand it is set to 2000 but as per my previous post, I think you will not be able to change it with scripting!

Anyways, try to do this
Open workbench, change number of points to 10000, save it, close it.
Open new session of workbench, go to settings and see if its 2000 or 10,000. If its 10,000 then use your script normally ,it shall pick 10K.
If its still 2000 then I cant help you, sorry

Cheers
KAPI
Kapi is offline   Reply With Quote

Old   August 20, 2015, 04:21
Default
  #32
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
Hi,

I found the following code but actually on't know how to use it:

Code:
ag.m.PointFeatureLimit
I tried this:

Code:
ag.m.PointFeatureLimit = 3000;
Sorry, I just realized, that this is offTopic and should be placed in the Designmodeler Thread!

Best regards,
Max
USER1234 is offline   Reply With Quote

Old   September 21, 2015, 03:30
Default Select body in Mechanical by scripting
  #33
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
Hi,
does anybody know how to select a body in Mechanical (Workbench) by scripting? I have two bodies and need to select the first one.

Best regards
Max
USER1234 is offline   Reply With Quote

Old   September 25, 2015, 09:19
Default
  #34
Member
 
Max
Join Date: May 2015
Posts: 48
Rep Power: 10
USER1234 is on a distinguished road
Hi,

does anybode know how to delete a mechanical solution (totalDisplacement) by script?

Best regards,
Max
USER1234 is offline   Reply With Quote

Reply

Tags
ansys, mechanical, mesh, model, script


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
Atomization and Breakup model xck1986 OpenFOAM 4 May 31, 2014 04:43
manualInjection model in sprayFoam Mentalo OpenFOAM Running, Solving & CFD 1 April 2, 2014 09:29
Mixture model + VOF? blacksoil2012 Fluent Multiphase 2 February 8, 2014 23:59
eddy dissipation model: combustion doesn't occur roukaia FLUENT 0 December 24, 2011 09:10
Problems bout CFD model of biomass gasification, Downdraft gasifier wanglong FLUENT 2 November 25, 2009 23:27


All times are GMT -4. The time now is 03:16.