Learn scripting for rhino, where to start?

batchrendering
renderbatch

#1

Hi,

I want to try scripting.
simple macros were always fine for me but lately they make my wip crash or behave unexpected.

usecase: renderbatch

I used to do it like this:
_SetViewToSpotlight _-SelName view01
_EnterEnd
_Render
_-SaveRenderWindowAs C:\folder\filename-01.png
_CloseRenderWindow

my method is to use turned off spotlights as views in the scene. I set up as much views/spotlights as I need and name/number them.
the macro just hops the view into the different spotlights, renders, saves and closes and then of course - repeats.
since a view wips this macro doesn’t wait for the rendering to finish but instead immediately saves and closes the rendering - I need a more reliable approach now.

I hope you can just give me some tips where to start learning basic scripting for rhino. tutorials, etc.

EDIT:
I downloaded the “RhinoScript101” pdf but I’m not sure if this brings me to what I want.
should I start with Rhino-Python instead of RhinoScript?


Macros and Rendering Crashes
Thea Batch Render
#2

I found this RhinoScript, just what I need, seemed perfect at first. uses NamedViews instead of Spotlights. I probably shouldn’t misuse spotlights for this purpose anyway.
BUT:
it’s just the same as with the macro. saves and closes the renderwindow before the renderings is finished.
so that bug also prevents the use of script in this regard.

BUG or am I doing something wrong here?


#3

I would recommend rhinopython…faster to learn and more contemporary :stuck_out_tongue:


(Dale Fugier) #4

Hi @hitenter,

Here is a good place to start:

– Dale


#5

@Angel yes, rhinopython looks more sexy to me

@dale thanks for the link, seems to be like a good hub to start.

but what about the bug i described - do you experience it too or is it just me?


(Dale Fugier) #6

Hi @hitenter,

This macro seems to work for me:

_-SelNone
_-SelName Spotlight0
_-SetViewToSpotlight
_-SelNone
_-Render
_-SaveRenderWindowAs "C:\Users\Dale\Desktop\test.png"
_-CloseRenderWindow

– Dale


#7

hm,
tried yours but same again here. rhino crashes. I use the latest wip.
it’s strange because sometimes it makes rhino crash and other times it doesn’t crash but saves and closes directly after the rendering started.

maybe i should try a reinstall or repair.


(Dale Fugier) #8

Hi @hitenter

I am not getting a crash using the Rhino WIP.

Are you submitting your crash information?

If perform the macro steps manually, does the Rhino WIP crash?

– Dale


#9

@dale, yes I’m always sending the crash info

and I just noticed. the crash only happens when cycles is the selected renderer - with the rhino renderer enabled it works just fine. so have you tried it with cycles too?


(Dale Fugier) #10

@nathanletwory,

I am able to repeat the crash the customer is experiencing with the attached file.

CyclesCrash.3dm (32.6 KB)

Open this model, set Cycles as the current Renderer, open the MacroEditor panel and run this script:

_-SelNone
_-SelName Spotlight0
_-SetViewToSpotlight
_-SelNone
_-Render
_-SaveRenderWindowAs "C:\Users\Dale\Desktop\test.png"
_-CloseRenderWindow

Here is the DotNet dump.

RhinoDotNetCrash.txt (861 Bytes)

I’ve also submitted the crash info using Rhino’s crash reporting dialog.

Thanks,

– Dale


#11

great, it’s not only me.
I hope it’s easy to fix.


(Nathan 'jesterKing' Letwory) #12

@dale, great. Hopefully you also made a YT item for this, still on vacation… (:

I wonder if the crash happens because the Cycles For Rhino rendering happens asynchronously, in a nom-modal render window…


(Dale Fugier) #13

https://mcneel.myjetbrains.com/youtrack/issue/RH-40341


#14

just installed the new wip:
not fixed jet.


(Dale Fugier) #15

Hi @hitenter,

You can check the state of the bug by clicking the link I provided (above).

– Dale


#16

I can’t, says:
“You have no permissions to view this page”


(Nathan 'jesterKing' Letwory) #17

And I am still on vacation, so no fixes from my side on this. Next WIP most likely won’t have a fix either, as I return next Tuesday. Best you can do is hope for a coding frenzy, with great new insights due to a rested mind (:


(Nathan 'jesterKing' Letwory) #18

Back from vacation, I have committed a fix for this problem. I hope we can get it in with the upcoming WIP.

/Nathan


(Brian Gillespie) #19

RH-40341 is fixed in the latest WIP


#20

fixed?
well yes, rhino wip isn’t crashing anymore when running the the commands in that order.

but still it is not possible to use the render-script together with cycles.
rhino-wip saves and closes the renderwindow before the renderings is finished.
that is still the same as before when using the macro.

running the script (which uses some of the same commands as the macro) isn’t working at all:

Command: RunScript
Unknown command: RunScript

Command: LoadScript
Unknown command: LoadScript

EDIT:
and you know what?!
no, not even the crashes are fixed. I tried several times with different macro-versions and after some time the crash happens again.
sorry, RH40341 does not seem to be fixed.