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

Ansys - AddToSelection By Body Name.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 23, 2012, 12:21
Default Ansys - AddToSelection By Body Name.
  #1
New Member
 
Aleksei Kazakov
Join Date: Aug 2012
Posts: 1
Rep Power: 0
eexak17 is on a distinguished road
I am trying to make a function that will select all bodies with the predefined name. Unfortunately I am novice in Ansys and eventually have made a mistake which I can't identify. Could you please assist me with that? Do you know a good debugger to advice?


function main2(name){
var target_name=name;
SM.Clear();
// Select all entities
SC.doEditSelectAll();
// Number of selected bodies

var num_selected_bodies = SM.Parts;
var num_selected_entities = SM.SelectedCount;

// Arrays to save IDs
var PartID = new Array();
var TopoID=new Array();
var j=0;

// Loop through selection and store IDs
for (i=1;i=num_selected_entities;i++) {
var entityTopoId = SM.SelectedEntityTopoID(i);
if (entityTopoId >=3221225473) {//For bodies only
TopoID[j]=SM.SelectedEntityTopoID(i);
PartID[j]=SM.SelectedPartID(i);
j++;
}}

var array_length=PartID.length;
SM.Clear();

// Loop through parts by IDs
for (i=0;i=array_length;i++)
{
var part = SM.PartMgr.PartById(PartID[i]);
if (part.Name.toLowerCase()==target_name.toLowerCase( )) {
part_id=PartID[i];
topo_id=TopoID[i];
SM.AddToSelection(part_id, topo_id, true);
}}}
eexak17 is offline   Reply With Quote

Reply

Tags
ansys, javascript mistake, scripting


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
Fluid structure interaction jnattia Main CFD Forum 25 May 21, 2015 09:16
How find Drag coefficient of a body with ANSYS CFX Jhonathan CFX 2 October 2, 2008 18:07
Exporting results from CFX to ANSYS ?? sohail ahmed CFX 1 December 20, 2007 01:10
demo free flow blunt body in cfx ansys 11 jan CFX 1 July 31, 2007 19:44
allowable body size in ANSYS Workbench 8.1 Atit Koonsrisuk CFX 1 January 5, 2005 12:40


All times are GMT -4. The time now is 14:20.