i wonder if making rhino remember the last folder will allow a simple alias to work for the syncing? if so, it might be a simple enough solution without needing to assign a path in rhino prefs.
in osx, making an alias instead of a symlink is real easy… just drag&drop a folder while holding option-cmmd… (sidenote- drag&drop with option key creates a duplicate file)
the python scripts will run properly from an aliased folder/file but rhino doesn’t seem to recognize/remember the aliased folder exists so you have to navigate to it if using RunPythonScript… rhino aliases don’t find the folder either even when it’s in ~/Library/Application Support/McNeel/Rhinoceros…
Yeah, I like the RMB functionality in Windows, right mouse drag something and let go, get a context menu > Move, Copy or Create shortcut(alias)… Plus as in Mac Ctrl+LMB drag → copy ; Alt+LMB drag → create shortcut
OK, so it looks like now the last used path with RunPythonScript is remembered, even between sessions, so progress there.
OTOH, _-RunPythonScript MyScriptName.py does not look in that directory, it still looks in the default scripts path.
That’s probably a good thing, actually, IMO the dashed version of the command should always look in the same directory - or better yet, a set of directories. Now all we need is for the user to actually be able to specify that/those directory(ies) - without having to symlink everything.
First I want to say how awesome this is. It’s already helping out on a project.
I am new to both Atom and Python. Is there a way to log statements and break point debug inside of Atom while a rhino python script runs? I have been using print and going through the Rhino history window.
It’s great that you’re finding this useful for your project.
There’s no debugger for Python scripts in Atom at this point. Adding a debugger is one thing but because the scripts are run by Rhino and not Atom a remote debugger is what is needed and that is not a trivial task. Having this in the future is something we’re looking into but it won’t be in the first release of Rhino for Mac.
here’s a script that will create the necessary link from a chosen folder to the rhino Scripts folder
import rhinoscriptsyntax as rs
import os
def scripts_symlinker():
target = " ~/Library/Application\ Support/McNeel/Rhinoceros/Scripts "
source = rs.BrowseForFolder()
if not source: return
source = source.replace(" ", "\ ")
# merge Scripts folder with source folder
os.system ("ditto" + target + source)
# remove Scripts folder
os.system ("rm -rf" + target)
# create symlink
os.system("ln -s " + source + target)
print "The folder: " + source + " ...is now linked to your Scripts folder"
scripts_symlinker()
notes –
• rs.BrowseForFolder… i couldn’t figure out a way to get a custom message… the dialog which comes up when running the script will just say ‘Open’… choose the folder you’d like to use as your scripts folder (ie- the one in dropbox)
[maybe someone could have a look at that on mac to see if it’s a little bit broken or i’m just using it wrong?]
• the script will first merge the two folders together… if you have different files in your appSupport/scripts than you do in the dropbox folder, no files will be overwritten or deleted… they’ll be merged together as one.
• it’s ok to use a folder in dropbox named something other than ‘Scripts’… the resulting linked folder will be named Scripts as rhino requires the name for macros to work while the source folder will maintain its existing name.
Not sure it’s working as expected. It deletes the Scrips file, but then Rhino recreates an empty one when you run a Python script.
Rhino-Python Scripts is a copy of Dropbox folder that I want to create symlink to. The second image is after I ran a script. Before there was no Scripts folder.
Yes, it will recreate the scripts folder - also the subfolder with the samples, funny enough… But according to Jeff, the symlink should work - you should be able to run scripts from aliases that are in the linked folder without having to program a full path. --Mitch
Rhino-Python Scripts should be in your dropbox and you navigate to it when running the symlink maker script.
after running the script, your appSupport/Rhinoceros folder will look like this:
the Scripts folder will now have the arrow on it indicating that it’s linked to another folder… the folder that it’s linked to is in my dropbox called RhinoScripts… that folder stays in dropbox.
(once the link is made, you can work out of either folder… you can edit/delete/add new scripts to either folder… they’ll stay in sync as well as any other computers you have pointing at your dropbox.)
[Edit]
oh, wait… are you trying to use the first script up there or the second one? the first one creates Macros to python files located elsewhere on the system (besides the Scripts folder)…
if you use the second script, there’s really no need for the first one because you can then just make macros like -RunPythonScript Example
one other note that may need to be pointed out… to make a macro, you need to use the dashed version of the command… -RunPythonScript Example … or _-RunPythonScript Example
My typing and what is in my Alias are not the same.
Before running your script, from Dropbox … Finder tells me this.
After, it says link is created,
but no Scripts folder, with Alias / Symlink arrow is created.
I am using the second longer script, running it in rhino from from Dropbox to create a Symlink Folder so all I have to do is keep files in Dropbox and everything runs from default “Scripts” folder. Is this clear?