Hi Martin
Thanks again for coming up with a solution, this works great! I changed it
a bit to add a integer stack selection. I was actually surprised it ran the
function before it was defined unlike Python :) Problem is I don't know JS
:P So I tried to loop over "selection" with no avail. I noticed that if I
had several objects selected used selection(0) or selection(1) it did
something accordingly, but apparently I can not use .lenght to define a
loop duration: // ERROR : Object doesn't support this property or method -
[line 30]

I don't know how to loop it... Well, I cal set a fixed number like 999 in
 for (var i = 0; i < selection.length; i++) { and just cope with the out of
range error :)

Thanks
Pedro

// JScript

function delOps(oObj){
var oOpColl = new ActiveXObject( "XSI.Collection" );
var oOpStack = new Enumerator( oObj.ActivePrimitive.ConstructionHistory );
 for (;!oOpStack.atEnd();oOpStack.moveNext()){
if (oOpStack.item().name == stack){
var ModelingFlag = 1;
continue;
}
if (ModelingFlag == 1){
oOpColl.add (oOpStack.item());
}
}
 if (oOpColl.Count>0) DeleteObj( oOpColl ) ;
}

var pickstack = 2;
var stack = ["Modeling", "Shape Modeling", "Animation", "Secondary Shape
Modeling"][pickstack];


//Loop Attempt #1
for (i in selection) {
    delOps(i);
}

//Loop Attempt #1
for (var i = 0; i < selection.length; i++) { // Throws error that selection
doesn't support .length
    delOps(selection(i));
}

On Thu, Jul 23, 2015 at 10:17 AM, Martin Yara <furik...@gmail.com> wrote:

> Just delete them? Or you mean by script
>
> I wrote something similar in JScript to freeze some operators under
> certain stack. I just changed it to delete all operators below the Modeling
> Stack. It only works with 1 object, you'll need to add a loop.
>
> // JScript
>
> delOps(selection(0))
>
> function delOps(oObj){
> var oOpColl = new ActiveXObject( "XSI.Collection" );
> var oOpStack = new Enumerator( oObj.ActivePrimitive.ConstructionHistory );
>  for (;!oOpStack.atEnd();oOpStack.moveNext()){
> if (oOpStack.item().name == "Modeling"){
> var ModelingFlag = 1;
> continue;
> }
> if (ModelingFlag == 1){
> oOpColl.add (oOpStack.item());
> }
> }
>  if (oOpColl.Count>0) DeleteObj( oOpColl ) ;
> }
>
>
> Martin
>
>
> On Thu, Jul 23, 2015 at 5:47 PM, pedro santos <probi...@gmail.com> wrote:
>
>>
>>
>>
>> *HiQuite a few times when I'm adding operators to multiple objects I
>> would also like to clear those objects of any operator. This is not
>> Freezing, as I do not want to apply those operators, but remove them. More
>> over if the above is possible, is it also possible to remove operators only
>> from the modeling stack? Alike one uses Freeze and Freeze modeling
>> differently?Thanks*
>> *Pedro*
>>
>
>


-- 




*------------------------------[image:
http://i153.photobucket.com/albums/s202/animatics/probiner-sig.gif]Pedro
Alpiarça dos Santos Animator  3DModeler  Illustrator >>
http://probiner.x10.mx/ <http://probiner.x10.mx/>*

Reply via email to