-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetin.mel
118 lines (82 loc) · 2.19 KB
/
setin.mel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//v0.1a new dupset()
global proc string[] setin(){
string $set;
string $lssl[] = `ls -sl`;
if (size($lssl) < 2)
return {};
//$set = `ls -set $lssl`;
////////// check complete //////////
$set = $lssl[size($lssl)-1];
$items = stringArrayRemove({$set}, $lssl);
sets -add $set $items;
return $items;
}
global proc string[] setout(){
string $set;
string $lssl[] = `ls -sl`;
if (size($lssl) < 2)
return {};
//$set = `ls -set $lssl`;
////////// check complete //////////
$set = $lssl[size($lssl)-1];
$items = stringArrayRemove({$set}, $lssl);
sets -rm $set $items;
return $items;
}
global proc string[] resetin(){
$lssl = `ls -sl`;
$set = $lssl[size($lssl)-1];
// $items = stringArrayRemove({$set}, $lssl);
sets -cl $set;
$items = setin();
return $items;
}
global proc sortSet(){
string $obj_set;
$lssl = `ls -sl -type objectSet`;
if (size($lssl))
$obj_set = $lssl[0];
select -add $obj_set;
// return $obj_set;
}
global proc string[] getset(){
string $sel, $set;
string $objSets[];
$lssl = `ls -sl`;
for ($sel in $lssl){
$set = doGetSet($sel);
if ($set == "")
continue;
$objSets = stringArrayCatenate({$set}, $objSets);
}
return $objSets;
}
global proc string doGetSet(string $node){
string $objSet;
$ls_set = `listConnections -s 0 -d 1 -type "objectSet" ($node + ".msg")`;
if (size($ls_set)){
$objSet = $ls_set[0];
}
return $objSet;
}
global proc int setinsect(string $lssl[]){
// use two selected sets (select -ne <setA> <setB>)
// A comps will be retained in B comps
// other comps will in B will be removed
// Mgrating comps from setA will not purge setB
if (!size($lssl))
$lssl = `ls -sl -type "objectSet"`;
if (size($lssl) != 2){
return 0;
}
string $removeItems[] = `sets -sub $lssl[1] $lssl[0]`;
sets -rm $lssl[1] $removeItems;
return (size($removeItems));
}
global proc dupset(){
$lssl = `ls -sl -set`;
for ($set in $lssl){
$items = `sets -q $set`;
sets -n $set $items;
}
}