RunPythonScript TXT FILE export BROKEN in Build 2014-06-30

while tim’s script works for me (as long as i make a file with a .nc extension prior to using the OpenFileName part), there’s one weird bit… that being-- the open dialog says ‘Save’ at the top.

so, another one to throw on the back burner :wink:

Thanks, I have this issue submitted at
http://mcneel.myjetbrains.com/youtrack/issue/MR-1311

I’ll see what I can do about getting this fixed in the next build.

Tim’s script is setting the title of the dialog to the word ‘Save’.

filename2 = rs.OpenFileName (“Save”, “Toolpath Files (.nc)|.nc||”)

This should be fixed in the next build (whatever is released after the time of this post). If you are still having problems after you install the next version of Mac Rhino, please let me know.

man, i noticed that a couple of days ago but i forgot to come back here and say… “Oh, hey, don’t worry about that… OpenFileName() works right” …sorry about that.

Hi Steve,

I have tried the latest release (see below) with my previously posted snippet. It seems the issue is still there, e.g. rs.SaveFileName (“Save”, “Toolpath Files (.nc)|.nc||”) returns “None”.
At least on my system it does. Is there anything I can do here to help debugging?

Best regards,
Tim

Software versions
Rhinoceros version: 5.0 WIP (5A701)
IronPython version: 5.1.2015.131
Language: nl (MacOS default)
OS X version: Version 10.10.2 (Build 14C109)

Seems to be working here. I ran this variation:

import rhinoscriptsyntax as rs

filename = rs.SaveFileName ("Save", "Toolpath Files (*.nc)|*.nc||")
if filename:
    print "Save file name is {}".format(filename)
else:
    print "Save file dialog error"

filename2 = rs.OpenFileName ("Open", "Toolpath Files (*.nc)|*.nc||")
if filename2:
    print "Open file name is {}".format(filename2)
else:
    print "Open file dialog error"

Note, you do need to actually browse to a file with an extension .nc (even blank) for the second operation to work.

–Mitch

I wonder if the library files are not getting properly updated on your system. Could you please do the following:

Go to the following directory in Finder
~/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython

Zip up the contents and email them to me (steve@mcneel.com)

Thanks

Hi Steve, they should be in your inbox anytime soon.

cheers,

Got it thanks… Unfortunately (or fortunately depending on how you look at it) everything in those files look correct.

Let’s try something else. Try the following script and let me know if you can get something other than None to be printed to the command line

import Rhino


def SaveFileName(title=None, filter=None, folder=None, filename=None, extension=None):
    fd = Rhino.UI.SaveFileDialog()
    if title: fd.Title = title
    if filter: fd.Filter = filter
    if folder: fd.InitialDirectory = folder
    if filename: fd.FileName = filename
    if extension: fd.DefaultExt = extension
    if fd.ShowDialog(): return fd.FileName


s = SaveFileName()
print s

Yes, this returns my savefilename as expected.

I’m really confused now, since that is an exact copy of the rhinoscriptsyntax code. I wonder if there is a different copy of rhinoscriptsyntax on your system that is somehow getting used. If you run the following script, what gets printed as the path

import sys
print sys.path

Hi Steve,

the paths below get printed. By the way, I remember to have installed ironPython and maybe some other packages mannually back in the days. Possibly this is conflicting?

cheers,
TIm

[’/Users/timcastelijn/Library/Application Support/McNeel/Rhinoceros/Scripts’, ‘/Users/timcastelijn/Library/Application Support/McNeel/Rhinoceros/Scripts’, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7’, ‘/Users/timcastelijn/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython/settings/lib’, ‘/Users/timcastelijn/Library/Application Support/McNeel/Rhinoceros/scripts’]