Can I use JScript to loop over all of the connections and write out the named selection to which it is scoped?


Yes, some modification may be necessary, but please try something like the following:

/*
* Write Contact Region Information
*
* Aaron C Acton
* Technical Services Engineer
* ANSYS, Inc.
* aaron.acton@ansys.com
*/

var defineByNamedSelection = 1;
var connections = DS.Tree.FirstActiveBranch.ContactRegions;
var components = DS.Tree.FirstActiveBranch.Components;

var filename = "C:scratchconnections.csv";

writeContactRegionInfo();

function writeContactRegionInfo() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile(filename, true);
var line;
for(var i=1; i<=connections.Count; i++) {
if(connections(i).GeometryDefineBy == defineByNamedSelection) {
line = connections(i).Name + ","
+ getComponentName(connections(i).SourceComponentSelection) + ","
+ getComponentName(connections(i).TargetComponentSelection);
file.writeLine(line);
}
}
file.Close();
WBScript.Out("Connection information written to " + filename, true, "Message");
}

function getComponentName(id) {
var name = "";
for(var i=1; i<=components.Count; i++) {
if(components(i).ID == id) {
name = components(i).Name;
}
}
return name;
}





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