Export active viewport to picture

Next
 From:  krass
6111.1 
Michael, my compliments!
I have a very pressing question: is there a program to export the active viewport to a bitmap (JPG, BMP, etc.)
And if not then is it possible to implement it in any way.
Or may already have a script or plugin that does this?
  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:  Max Smirnov (SMIRNOV)
6111.2 In reply to 6111.1 
Krass, you can use this command: moi.view.screenshot ("3D", false).save("3d.png");
But it's just a screenshot. You can't set picture resolution and disable borders. It's very hard to use this command in scripts, because it catches everything above viewport (dialogs, windows, etc.)

There ia a second method:
moi.ui.mainWindow.viewpanel.getViewport('3D').renderToClipboard(1024, 1024); // Perfect! But you need to use external software to save it :(
var oShell = new ActiveXObject("Shell.Application");
oShell.ShellExecute("NirCmd.exe", "clipboard saveimage 3d.png" , "", "open", "1");

Michael,
is it possible to get something like this?:
moi.ui.mainWindow.viewpanel.getViewport('3D').render(1024, 1024).save("3d.png");

EDITED: 7 Mar 2022 by SMIRNOV

  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)
6111.3 In reply to 6111.2 
hi there!

you could use these scripts:

CaptureViewToClipboard

this renders a larger image of the active viewport and copy it to the clipboard; you can possibly adjust the resolution and the line width
code:
script:var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 4; v.renderToClipboard( 2560, 2560 ); moi.view.lineWidth = 1; }


you can set a whole lot of options there, like line width, resolution or lighting style..

http://moi3d.com/forum/index.php?webtag=MOI&msg=1049.31


CaptureScreenToFile

you can use this script to save a screenshot out to an image file by using a shortcut key, without needing to run any other program.
code:
script:var img = moi.view.screenshot( 'viewpanel', false ); var name = img.getSaveFileName(); if ( name != '' ) img.save( name );


~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
Next
 From:  Michael Gibson
6111.4 In reply to 6111.2 
Hi Max,

> Michael,
> is it possible to get something like this?:
> moi.ui.mainWindow.viewpanel.getViewport('3D').render(1024, 1024).save("3d.png");

I've added this in for the next v3 beta, so your line of script above will work in starting with the next beta release.

That will be a .render( width, height ) script method that will be available on a viewport, it works the same as renderToClipboard() except it returns back an image object rather than only placing data on the clipboard. Then on that image object there are .save() and .getSaveFileName() (to pop up a file dialog to get a file name) that can be used.

- 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:  Max Smirnov (SMIRNOV)
6111.5 In reply to 6111.4 
>I've added this in for the next v3 beta, so your line of script above will work in starting with the next beta release.

Great! Thank you!

script: new ActiveXObject("Sapi.SpVoice").Speak("Thank you 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
 From:  Samuel Zeller
6111.6 In reply to 6111.4 
Awesome ! :)
--
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
 

Reply to All Reply to All