Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Installing the import/export scripts for Blender
  • Mike April 2010
    enGrid comes with import/export scripts for Blender to make it easier to work with both tools.

    However, they don't get installed by default yet if you use the installation script.
    To install them, simply place them into your ~/.blender/scripts/ directory.

    The scripts come with the enGrid source code, but you can also directly get them here directly.

    Once installed, you will be able to import/export from/to the enGrid .begc format, as well as the gmesh 2 format. :)

    ==============
    The engrid export script currently assumes all objects to be scaled, rotated and placed the same way.
    Workaround to achieve that:
    1) Go into object mode
    2) Select all objects you wish to export in Blender
    3) Object->Clear/Apply -> Apply Scale/Rotation to ObData (ctrl-A,1)
    4) Panels->Editing (F9)
    5) In the mesh window, click "Center cursor"
    6) Export as .begc

    You can use Object->Transform properties (N) to check the current object properties.
  • miguelfg August 2011
    Hey Mike, I know your post it's quite old, but hope u get and email from my reply.
    Sorry, but the link for the export script from Blender to Engrid is broken. There is nothin hanging on that url.
    Could you tell us where can we get the scripts now?

    Thanks

    Another Mike
  • old_mcdonald August 2011
    Hi!

    I'm not Mike, but maybe I can help. :)
    I think they can be found in the directory, to which you installed enGrid. There is a directory enGrid/src/scripts. I hope I remember rightly.

    greetings
  • miguelfg August 2011
    what i have there is this ->


    drwxrwxr-x 2 linux-pc linux-pc 4096 2010-06-21 10:08 ./
    drwxrwxr-x 12 linux-pc linux-pc 16384 2010-06-21 10:08 ../
    -rwxrwxr-x 1 linux-pc linux-pc 2419 2010-06-21 10:08 adapt_nglib_for_windows.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 1573 2010-06-21 10:08 build-all.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 1862 2010-06-21 10:08 build-nglib.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 2363 2010-06-21 10:08 build-nglib-svn.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 2468 2010-06-21 10:08 build-with-OpenFOAM-paraview.sh*
    -rw-rw-r-- 1 linux-pc linux-pc 2762 2010-06-21 10:08 engrid_installer_updater.cfg
    -rwxrwxr-x 1 linux-pc linux-pc 6647 2010-06-21 10:08 engrid_installer_updater.sh*
    -rw-rw-r-- 1 linux-pc linux-pc 44 2010-06-21 10:08 ftp_file.sh
    -rwxrwxr-x 1 linux-pc linux-pc 2817 2010-06-21 10:08 generate_dependency_list.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 4328 2010-06-21 10:08 makebindist.bash*
    -rwxrwxr-x 1 linux-pc linux-pc 2717 2010-06-21 10:08 makebindist.py*
    -rwxrwxr-x 1 linux-pc linux-pc 2650 2010-06-21 10:08 makedist.bash*
    -rwxrwxr-x 1 linux-pc linux-pc 1795 2010-06-21 10:08 make-release.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 2430 2010-06-21 10:08 nightly.bash*
    -rwxrwxr-x 1 linux-pc linux-pc 1927 2010-06-21 10:08 pack-src.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 2945 2010-06-21 10:08 rebuild.sh*
    -rwxrwxr-x 1 linux-pc linux-pc 3190 2010-06-21 10:08 setup_paths.sh*


    none seems to be the one, right?
  • miguelfg August 2011
    I actually found it, and put it in another post of the forum, here it is ->
    export script:
    http://dl.dropbox.com/u/19241820/enGrid/engrid_export.py

    might need to remove line numbers in the file first
  • k_xyz September 2011
    Hi,
    as a new user of enGrid, I am having the same problem - but in Windows. I've copied the export_engrid.py script (line numbers removed) into the Programs\blender\..\scripts folder, but I don't see the option in the export menu of blender.
    Is there something I'm missing?
    Thanks
  • wyldckat September 2011
    Greetings to all,

    @k_xyz: Did you see this section of one of the tutorials for enGrid 1.2: http://engits.eu/wiki/index.php/Tutorials/Version1.2/Unstructured_Grids_for_OpenFOAM_With_Blender_and_enGrid#Unstructured_Meshing_with_Blender_and_enGrid

    Also, did you restart Blender after copying the script to that folder?

    By the way, which Blender version are you using?

    Best regards,
    Bruno
  • Olegf2d October 2011
    Hey, Miguelfg, what do you mean "might need to remove line numbers in the file first "?
    English isn't my native language, might therefore i don't understand it.
    My blender don't export to engrid, may it be because i use 1.3 version?
    use fedora 14-32
    Thanks
  • madstamm October 2011
    Dear All,

    I've taken the py script, removed the line numbers, and dropped the script into the
    "C:\Program Files\Blender Foundation\Blender\2.60\scripts\" ...

    using Blender 2.6, I unfortunately see whether an import nor an export option... some things changed though in 2.6 - are there new instructions?

    Mike
  • Oliver November 2011
    Hi,

    with Blender 2.6 the whole scripting interface has changed. Hence we don't have any scripts for 2.6 yet.

    If somebody has scripting experience with Blender 2.6, we would be more than happy about some help porting the scripts. I had a quick look and so far I managed to make our scripts show up in the add-on list; they cannot be enabled or used, however.

    As an immediate work-around, I would recommend to use Blender 2.49b. I just checked and I seem to be able to open models from 2.49b in Blender 2.6 without problem. Thus you would not lose your work, once the scripts start working in 2.6.

    Cheers,
    Oliver
  • madstamm November 2011
    Ok, I will try Blender 2.49.
    Please keep us up to date when the 2.6 scripts are released - they are very valuable!

    Mike
  • sungreensungreen November 2011
    Hello, rewrote the script simple addons export engrid for blender 2.60 (io_export_engrid)
    http://blender-3d.ru/forum/index.php/topic,126.msg3859/topicseen.html#msg3859
    But did not find the format specification begc-file , where you can see?

    russian:
    Привет, переписал простой скрипт addons export engrid для blender 2.60 (io_export_engrid)
    http://blender-3d.ru/forum/index.php/topic,126.msg3859/topicseen.html#msg3859
    Но не нашел спецификацию формата begc, где её можно посмотреть?
  • Oliver November 2011
    Hi,

    Thanks for the effort! :-)

    I do not understand your question, however? The script you provided works, i.e. the file format is correct in your script. The only thing left to fix is that the names don't come across correctly; they show up as Plane... instead of the name that had been given to the object in Blender. I'll have a look at that later.

    Is it okay to include the script in the distribution? If yes, do you want your credits to be shown in the script? In which case you need to provide them ;-)

    (just send me an email if you want to at: ogloth[at]engits.com).

    Cheers,
    Oliver
  • Oliver November 2011
    I have updated the script slightly. It should now, hopefully, behave in the same way that the old script did (i.e. names and transformation).

    The script can be found here: http://db.tt/HUJynYkQ
  • sungreensungreen November 2011
    ok
  • sungreensungreen November 2011
    Hi,
    I have modified the script to fix this bug and also added more function.
    Add custom properties:
    Rotate 90 degrees around X to convert to y-up,
    Transform the Vertexcoordinates into Worldspace,
    Applies the Modifiers.

    http://blender-3d.ru/forum/index.php/topic,126.msg3864/topicseen.html#msg3864
  • rebecca513 November 2011
    Hi,

    I have the same problem. I am using engrid 1.2, blender 2.49, but after I copy the export script (both the old one and the one updated by Oliver) into the folder, and restart blender, I can't find the option of engrid in export.

    Is there anything else that I need to do?

    Thank you!
  • sungreensungreen November 2011
    which version (blender 2.49 or 2.59) of the script you copy?
    in which folder you copy the script?

    For linux, I copy the script for blender 2.49 in folder /usr/share/blender/scripts.
    It works.

    old script for blender 2.49 http://blender-3d.ru/forum/index.php/topic,126.msg3865.html#msg3865
  • rebecca513 November 2011
    Hi,

    Thank you for the reply.

    I am using blender2.49. Is the script the last attachment? I put it in /usr/share/blender/scripts, restarted blender and rebooted my computer, but there is still no export -> engrid in blender. That is so wired. Do I need do something else?

    Thank you.

    Best, Hang
  • sungreensungreen November 2011
    имхо,
    for linux, check permission ...
    show the output:

    ls -l /usr/share/blender/scripts/e*



    ... and show
    cat /usr/share/blender/scripts/engrid_export.py
  • rebecca513 November 2011
    Hi,

    ls -l /usr/share/blender/scripts/e*
    results in output like below

    -rw-r--r-- 1 root root 2898 Nov 12 14:39 /usr/share/blender/scripts/engrid_export.py

    and other .py files.

    cat /usr/share/blender/scripts/engrid_export.py gives

    #!BPY
    #
    # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # + +
    # + This file is part of enGrid. +
    # + +
    # + Copyright 2008-2010 enGits GmbH +
    # + +
    # + enGrid is free software: you can redistribute it and/or modify +
    # + it under the terms of the GNU General Public License as published by +
    # + the Free Software Foundation, either version 3 of the License, or +
    # + (at your option) any later version. +
    # + +
    # + enGrid is distributed in the hope that it will be useful, +
    # + but WITHOUT ANY WARRANTY; without even the implied warranty of +
    # + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
    # + GNU General Public License for more details. +
    # + +
    # + You should have received a copy of the GNU General Public License +
    # + along with enGrid. If not, see <<a href="http://www.gnu.org/licenses/" target="_blank" rel="nofollow">http://www.gnu.org/licenses/>. +
    # + +
    # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #

    """
    Name: 'Engrid (*.begc)'
    Blender: 249
    Group: 'Export'
    Tooltip: 'Export to Engrid'
    """

    import Blender
    import bpy

    def write(filename):

    Blender.Window.WaitCursor(1)

    if not filename.lower().endswith('.begc'):
    filename += '.begc'
    out = file(filename, "w")
    objects = Blender.Object.GetSelected()

    num_objects = 0
    for object in objects:
    if object.type == 'Mesh':
    num_objects = num_objects + 1

    out.write('%d\n' % num_objects)
    node_offset = 0
    for object in objects:
    if object.type == 'Mesh':
    out.write(object.name)
    out.write('\n')
    for object in objects:
    if object.type == 'Mesh':
    mesh = object.getData(0,1)
    faces = mesh.faces
    nodes = mesh.verts
    out.write('%d' % len(nodes))
    out.write(' %d\n' % len(faces))
    for n in nodes:
    out.write("%e " % n.co[0])
    out.write("%e " % n.co[1])
    out.write("%e\n" % n.co[2])
    for f in faces:
    N = len(f.verts)
    if N < 3 and N > 4:
    Blender.Draw.PupMenu('Error%t|Only triangles and quads allowed')
    return
    out.write("%d" % N)
    for v in f.verts:
    out.write(' %d' % (v.index + node_offset))
    out.write('\n')
    node_offset = node_offset + len(nodes)

    Blender.Window.WaitCursor(0)

    Blender.Window.FileSelector(write, "Export", Blender.sys.makename(ext='.begc'))

    Sorry that the copied text looks messy.

    Thank you!
  • sungreensungreen November 2011
    :(

    but other way:
    in Blender Text Editor -> Alt-O (select /usr/share/blender/scripts/engrid_export.py) -> Alt-P (run this script)

  • rebecca513 November 2011
    Great!

    I tried to run the script manually, it worked!

    Thank you!
  • Mike February 2012
    While I'm back for a short while, here's a tip for easier imports into blender (for GNU/Linux users at least):
    import_engrid.sh:
    ==========
    #!/bin/bash
    blender -P $HOME/.blender/scripts/engrid_import.py -- "$@"
    ==========
    (Adapt the script path as needed. Using an alias, or directly running the command are also options of course.)

    Then you can just run this to open one or more engrid files in Blender directly:
    $ import_engrid.sh FILE1 FILE2 ...

    Works for Blender v2.49b. Not sure about v2.5+.

    I might have a look at direct file association in filebrowsers at some point as well. Unless this has already been done and I don't know about it yet. :)

    =====
    Hello, rewrote the script simple addons export engrid for blender 2.60 (io_export_engrid)
    http://blender-3d.ru/forum/index.php/topic,126.msg3859/topicseen.html#msg3859
    But did not find the format specification begc-file , where you can see?

    russian:
    Привет, переписал простой скрипт addons export engrid для blender 2.60 (io_export_engrid)
    http://blender-3d.ru/forum/index.php/topic,126.msg3859/topicseen.html#msg3859
    Но не нашел спецификацию формата begc, где её можно посмотреть?
    =====
    Yay! Thanks! I will have a look at this as well. :)