Calling OctaneSU Exporter from another script

Forums: Calling OctaneSU Exporter from another script
SketchUp Integrated Plugin (Integrated Plugin maintained by OTOY)

Calling OctaneSU Exporter from another script

Postby ppoublan » Fri Mar 29, 2013 11:07 am

ppoublan Fri Mar 29, 2013 11:07 am
Dear all,
I would like to call the export and render functions of Octane exporter from another Sketchup Ruby script without having the webdialog opened.
Just run the render.
Do not want to use SU Pro Obj exporter and run my own cmd line cause I really want to use the GREAT colors correction included into the TIG exporter.
(To be able render multiple SU files).
Do you think it is feasible ? Does anybody already has done this and could share sample ?
Yours
Pascal
ppoublan
Licensed Customer
Licensed Customer
 
Posts: 56
Joined: Fri Nov 18, 2011 8:47 am

Re: Calling OctaneSU Exporter from another script

Postby TIG » Fri Mar 29, 2013 12:28 pm

TIG Fri Mar 29, 2013 12:28 pm
You can simply Export the OBJ/MTL data from the SKP without starting a Octane or a render.
It is simply a matter of clicking the 'other button' !
Capture.PNG

Once you have an OBJ you can easily make a cmd file that loads it and opens Octane and renders.
To get an example of the cmd code simply start a Render with the Exporter [with settings as you like] AND while the dialog is still open the temporary cmd files that are made with the SKP are available for copying [there are two - a starter and a main file]. Once the dialog closes the cmd file's are auto-deleted. Use the copies as templates to make new ones using your own OBJ/MTL sets that can be Exported without instigating Octane or a render...
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Calling OctaneSU Exporter from another script

Postby ppoublan » Fri Mar 29, 2013 3:43 pm

ppoublan Fri Mar 29, 2013 3:43 pm
Thanks TIG,
Yes I have seen the export button and this is what I'm doing now manually.
The need :
I have a script that use Sketchup Pro obj exporter to create the obj file and that creates command lines for octane render
I would like to use your exporter in place cause the color correction.
I wanted the script to export and render many sketchup files (~100) without manually activating the menu and clicking on the button for each one.
If any tips on how to do that
Yours
ppoublan
Licensed Customer
Licensed Customer
 
Posts: 56
Joined: Fri Nov 18, 2011 8:47 am

Re: Calling OctaneSU Exporter from another script

Postby TIG » Fri Mar 29, 2013 4:31 pm

TIG Fri Mar 29, 2013 4:31 pm
I don't think it's possible.
It not set up for just one part to run...

You'd have to setup the Exporter for each SKP anyway, so clicking a button is hardly an extra hardship.
There is my stand-alone OBJexporter that is similar, however I don't think it does the Octane specific color correction, so it is little different from the Pro OBJexporter you have !

It'd be possible to set up a Ruby batch file that would open all SKPs in a particular folder, automatically open the Exporter etc [just use the same code that opens the dialog for the toolbar button OR the simple command 'octane'] but you'd need to click the button by hand and how would it know when you are done and to move on to the next one ?

You might be better of writing a simple tool [using IO.readlines(mtlfile)...] to process the colors inside a premade MTL from the Pro OBJexporter...
find all of the 'lines' starting 'Ka ' and 'Kd ', and remake their three RGB values adjusted by r=r**2.2 etc...
Raising an RGB value to the power of 2.2 has the affect of adjusting its 'linear gamma' to better suit Octane...
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Calling OctaneSU Exporter from another script

Postby TIG » Fri Mar 29, 2013 5:09 pm

TIG Fri Mar 29, 2013 5:09 pm
Here's a script to do the batch conversions... unzip the rb from the attached archive and put it into your Plugins folder and restart Sketchup...

Copyright 2013, TIG (c)
Permission to use, copy, modify, and distribute this software for any
purpose, and currently without fee, is hereby granted, provided that
this text and the above copyright (c) notice appear in all copies.
This software is provided "as is" and without any express or implied
warranties, including, without limitation, the implied warranties of
merchantability and fitness for a particular purpose.
###
Usage:
TIG.mtlgamma4octane
typed into the Ruby Console + <enter>
###
Action:
Converts all MTL files in the selected folder into Octane friendly Linear Gamma
format for Ka/Kd RGB values [**2.2], the originals are renamed with a .OLD
suffix, useful if you decide to revert then you can delete/rename them...
###
Donations:
Via PayPal.com info @ revitrev.org
###
Version:
1.0 20130329 First Issue


#
Attachments
TIG-mtlgamma4octane.zip
(1.14 KiB) Downloaded 203 times
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Calling OctaneSU Exporter from another script

Postby ppoublan » Fri Mar 29, 2013 6:17 pm

ppoublan Fri Mar 29, 2013 6:17 pm
Hi TIG,
Thanks for your help.

I also found this way :

for each skp file
Sketchup.active_model.set_attribute("Octane", "project_name", myname)
#call octane sketchup exporter
oct=Octane.new
oct.export()
create command line
call
wait for output png file to exist and continue with next file
ppoublan
Licensed Customer
Licensed Customer
 
Posts: 56
Joined: Fri Nov 18, 2011 8:47 am

Re: Calling OctaneSU Exporter from another script

Postby TIG » Sat Mar 30, 2013 1:18 pm

TIG Sat Mar 30, 2013 1:18 pm
Well done, I never thought of doing it that way... I'm only the Ruby guru ;)
[I was tired :roll: ]
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Return to SketchUp


Who is online

Users browsing this forum: No registered users and 15 guests

Fri Apr 19, 2024 4:20 pm [ UTC ]