Script help needed

I mean, each movement will cause that noise pop up for a short time. You will see it as flickering if you record it. Only if the calculation is done the screen record should be done. So, best would:

  • move object
  • wait 1 second
  • screen record
  • move object
  • wait 1 second …

You can use python to ask rhino to stop for a few seconds then ask Enscape to export image, this part can be automate, I have test it and it works. But what I think more important is how to ask Enscape to refresh as per rhino change(when running a python script).

Right, refreshing Enscape during a script is running is the main problem. I discovered an overseen way to save the Enscape “screenshots” without the need to “Enter” the save dialog. If Enscape is set to auto naming than no save dialog popup.

The big question is now - is there a way to go through a Bongo animation from frame to frame and send the changes to Enscape? For example at the moment Enscape wait until the Bongo animation process is finished and don’t show moving objects.

Maybe @Jarek has an idea, since he wrote some automatic render tools. I hope he read here. :wink:

hi @Micha

How do you capture the image with Enscape? Do you provide path for the output file?
I don’t have either Bongo or Enscape installed to test it, but could you write “human” step-by-step ideal case scenario, including the command you use to capture Enscape frame ?

–jarek

Hi @Jarek, thank you for your interest.

The output path can be set at the Enscape options, also a hot key. The command _-EnscapeTakeScreenshotCommand or using the hotkey cause that an image is rendered. No UI popup, only a few seconds the Enscape window is working. The file naming based on date and time.

I tried to use the command _-EnscapeTakeScreenshotCommand per BongoBonusToolsForEachFrame, but since the Enscape VR scene isn’t updated I got the same shot at all frames. The BongoBonusToolsForEachFrame start the command before a rendering is started (I set Viewport screenshot as renderer). My idea was, that an Enscape shot is started + a little pause and than Bongo create the standard rendering. (The standard rendering is needed since Enscape can not be choosen as renderer at Bongo.) On this way the Bongo functionality could be fully used.

I have two ideas. First way: an extra command at the BongoBonusToolsForEachFrame script force an update of the Enscape VR. On this way Bongo could be fully used.

An other way could be a script that jump from frame to frame of a Bongo animation and starts _EnscapeTakeScreenshotCommand after Enscape is updated. But I’m not sure there is a script command to go though the Bongo frames. Maybe it’s only possible to jump from Bongo time line tick to the next. In this case the animation setup is limited to one frame per time line tick. But it’s better than nothing.

At the moment a Bongo animation could be manually done per clicking at the Bongo time line button “next tick” and starting an Enscape screenshot per hot key. So, I can shot approx. 12 frames per minute. With some patience an animation of a few seconds play time is possible. :slight_smile:

Here an example of a manual test animation (5MB Gif)

https://forum.enscape3d.com/wcf/index.php?attachment/5284-output-is62e9-gif/

hi @Micha,

I installed Bongo trial and also re-installed Enscape. My trial expired (I didn’t really have a good chance to try it back then…so I still don’t have any experience with it). It also looks like the EnscapeTakeScreenshotCommand does nothing in Trial mode. But I did some testing and have a crude prototype working, or at least a script that moves Bongo slider and makes Enscape refresh, allowing - hopefully- to capture the frames in-between.

Right now it takes Bongo start-end frame, plus a “Pause” time interval. There is not much error trapping so be careful with the values you type.
Also, please edit the RVB file to have a correct path to the html file wherever you save it on your end.

You are correct that Enscape will not refresh while inside a script loop (or even when dragging the Bongo slider). In order to make it work, I am using a modeless HTML window that on interval runs a “capture+move_slider” scriptlet, that Enscape seems to not mind and refresh the scene.

Here is the rvb+html: ENSCAPE_BONGO_RECORDER.zip (1.3 KB)

And how it looks here with a simple test:

Let me know if that does anything on your end with non-Eval Enscape…

cheers,

–jarek

1 Like

Hi Jarek,

that great, it’s a milstone for Enscape user! It works like expected. You got it. :grinning:

Some thoughts - the default pause value could be 4000ms instead 300ms, that’s a good value. For interiors and HD shots the pause needs to set higher. For an exterior and 720p 4000ms is a good and save value (Also 3000ms was fine, but I’m not sure how save it is). I can set the value at the script here, but maybe if you should write an update … .

At the moment your script jumps from time line tick to time line tick. For short animations it’s fine. Also exist animations can be easy scaled by a Bongo command. A typical Bongo animation is using the ticks as raw scale only and finally the user set the frame rate or total frame count and a finer increment is used for the calculation. So, a setup based on: start tick/end tick/ frame count. Do you have script access to jump in frame increments?
(I don’t want to be greedy, so, only I ask maybe it’s not so difficult and you have some time. If you don’t like to spend more time, the current solution is great too and I’m very happy.)

Thank you very much,
Micha

Here a quick raw test. The result has some little flickering, but I hope it’s better than nothing. :wink:

2 Likes

Great animation!:+1:t2:

Micha, I wonder, in order to let the car move on a curve route, do you need to set up a lot of keyframes or you can predefine a curve to let the car to follow?
thanks

It’s a quite simple setup based on flow and history. Only two keyframes are needed. I posted an example in this thread:

I like this kind of setup and used it several times in the past. It maybe a surprise, not the vehicle is animated but the base curve.

Just have a look at Luc’s video tutorial, that’s really cool!! I think it can resolve a lot of problem in terms of rhino animation!!

@Jarek

Is the keypresser rvb/html process possible to be called directly in grasshopper?

I tried in a C# component in gh with:

if(run){
      Rhino.RhinoApp.RunScript("_-EnscapeTakeScreenshotCommand", true);
      SendKeys.SendWait("{ENTER}");
}

but didn’t work.

Or similarly in VB:

Dim shl = CreateObject("WScript.Shell")
Rhino.RhinoApp.RunScript(command, True)
System.Threading.Thread.Sleep(1000)
shl.sendkeys("{ENTER}")

In VB, at least the enter key is actually executed, unlike in C#;
however, it is only executed after I cancel/exit out the save dialog for the first time, so it is basically recalling the command in Rhino. How could the enter key be specified to be executed within the popup window?

I’d basically love to close the save window by simulating a enter key press, and be able to then loop through multiple saves.

Thanks!

hi @timothytai,

I don’t really know how the GH C# component works.
All I know that while Rhino is inside of running script, Enscape will not refresh.

The above hack opens a HTML modeless window that stays after the initial script, and runs another script on given interval, so after each run, Enscape will refresh. This “interval run” is more of a vbscript/html feature than Rhino. But the HTML is being fed RhinoScript object that allows it to control Rhino via scripts, until closed. Not sure if this helps with anything or makes sense…

Perhaps similar thing can be done with GH. Please take look at the latest script posted. It does not require hitting “ENTER”, rather it just uses Rhino.Command.

–jarek

–jarek

Hi Jarek, thanks for the response!

The problem of Enscape not refreshing isn’t actually an issue for me - I’m just running a script that changes the position of the Rhino sun object so that the shadow changes.

I was just wondering how to somehow simulate hitting the ENTER key as the Save window where one enters file name pops up after executing the Rhino.Command in script (i.e. I have no problem calling the command) so that the for loop can continue.

I think we will just have to wait till Enscape develops scriptable commands such as the native -ViewCaptureToFile in rhino where one can send command options (including designating file names) through strings without having to deal with pop up windows.

Thank you regardless!

Hi, why do you need to press Enter/Have dialog? What command are you trying to automate?
I see in your sample you are using “dashed” version of the command which should not produce any dialog. Same with most Rhino commands - you can macro/script/automate most of them without seeing any dialogs…

_-EnscapeTakeScreenshotCommand should not produce a dialog, correct ?

–jarek

Exactly - the “_-EnscapeTakeScreenshotCommand,” unlike other rhino scriptable commands, produces the save dialog and that is the problem (hence trying to simulate an ENTER key press). I had done other scripts calling Rhino commands like you said and that’s why I thought this could work too, but not yet because Enscape commands could not be fully customized/scripted in the Rhino command line:

The only way around now is to check the automatic naming option in Enscape setting to bypass - which then takes away the ability to name files before saving - but is a good enough workaround for now.

Yup, I see the limitation now. Workaround would be to monitor the new saved file name and rename it from the script after it has been created… not ideal, obviously.

–jarek

yep, already submitted a ticket to them and hopefully they develop a fix soon, thanks!

1 Like