-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaveAsDWGForFiles.py
19 lines (18 loc) · 1 KB
/
SaveAsDWGForFiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import rhinoscriptsyntax as rs
import subprocess
import os
if rs.GetDocumentUserText("Child") is None:
dwg_folder_path = rs.BrowseForFolder("Choose folder to save DWGs into")
files = rs.OpenFileNames("Choose files to save as DWG")
for file in files:
subprocess.Popen('start "" /min "C:\\Program Files\\Rhino 8 WIP\\System\\Rhino.exe" ' + \
'/nosplash /runscript="-SetDocumentUserText Child Child ' + \
'-SetDocumentUserText Export_DWG_folder_path ' + \
chr(34) + chr(34) + dwg_folder_path + chr(34) + chr(34) + ' ' + \
'-RunPythonScript (' + __file__ + ') -Exit No" ' + \
chr(34) + file + chr(34), shell=True)
else:
dwg_folder_path_child = rs.GetDocumentUserText("Export_DWG_folder_path")
rs.Command("-SaveAs " + chr(34) + dwg_folder_path_child + "\\" + \
os.path.splitext(rs.DocumentName())[0] + ".dwg" + chr(34))
rs.Command("-Exit No")