Tips and Tricks: I forgot to check the (.bin) for the GFD. Should I resimulate? NO

Hi everyone,

when we are working with Hybrido, sometimes we need to generate .BIN files for our GridFluidDomain but it is possible we have forgotten to check the (.bin) checkbox in the export central before simulating. Result? We won’t have bin files particles when simulating.

Now, the problem is we can’t generate the .BIN files for the GridFluidDomain once that the GFD has been simulated. There are two ways to generate the BIN files once the GFD is simulated. First one is resimulating the scene, which is not a advisable because if the simulation is very heavy, it will take long time to write the GFD and the BIN files again.

The second one is the right way and it just take short time to export. So, in order to generate the BIN files we need to make sure we have the “Particle cache (.bin)” checked for our GridFluidDomain node.

Next, we need to put the GridFluidDomain to “Active” and opening the Batch Script Layout to write a little script.

Once the script is done, put the timeline to 0 and going to Script menu and running the script. If you open now the particles folder you’ll see that the bin files are written.

luisM.

41 comments

    1. Hi vidit,

      GridMesh and Renderkit are multithreading but not the Standard mesh. Check them out without writting to disk. When it is saving the file to disk is not multithread.

      luisM.🙂

  1. Nope. It didn’t worked. I wrote like this:
    ————————————————————————
    domain = scene.getGridDomain(“GridFluidDomain01”)

    for f in range (scene.getMinFrame(), scene.getMaxFrames() + 1):
    scene.setCurrentFrame(f)
    GridFluidDomain01.export()
    ————————————————————————

    Just changed the grid name because it was renamed like this on my test scene. Is the syntax correct?

    Thank you and congratulation for such awesome blog.

    Regards,

    Ronaldo.

    1. Hey!

      It is ok. I think you have empty spaces instead TABs for some line in the script. The better way to fix this is remove the TABS for all lines and then, click on TAB for each line which is necessary. Anyway, I’ll change one thing.

      domain = scene.getGridDomain(“GridFluidDomain01″)

      for f in range (scene.getMinFrame(), scene.getMaxFrames() + 1):
      (TAB) scene.setCurrentFrame(f)
      (TAB) domain.export()

      Thanks you for your kind words.

      luisM.

  2. Hi, Gus, Thanks for such a handy script!! such a lifesaver!!!

    Just one thing i’d like to ask is that, when you execute this script, it overwrite the exsisting .gdc and others doesn’t it? So it’s always better to back up .gdc somewhere and uncheck the ones you don’t want to export. otherwise all cache will become 1KB is that correct??

    Cheers,

    TARo

    1. Hey,

      I’m not Gus😀 He is my colleague.

      It shouldn’t overwrite the gdc files when executing the script. It doesn’t matter if the GridFluidDomain is cached or not because you are running the script in Batch Script and it is not simulating but covering the min and max frame. Make sure you are running the script in Batch script.😉

      luisM.

  3. Actually, if you export the the .bin files from the Emitter instead of from the domain you don’t need this script. Just set the Domain to cache and make sure that “Emitter” as well as at least one particle file like .bin or .prt is checked in the Export Central.

    Cheers
    Felix

    1. Hi Felix,

      Actually, the GDC are overwritten as well, but if you don’t want to do that, you should add a couple of lines, but leaving the bin file always checked.

      domain = scene.getGridDomain("Grid_Fluid_Domain01")
      for f in range (scene.getMinFrame(), scene.getMaxFrames() +1):
      scene.setCurrentFrame(f)
      domain.activeExportResource(EXPORT_GRID_DOMAIN_GDC, False)
      domain.export()
      domain.activeExportResource(EXPORT_GRID_DOMAIN_GDC, True)

      luisM.

  4. i’m using realflow 2013 and instead of grid domain i’m using hybrido domains so script is giving an error in 1st line “scene.getGridDomain”

    1. Hi,

      This is because of empty spaces in the script. Sometime, the download managers introduces empty spaces instead tab key. So, you should try to remove the empty spaces and add tab key.

      luisM.😉

  5. hi luis, I forgot to check the .ptr export for hybrido splash and foam, is there a way to export it withput resimulationg it?
    tnx

    1. Hi Carlos,

      there is a script which is doing that

      GD = scene.get_HY_GridDomain("Grid_Fluid_Domain01")

      for f in range(scene.getMinFrame(), scene.getMaxFrames() +1):
      scene.setCurrentFrame(f)
      GD.activeExportResource(14, False)
      GD.activeExportResource(5, True)
      GD.export()
      GD.activeExportResource(14, True)

      luisM.

  6. hola luis olvide marcar Bin en un Splash…. solo lo tengo en Prt como hago? mismo procedimiento que con el domain? lo que me preocupa es que los splashs no tienen emisores que me recomiendas?

    1. ah olvide decirte que esto lo necesito hacer porque por alguna razon krakatoa no me carga los PRT provenientes de splashs! o foams!

    2. Hola Oscar,

      Tienes varias opciones. Estas dos son las mas comodas. La primera, abre un batch script y prueba con este script

      GD = scene.get_HY_GridDomain("Grid_Fluid_Domain01")

      for f in range(scene.getMinFrame(), scene.getMaxFrames() +1):
      scene.setCurrentFrame(f)
      GD.activeExportResource(EXPORT_GRID_DOMAIN_PRT, False)
      GD.activeExportResource(EXPORT_GRID_DOMAIN_BIN, True)
      GD.export()
      GD.activeExportResource(EXPORT_GRID_DOMAIN_PRT, True)

      La segunda, que si tienes krakatoa, salva las particulas como BIN que te lo permite hacer directamente y luego las puedes cargar en RealFlow. Asegurate de que tienes el mismo nombre que has puesto para la secuencia en el dominio, y que se estan leyendo bien las particulas.

      You have several options to do that. The first one, opening a batch script and trying with the script above.
      The second once, if you have krakatoa, export to BIN particles directaly from it, and then load the particles in RealFlow. Just set the same name you set for your bin sequence to the domain, and check the domain is reading the that folder properly.

      luisM.

  7. Hi Luis,
    Could you please update on the procedure for exporting prt after the splash and foam have been simulated in realflow 2014?
    I tried the script you posted for Carlos but the prt folder is created but no prt file is actually been generated.

    Thank you.

    1. Hey Robert,

      This script should work. Try and let me know.

      emitter = scene.scene.get_HY_SplashAndFoam("HY_Splash_Foam01")
      for f in range(scene.getMinFrame(), scene.getMaxFrames() +1):
      scene.setCurrentFrame(f)
      emitter.activeExportResource(EXPORT_PARTICLES_BIN, False)
      emitter.activeExportResource(EXPORT_PARTICLES_PRT, True)
      emitter.export()
      emitter.activeExportResource(EXPORT_PARTICLES_BIN, True)

      luisM.😉

  8. HI Luis great script very useful! Is there a way to run it exporting the .prt to all elements at the same time? like the domain, splash, foam, etc? its like picking objects in the scene to produce .prt. Thanks in advance!

    1. Hey,

      Of course, but you need to get all nodes you want to export the prt files and make the same thing you do in the script. I mean, instead of “scene.getDomain….” you should save the emitters (scene.get_HY_Emitters()) in an array and do the same you have done in the script for exporting the prt files.

      luisM.

      1. Hey,

        Try with this script. Depending on you want sph o hybrido emitters you must change the first line “scene.get_HY_Emitters()” or “scene.get_PB_Emitters()”

        emitter = scene.get_HY_Emitters()
        for f in range(scene.getMinFrame(), scene.getMaxFrames() +1):
        scene.setCurrentFrame(f)
        for e in emitter:

        e.activeExportResource(EXPORT_PARTICLES_BIN, False)
        e.activeExportResource(EXPORT_PARTICLES_PRT, True)
        e.export()
        e.activeExportResource(EXPORT_PARTICLES_BIN, True)

        luisM😉

  9. I just get 2kb files…I don’t think it’s ok:/ tried it with this script:

    domain = scene.get_HY_SplashAndFoam(“HY_Splash_Foam01”)

    for frame in range(scene.getMinFrame(), scene.getMaxFrames() + 1):
    scene.setCurrentFrame(frame)
    domain.export()

      1. Hello just today i realized you replied me, cause i was trying to export prt out of a HY Domain already simulated.

        My script is:
        GD = scene.get_HY_GridDomain(“HY_Closed_Domain_Domain”)
        for f in range(scene.getMinFrame(), scene.getMaxFrames() +1):
        (TAB) scene.setCurrentFrame(f)
        (TAB) GD.activeExportResource(EXPORT_GRID_DOMAIN_BIN, False)
        (TAB) GD.activeExportResource(EXPORT_GRID_DOMAIN_PRT, True)
        (TAB) GD.export()
        (TAB) GD.activeExportResource(EXPORT_GRID_DOMAIN_BIN, True)

        Changed domain to active and on frame zero i ran the script without error but i can’t get any new file (i checked prt into the domain export central)

        Can you help me? ^^

        Thank you

      2. Ok sorry i got the problem, was my fault🙂

        Just another question: Now it’s working creating the PRTs but it’s also overwriting the RPC files. there is a way to prevent that?

        Thank you again

  10. Hi

    i have entered this script from above and changed the name of my hybrido domain
    —————————————————————————————————————
    domain = scene.getGridDomain(“HY_Domain01″)

    for f in range (scene.getMinFrame(), scene.getMaxFrames() + 1):
    scene.setCurrentFrame(f)
    domain.export()
    —————————————————————————————————————
    i have removed (Tab) and pressed tab so it created some space
    after dat i have clicked check syntax
    its showing me syntax error at line 0

    help please….

    Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s