Modifying this script to save screenshot to file?
All  1-3  4-7

Previous
Next
 From:  Michael Gibson
7655.4 In reply to 7655.1 
Hi Chipp, also check out here for a version that will pop up a dialog box to ask you for the file name for the image file, if you want that:
http://moi3d.com/forum/index.php?webtag=MOI&msg=7542.2

These won't save as a transparent PNG though, the viewport background will be in there.

But if you export to AI or PDF format, the shaded image in those will have a transparent background. For PDF format the image is embedded in the PDF file, for AI format the image will be a separate .png file alongside the .ai file, the png file will have a "_bkgnd" appended to the file name like: filename_bkgnd.png

- 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

Message 7655.5 deleted 5 Oct 2015 by CHIPPWALTERS

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7655.6 In reply to 7655.5 
Try this one:
code:
script: /* Save to PNG */
var vp = moi.ui.getLastClickedViewport();
if (!vp) { vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); }
var filename = moi.filesystem.GetSaveFileName( 'Save', ' (*.png)|*.png' );
var st = [], settings  = ["view.viewportBackgroundColor", "view.lineWidth", "grid.display", "grid.showXYAxes", "view.showAxisIcon", "view.meshAngle"];
for (var sv in settings) { st.push(moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] ); } 
moi.view.viewportBackgroundColor = 0xFFFFFF; 
moi.view.lineWidth = 3; 
moi.grid.display = false; 
moi.grid.showXYAxes = false; 
moi.view.showAxisIcon = false; 
moi.view.meshAngle = 3; 
vp.render( 4000, 2500 ).save(filename);
for (var sv in settings) { moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] = st.shift(); }
  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:  chippwalters
7655.7 In reply to 7655.6 
YAY Max!

Works PERFECTLY! :-)

For those who don't want to remove the CRs:

code:
script: /* Save to PNG */ var vp = moi.ui.getLastClickedViewport(); if (!vp) { vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); } var filename = moi.filesystem.GetSaveFileName( 'Save', ' (*.png)|*.png' ); var st = [], settings  = ["view.viewportBackgroundColor", "view.lineWidth", "grid.display", "grid.showXYAxes", "view.showAxisIcon", "view.meshAngle"]; for (var sv in settings) { st.push(moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] ); }  moi.view.viewportBackgroundColor = 0xFFFFFF;  moi.view.lineWidth = 3;  moi.grid.display = false;  moi.grid.showXYAxes = false;  moi.view.showAxisIcon = false;  moi.view.meshAngle = 3;  vp.render( 4000, 2500 ).save(filename); for (var sv in settings) { moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] = st.shift(); }

EDITED: 6 Oct 2015 by CHIPPWALTERS

  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

 

 
 
Show messages: All  1-3  4-7