MoI discussion forum
MoI discussion forum

Full Version: Scripting Object Visibility?

Show messages:  1-12  13-21

From: shayno
5 Aug   [#13]
Hi Michael
The one key hide unhide script is magic thanks
another on my wishlist is to select all objects of a colour (say gold) and run _cvolume 10 on it, copying the volume cm3 to the clipboard
is this possible please for moi ver4

I am always doing this for gold colour

cheers
shayne
From: Michael Gibson
5 Aug   [#14] In reply to [#13]
Hi shayne,

re:
> another on my wishlist is to select all objects of a colour (say gold) and run _cvolume 10 on
> it, copying the volume cm3 to the clipboard

It would be easiest to do this by making a customized modified version of the _cvolume script.

Please attach the _cvolume .htm and .js files that you currently use and I'll show you what to modify to do those things.

- Michael
From: shayno
5 Aug   [#15] In reply to [#14]
Thanks Michael
uploaded both
cheers Shayne

Attachments:
_CVolume.htm
_CVolume.js


From: Michael Gibson
6 Aug   [#16] In reply to [#15]
Hi Shayne, try this version - instead of using selected objects it will use whatever solids are on style = gold whether selected or not.

And copies volume value to the clipboard.

- Michael

Attachments:
_CVolumeGold.htm
_CVolumeGold.js


From: shayno
10 Aug   [#17]
Thanks Michael
works perfectly
and I changed my old _CVolume.htm to also copy to the clipboard

cheers
shayne
From: shayno
12 Aug   [#18]
Hi Michael
Similar to hide unhide by style
Is it possible to write script to hide / unhide by object name say 'old'
As I cad new rings next to old designs I constantly have to hide/unhide the old one to clear the screen
Moi Ver 4
kind regards
shayne
From: Michael Gibson
12 Aug   [#19] In reply to [#18]
Hi shayne,

re:
> Similar to hide unhide by style
> Is it possible to write script to hide / unhide by object name say 'old'

Try this one:

script: /* Toggle visibility of given name */ var name = 'old'; var item = moi.ui.sceneBrowser.objects.find( name ); if ( item ) { var any_hidden = false; var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length && !any_hidden; ++i ) { var obj = objs.item( i ); if ( obj.name == name && obj.hidden ) { any_hidden = true; } var subobjs = obj.getSubObjects(); for ( var j = 0; j < subobjs.length && !any_hidden; ++j ) { var subobj = subobjs.item(j); if ( subobj.name == name && subobj.hidden ) { any_hidden = true; } } } } if ( any_hidden ) { item.alterStatus( 'show' ); } else { item.alterStatus( 'hide' ); }

- Michael
From: shayno
12 Aug   [#20]
Thanks Michael
I demonstrated and recommended your software to a business associate yesterday , I'm certain he will purchase it.
kind regards
shayne
From: Michael Gibson
12 Aug   [#21] In reply to [#20]
re:
> I demonstrated and recommended your software to a business associate
> yesterday , I'm certain he will purchase it.

Thank you shayne! - Michael

Show messages:  1-12  13-21