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

[ANSYS Meshing] Need help with selection of edges using scripting

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 5, 2017, 05:35
Post Need help with selection of edges using scripting
  #1
New Member
 
Join Date: Mar 2017
Posts: 1
Rep Power: 0
studentzz is on a distinguished road
Hi everyone,

I have a problem with selecting edges using scripting in ANSYS Meshing.

I am simulating a 2D flow passing over an airfoil with pressure jump below the airfoil and I am using scripting to automate the process. Without getting into details of the simulation, I first need to create named selection for inlets, outlets, etc to pass it to Fluent solver. I am currently stuck at how to select the edges for my named selection using scripting.

I searched on the web and got one code on creating named selection for every single edge.

but I need to create named selection for specific edges. Can anyone help me with this? How do I select specific edges using scripting in ANSYS Meshing? I am also using VS for debugging, does anyone know how do I access the attributes of edges in VS? like cooridnate info?
Quote:
var ds = DS;
ds.SelectionManager.selectAll(); //select all
var count = ds.SelectionManager.SelectedCount; //get count of selected bodies

//create array for partID and TopoId for each body
var partID = new Array ();
var TopoId = new Array ();
for (i=1;i<=count; i++) {
partID[i] = ds.SelectionManager.SelectedPartID(i);
TopoId[i] = ds.SelectionManager.SelectedEntityTopoID(i);
}

for (i=1;i<=count; i++) {
var part = ds.SelectionManager.PartMgr.PartById(partID[i]);
var brep = part.BRep;
var body = brep.Cell(TopoId[i]);

var edges = body.edges;//get total edges of each body

//loop the edges to get the face partID and topoID.
var edgeCount = edges.Count;
for (j=1;j<=edgeCount; j++) {
edge = edges(j);
var aTopoId = edge.Id;
SM.Clear(); //clear any existing selection
SM.ForceSelect(partID[i], aTopoId); //force select edge based on part id and topo id
name = "NS_" + i + "_" + j;
ds.Script.addNamedSelection(false, name); //create named selection
ds.Script.updateNamedSelectionsToolbar();
SM.Clear();
}

}

SM.Clear();
ds.Script.fillTree();
I have attached my project and code in the attachment. Thanks in advance!
Attached Files
File Type: zip selectedge.zip (192.4 KB, 4 views)
studentzz is offline   Reply With Quote

Old   March 5, 2017, 17:49
Default
  #2
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
how would you tell code to go and select particular edge?
the above code is selecting each edge in the same pattern as it is drawn.

if you have fixed geometry for all the simulation you do then you can see the range from what number edge to what number edge is your "inlet" is being formed and call them.

sorry but I dont have time to go thru your project and fix it. Please try and see how you can code and reach particular edge and then select with similar code posted below

Cheers
KAPI
Kapi is offline   Reply With Quote

Reply

Tags
ansys, meshing, 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
[snappyHexMesh] snappyHexMesh sticking point natty_king OpenFOAM Meshing & Mesh Conversion 11 February 20, 2024 10:12
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 04:21
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 09:54
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 10:38
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11


All times are GMT -4. The time now is 18:44.