+ Reply to Thread
Results 1 to 5 of 5

Thread: Automate an export

  1. #1

    Automate an export

    Is there a way to automate an export?

    I want to export my geometry as and IGES 144 with IGES tolerance of .1, units of inches, and none of the check boxes checked. Is there a way to do this?

    I currently just run Command(“_Export”) but I’d like to make it a little more fool proof.




  2. #2
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    You should be able to use the "dashed" version of Export to get at the command line options that you want. Something like

    Command('-_Export C:\\myfile.igs "IGES 144" Tolerance=0.1')

  3. #3
    Quote Originally Posted by Steve Baer View Post
    ... "dashed" version of Export ... Something like

    Command('-_Export C:\\myfile.igs "IGES 144" Tolerance=0.1')

    Thanks Steve. Do you (or anyone) know of any documentation that discusses this? I’m not having any luck finding it.

  4. #4
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    288
    Hi,

    You mean help with scripting rs.Command()? There's only the page in the Python help (type "Command" in the index tab). Basically you need to create a string that duplicates the Rhino command line options in the order in which they are needed. Spaces in the string represent Enters. Sometimes it's a bit tricky to know which order to run the options - you often need to experiment with the Rhino interface version to figure it out or run the script then hit F2 to bring up the command history and see where it is going wrong. You can also get tripped up with some options, as they can either be in the form of:

    ThisOption Value or ThatOption=Value (i.e. either a space or an equal sign, one will work and the other won't).

    In your example, if you type -Export at the Rhino command line (assuming objects are preselected), the first thing you get is a prompt for a save file name. However, you have a bunch of other options, most of which concern Rhino files. These need to be programmed in your string before the file name, as if you enter a file name first it will export with the existing defaults...

    So, rs.Command("_-Export Version=5 SaveSmall=No GeometryOnly=No SaveTextures=No SavePlugInData=Yes C:\\myfile.3dm")

    Now, since you're exporting an IGES and not a 3DM, you need to follow how that works on the command line. First, you need to know that if the file name is filename.igs, that will automatically set the file type. So, in this case, you need to start with the filename. Then you get a prompt for the IGES export type plus the following: (ListTypes UnitSystem=Millimeter Tolerance=0.001). In this case, you can either enter the type first or the other options first because Rhino allows it (it doesn't always). Any options you don't script will use the existing command line values.

    So you can use either

    ('-_Export C:\\myfile.igs "IGES 144" UnitSystem=Millimeter Tolerance=0.1')

    or

    ('-_Export C:\\myfile.igs UnitSystem=Millimeter Tolerance=0.1 "IGES 144"')

    HTH, --Mitch
    Last edited by Mitch; 08-29-2012 at 05:39 PM.

  5. #5
    Thanks Mitch. I was looking for specific documentation that explained how to write out IGES files using Python. Your explanation helps me understand the concept better. Now I see why I couldn’t find what I was looking for ;-)


+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts