Hello all,
I have a whole load of files where a particular layer has to be deleted and placed into a new folder as a DXF. The odd thing is I had it working perfectly earlier however when I went back to run it I noticed the command line was full of errors saying the file could not be found, but stranger than that, a copy of all my files were made in the destination folder and the desired files with the removed layers were left in the origin folder.
So the code I used was:
import os
import rhinoscriptsyntax as rs
import Rhino
path = rs.BrowseForFolder()
saveloc = rs.BrowseForFolder()
layer = "Layer 01"
extension = ".dxf"
# Create file list
files = [f for f in os.listdir(path)]
#print(files)
for each in files:
#path = each;
rs.DocumentModified(False)
rs.Command('_-Open {} _Enter'.format(each))
if layer: rs.PurgeLayer(layer)
file = '"' + saveloc + "\\" + each +'"'
#rs.Command('_SelAll -Export {} _Enter'.format(path))
rs.Command("_SelAll _-Export {} _Enter".format(file))
So it seems to me the file path is identical to the location of the file - am I missing something here?
Thanks in advance,
Sash
7 posts - 3 participants