I need to create one Named Selection for every face in the tree, but this is a big model. How can I automate this process?

You can write some JScript to perform this action. The following input can be pasted into a file with a JS extension and run from within Simulation/Mechanical from the Tools menu.

* create one named selection for each face in the geometry
* aaron.acton@ansys.com

var model = DS.Tree.FirstActiveModel;
var assembly = model.PrototypeGroup.Assembly;
var parts = assembly.Parts(true);
var cgroup = model.ComponentGroup;
var i, j, ns;

if(cgroup == null) {
cgroup = model.AddComponentGroup();

for(i = 1; i <= parts.Count; i++) {
partID = parts(i).Id;
faces = assembly.PartById(partID).BRep.Cells(2);
for(j = 1; j <= faces.Count; j++) {
topoID = faces(j).Id;
SM.ForceSelect(partID, topoID);
ns = cgroup.AddComponent(SM);
ns.Name = "Part" + i + "_Face" + (topoID-0x80000000);

Show Form
No comments yet. Be the first to add a comment!