Save image from MOI

 From:  Michael Gibson
1049.32 In reply to 1049.31 
Hi Ambimind, yup I think all that should be possible - note how the script already increases the line width just for the rendering and then puts it back to normal after the snapshot is taken - that's the part of the script that says moi.view.lineWidth = 4; and moi.view.lineWidth = 1;


The grid is made up of 2 parts - the regular grid lines and the darker xy axis lines.

To hide the grid would use this script:

moi.grid.display = false; moi.grid.showXYAxes = false;

and to restore it, say = true instead of = false. These would go sandwiched around the call that does the snapshot just like setting the line width currently.


Hidden line display is controlled in script by:

moi.view.showHiddenLines = true;


Setting the background color is controlled by the moi.view.viewportBackgroundColor property, which takes a 24-bit number made up of 3 bytes packed together, the 3 bytes contain the red, green, and blue values. So something like this should work to set it to red = 25, green = 51, blue = 255:

moi.view.viewportBackgroundColor = (25 << 16) | (51 << 8) | 255;


Constant shading can be done by setting high value for light intensities of the custom light levels under Lighting options, see here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3135.3

To set the lighting style in script, you can use:

moi.view.lightingStyle = 'CustomLevels';

and to restore to default:

moi.view.lightingStyle = 'Default';

You can use the following values for lightingStyle: 'Default', 'MoreFill', 'LessFill', 'KeyOnly', 'CustomLevels', 'Hemispheric', and 'Headlight' - each of these corresponds to an entry in the dropdown that you see in the lighting options dialog.

Then for custom levels to set the levels to a high value, use:

moi.view.customKeyLightLevel = 100.0;
moi.view.customFillLightLevel = 100.0;


You may run into some problems increasing meshing resolution, because that can consume quite a large amount of memory setting that to a tighter value. If you do want to try it, it's settable from script by:

moi.view.meshAngle = 10.0;


So anyway these are the various script calls that you can use to adjust the settings you are asking about - to assemble the script you build it up as one long line of text and put one setting to the left side of the snapshot and the restoring part to the right side of the snapshot.


Let me know if any of these doesn't work as expected.

- Michael