When I eventually go to save the file I need to move back to the original folder of the DWG file i was editing, before the above line of script was processed.
Im hoping to avoid having to climb back through the tree to the original folder.
Any help on how to accomplish this would be greatly appreciated.
Perhaps a Python script that’s something like this will help?
import Rhino
import System
def ImportDimStyles():
# Get the %APPDATA% folder
folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
# The template file to import
template = r"McNeel\Rhinoceros\8.0\Localization\en-US\Template Files\Rhino Template.3DM"
# Combine the two
file = System.IO.Path.Combine(folder, template)
# Verify the file exists
if System.IO.File.Exists(file):
# Get the current working folder
working_folder = Rhino.ApplicationSettings.FileSettings.WorkingFolder
# Script the ImportAnnotationStyles command
script = "_-ImportAnnotationStyles \"{0}\"".format(file)
Rhino.RhinoApp.RunScript(script, False)
# Reset the current working folder
Rhino.ApplicationSettings.FileSettings.WorkingFolder = working_folder
if __name__ == "__main__":
ImportDimStyles()
import Rhino
import System
import scriptcontext as sc
def ImportDimStyles():
# Get the %APPDATA% folder
folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
# The template file to import
template = r"McNeel\Rhinoceros\8.0\Localization\en-US\Template Files\Rhino Template.3DM"
# Combine the two
file = System.IO.Path.Combine(folder, template)
# Verify the file exists
if System.IO.File.Exists(file):
# Get path to open file
working_folder = sc.doc.Path
if not working_folder:
# Get the current working folder
working_folder = Rhino.ApplicationSettings.FileSettings.WorkingFolder
# Script the ImportAnnotationStyles command
script = "_-ImportAnnotationStyles \"{0}\"".format(file)
Rhino.RhinoApp.RunScript(script, False)
# Reset the current working folder
Rhino.ApplicationSettings.FileSettings.WorkingFolder = working_folder
if __name__ == "__main__":
ImportDimStyles()