MoI discussion forum
MoI discussion forum

Full Version: Save as script_screenshot with White background

From: phlatt5th (P5TH)
9 Jan 2020   [#1]
Happy New Year Michael and all in the forum! I am happily using Moi with dark mode on one of my computers. I have also been using the save as script Michael cooked up :) which enables a simultaneous screenshot when activated. I find it invaluable for quick identification in my folder. However, I am wondering if it is possible to set it up so that when triggered it defaults to a white background instead of dark gray allowing for saving ink when printing for quick mock ups.
Thanks in advance.
Cheers!
From: nameless
9 Jan 2020   [#2] In reply to [#1]
Happy new year to you too! That sounds like a really cool idea for identifying 3dm files- reminds me of how Smirnov's library works. This thread has my attention! :)
From: Michael Gibson
9 Jan 2020   [#3] In reply to [#1]
Hi phlatt5th, Happy New Year!

Yes it should be possible to modify the script, can you please post the one you are using?

There is a similar "screenshot with white background" here also:
http://moi3d.com/forum/index.php?webtag=MOI&msg=9526.173

- Michael
From: phlatt5th (P5TH)
14 Jan 2020   [#4] In reply to [#3]
Hi Michael, thanks for getting back to me. Sorry for the delay been working on some pressing deadlines.I have attached the script.
I will also check out the link you posted.
Thanks.

Attachments:
SaveAs.js


From: Michael Gibson
14 Jan 2020   [#5] In reply to [#4]
Hi phlatt5th, so to modify that script to make a white background you would insert this just before the call to vp.render() :

code:
var prev_background = moi.view.viewportBackgroundColor;
moi.view.viewportBackgroundColor = 0xFFFFFF;


So what that should do is save the current background color to a variable "prev_background" and then set the background color to white.

Then after the call to vp.render() put in this:

code:
 moi.view.viewportBackgroundColor = prev_background;


That should restore it after the image is generated.

- Michael
From: phlatt5th (P5TH)
15 Jan 2020   [#6] In reply to [#5]
Hello Michael, Sorry to bug you. I attempted to alter the script but was not successful. I must have missed an important step:(
I have attached the butchered script and error message.
Thanks again.

Attachments:
SaveAs 2.js

Image Attachments:
Screen Shot 2020-01-15 at 11.49.11 AM.png 


From: nameless
15 Jan 2020   [#7] In reply to [#6]
Sorry to interject to your discussion, this works wonders for me. You can now get visual feedback for your files, in the save directory.

I followed what Michael said and it seems to work here- I am attaching it below. Thank you for bringing this to my attention, super handy. ;)

ps. I replaced the default SaveAs command in the commands folder (After backing the original up with a rename).

Attachments:
SaveAs.js


From: Michael Gibson
15 Jan 2020   [#8] In reply to [#6]
Hi phlatt5th, your edited script seems fine. That error message looks like MoI cannot find any script named SaveAs in the commands folder. Did you possibly delete your original SaveAs.js file and only have a new one named "SaveAs 2.js" ?

If so rename it to just plain SaveAs.js (no "2" in it) so that the button or keyboard shortcuts that are trying to run the saveas command will be able to find it.

- Michael
From: phlatt5th (P5TH)
15 Jan 2020   [#9] In reply to [#8]
@ nameless thank you :)

I am glad that you find this useful. Moi has been incredibly valuable to me for several years, little additions like these make moi even more a of joy to use daily as a 2D and 3D tool. I am not even close to the amazing talented members on this esteemed forum. However, I have been on board since V1 Michael's great program Moi has made it possible for me (former ludite) to embrace working with 3D software with enthusiasm.

@ Michael, I made that change and all is well. I appreciate you and your brilliant work. Thank you for this great app and the consistent quality development over the years and most of all your willingness to help us all over the years.


Cheers!