Screenshot script

Next
 From:  shayno
5523.1 
Hi Guys

I came across this script a while back which is great to save a screenshot of the active window.

Its doesn't grab the current save filename although it does default to the last used folder

and can it be altered to save automatically as a jpeg as it defaults to png

script:var img = moi.view.screenshot( 'viewpanel', false ); var name = img.getSaveFileName(); if ( name != '' ) img.save( name );


cheers
shayne
  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
5523.2 In reply to 5523.1 
Hi shayne,

> Its doesn't grab the current save filename although it does default to the last used folder

Sorry I don't understand this part - when you say "grab" do you mean you want the filename that's displayed in the upper-right corner of the main window to be included in the screen capture? Or something else?


> and can it be altered to save automatically as a jpeg as it defaults to png
>

There isn't any way to change the initial default, but the way the dialog should work is that once you have used it a single time in a modeling session it should then remember the image file type that you used as the default for the remainder of that same session. So any further screen captures that you do until you exit the program should then use JPG as the default once you have set it to JPG once.

There is not any way set up to change the default for the first use in a session for the file name dialog though.

- 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:  Samuel Zeller
5523.3 In reply to 5523.2 
Right now I'm using this script

script: /* Custom screenshot */ var prev_background = moi.view.viewportBackgroundColor; moi.view.viewportBackgroundColor = 0xFFFFFF; moi.view.lineWidth = 3; moi.grid.display = false; moi.grid.showXYAxes = false; moi.view.showAxisIcon = false; moi.view.meshAngle = 3; moi.ui.getActiveViewport().renderToClipboard( 4200, 2970 ); moi.view.lineWidth = 1; moi.grid.display = true; moi.grid.showXYAxes = true; moi.view.showAxisIcon = true; moi.view.meshAngle = 8; moi.view.viewportBackgroundColor = prev_background;

Is it possible to capture exactly the same ratio than what you see in the viewport ? This script is based on a fixed X and Y pixel dimension and depending on how you resize your MoI app it's not perfect

Like if my viewport is 1200px by 600px I'd like to capture that size but two time the resolution (2400px by 1200px) or three time the resolution
-- shapenoid.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

Previous
Next
 From:  shayno
5523.4 In reply to 5523.2 
Sorry Michael for not being clear
yes I was meaning the drawing name at the top right say ring.3dm
Is it possible to automaticaly save a screenshot as ring.jpg

On my V3 wishlist
Is it possible for MOI to save a thumbnail of the drawing on save so when opening, thumbnails show in the current folder rather than just the filenames


thanks
shayne
  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:  Mauro (M-DYNAMICS)
5523.5 In reply to 5523.4 
<<Is it possible for MOI to save a thumbnail of the drawing on save so when opening, thumbnails show in the current folder rather than just the filenames>>

I agree !!
  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
5523.6 In reply to 5523.3 
Hi DesuDeus,

> Is it possible to capture exactly the same ratio than what you see in the viewport ? This script
> is based on a fixed X and Y pixel dimension and depending on how you resize your MoI app
> it's not perfect
>
> Like if my viewport is 1200px by 600px I'd like to capture that size but two time the resolution
> (2400px by 1200px) or three time the resolution

Currently there's no way to do this because there isn't any method set up for a script to obtain the pixel width and height of the viewport.

But I've added viewport.pixelWidth and viewport.pixelheight properties in for the next v3 beta to make that possible then.

- 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:  Michael Gibson
5523.7 In reply to 5523.4 
Hi shayne,

> Sorry Michael for not being clear
> yes I was meaning the drawing name at the top right say ring.3dm
> Is it possible to automaticaly save a screenshot as ring.jpg

Yup, here's a script that will do that:

script:var img = moi.view.screenshot( 'viewpanel', false ); var filename = moi.geometryDatabase.currentFileName; if ( filename != '' ) { img.save( filename.substring(0,filename.length-3) + 'jpg' ); }

Note that it will just overwrite any existing .jpg of that same name, and it will put it in the same folder as the 3DM file.


> On my V3 wishlist
> Is it possible for MOI to save a thumbnail of the drawing on save so when opening,
> thumbnails show in the current folder rather than just the filenames

It's been on the wishlist for a while, but unfortunately just saving the thumbnail itself is only one piece of the puzzle, I also have to write a couple of different "shell extension" in order to make it possible for the operating system to access the thumbnail as well, by default just storing a thumbnail somewhere inside of a file does not automatically make it visible all on its own.

There's enough fiddling around with doing those that it's been hard to prioritize that work so far.

- 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:  Samuel Zeller
5523.8 In reply to 5523.6 
That would be awesome ! It would be so useful :)
--
shapenoid.com stojan-voumard.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

Previous
Next
 From:  shayno
5523.9 In reply to 5523.7 
Yes we understand you are pretty busy , just a wish
thanks for the above script, at least now when I browse my working folder I can visually see what designs are in there
and open directly from there

Just used it , absolutely fantastic

As an alternative option can this script be run automatically on closing or saving a drawing to create the jpeg

The latest Beta works brilliantly, I think the filleting seems to work a lot better and it seems faster

Many thanks
shayne
  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
5523.10 In reply to 5523.9 
Hi shayne,

> As an alternative option can this script be run automatically on closing
> or saving a drawing to create the jpeg

There isn't really any way currently set up to run scripts at those times, but I guess you could modify the Save.js command script file inside the \commands sub-folder, and paste in that script at the end after the call to moi.geometryDatabase.save().

But that method of saving using the Save command itself will only happen when you do a Ctrl+S or actually click the Save button, not if you close down MoI and save changes at exit time instead.

- 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:  shayno
5523.11 In reply to 5523.10 
Now thats brilliant
That saves so many steps tacking it onto the save command
thanks 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:  coi (MARCO)
5523.12 
Hi Michael!

Would it be possible to utilize rhinos thumbnailviewer

http://wiki.mcneel.com/labs/rhinothumbnailviewer

to display MOI thumbnails?

~ Marco
  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
5523.13 In reply to 5523.12 
Hi Marco,

> Would it be possible to utilize rhinos thumbnailviewer
>
> http://wiki.mcneel.com/labs/rhinothumbnailviewer
>
> to display MOI thumbnails?

I don't think that it would be possible for me to bundle that with the MoI install directly, so I think I'd still need to develop my own separate version as well.

- 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