purge unused layers

Next
 From:  okapi
3774.1 
is there a command for purging unused layers, or a script that can do that?
Thanks,
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3774.2 In reply to 3774.1 
Hi okapi, here's a script that should do it. Add in a new shortcut key and paste in the following for the Command part:

script:var gd = moi.geometryDatabase; var styles = gd.getObjectStyles(); var counts = new Array(styles.length); for ( var i = 0; i < counts.length; ++i ) { counts[i] = 0; } var objs = gd.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.styleIndex < counts.length ) ++counts[obj.styleIndex]; var subobjs = obj.getSubObjects(); for ( var j = 0; j < subobjs.length; ++j ) { var subobj = subobjs.item(j); if ( subobj.styleIndex < counts.length ) ++counts[subobj.styleIndex]; } } for ( var i = 0; i < styles.length; ++i ) { if ( counts[i] == 0 ) styles.item(i).remove(); }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  okapi
3774.3 
as always, I am amazed at how quick you are Michael!
Thanks a lot,
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
3774.4 
does this script kill the empty layer? (his name)
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3774.5 In reply to 3774.4 
Hi Pilou, yes it deletes any layers (styles) that have no objects assigned to them.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Frenchy Pilou (PILOU)
3774.6 In reply to 3774.5 
Thx for precision
One more for http://moiscript.weebly.com/ :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All