HideToHidden –> HideToTrash?

Next
 From:  Jay (JAYGEE)
7076.1 
Script: HideToHidden – hide selected objects, and assign to style = Hidden

script: /* Hide selected objects, and assign to style = Hidden */ var gd = moi.geometryDatabase; var styles = gd.getObjectStyles(); var si = -1; for ( var i = 0; i < styles.length; ++i ) { if ( styles.item(i).name.search( /hidden/i ) != -1 ) si = i; } if ( si == -1 ) { var style = gd.addStyle(); style.name = 'Hidden'; si = style.index; } var objects = gd.getSelectedObjects(); objects.setProperty( 'styleIndex', si ); objects.setProperty( 'hidden', true );

Is there a way to change this script that way that the selected item are moved to a Style named "Trash" and to use this command separately to the "HideToHidden"- Command?
I didn't get it. Just to change the name "Hidden" doesn't give the desired result. I'm confused...
  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:  coi (MARCO)
7076.2 In reply to 7076.1 
.. that should do the trick

script: /* Hide selected objects, and assign to style = Trash */ var gd = moi.geometryDatabase; var styles = gd.getObjectStyles(); var si = -1; for ( var i = 0; i < styles.length; ++i ) { if ( styles.item(i).name.search( /trash/i ) != -1 ) si = i; } if ( si == -1 ) { var style = gd.addStyle(); style.name = 'Trash'; si = style.index; } var objects = gd.getSelectedObjects(); objects.setProperty( 'styleIndex', si ); objects.setProperty( 'hidden', true );
  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
7076.3 In reply to 7076.1 
Thanks Marco!

Yes Jay - to change that particular script there are 3 places in it that have the name 'hidden' - you need to change only the first 2 because those are the ones referring to the style name. The third one is referring to the object.hidden object property that controls whether an object is hidden or not rather than a label name.

If you only changed one of the 2 style related ones, or changed the 3rd object property one you would not get the right result.

- 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:  Jay (JAYGEE)
7076.4 
Thank you very much Marco,
thank you very much Michael!
Good to have a script that works so I could figure out my mistake:
I tried it that way - it's a bit embarrassing- but my quotation mark was changed automatically by the text editor.


  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:  Michael Gibson
7076.5 In reply to 7076.4 
Hi Jay, your text editor sabotaged you! ;)

Sometimes the fancier "word processing" type editors can be bad for editing program code since they can sometimes mutate the text like that.

- 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
 

Reply to All Reply to All