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

[DesignModeler] JScript for promoting imported CAD parameters to Workbench and using Named Selections

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2016, 05:24
Default JScript for promoting imported CAD parameters to Workbench and using Named Selections
  #1
New Member
 
CW
Join Date: Jan 2015
Posts: 4
Rep Power: 11
snow720 is on a distinguished road
Hi,

I am having troubles promoting my CAD parameters to workbench with jscript. This is the command achieved in the gui by selecting the paramaters and "checking" them in the list.

I have tried the following code and it doesn't work:

Code:
ag.listview.ActivateItem("DS_Thickness"); 
ag.listview.ItemValue = 40;
ag.listview.SelectedItem.IsChecked="true";
Does anyone know any command that can do this?

Also on another note, does anyone know how to use imported named selections with jscript?

I have one called NS_INNERSURFACE but I was unable to use it with the following command,

Code:
ag.facePick;
agb.AddSelect(agc.TypeFace, NS_INNERSURFACE);
Instead I had to add the following command in front of the above to redefine my named selection before using it,

Code:
var NS_INNERSURFACE = ag.m.ModelFaces(4);
Any help is greatly appreciated. I have tried to search the *.js files in the directories but I get kind of lost as I have limited programming experience.
snow720 is offline   Reply With Quote

Old   September 19, 2016, 22:24
Default
  #2
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
are you activating body before activating its properties?

also check if your NS is coming when you import geometry!
once imported, you can call them with that code

Last edited by Kapi; September 20, 2016 at 02:31.
Kapi is offline   Reply With Quote

Old   September 28, 2016, 07:23
Default
  #3
New Member
 
CW
Join Date: Jan 2015
Posts: 4
Rep Power: 11
snow720 is on a distinguished road
Thanks for the response. Sorry for such a late reply.

I have changed my method and do not need to do the steps as I posted above. Instead I will only use my named selections in the meshing step and for that it is working! I do not know why it did not work in DM as they were being imported correctly.

On a side note (I don't know if I should make a seperate thread for this), I am currently editing my mesh with the listview commands. These work if I set interactive mode to True but do not if I set interactive mode to False. Do you know any method to get these commands to work in batch mode?

I have tried, for example, the command,

Code:
 
var Mesh_Mod = DS.Tree.FirstActiveBranch.MeshControlGroup;
DS.Script.SelectItems(""+Mesh_Mod.ID);
DS.Script.lv.ActivateItem("Physics Preference");
DS.Script.lv.ItemValue = "CFD";
But it does not work. Nor does using ListView instead of DS.Script.lv (Which is what I use that is working in Interactive Mode)
snow720 is offline   Reply With Quote

Old   September 28, 2016, 19:55
Default
  #4
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
I reckon u r after this!

Code:
// access MeshControlGroup
var meshGroup = ds.Tree.FirstActiveBranch.MeshControlGroup;
ds.Script.changeActiveObject(meshGroup.ID);

// specify global mesh settings
meshGroup.PhysicsPreference = 2;
meshGroup.SmoothingOption = 2;
meshGroup.SpanningAngleSF = 10;
meshGroup.MinSizeSF = 0.0001;
meshGroup.MaxFaceElementSize = 0.005;
meshGroup.MaxSizeSF = 0.375;

// update mesh tree
ds.Script.fillTree();
hope it helps!

Cheers
KAPI
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



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