Multiple DXF Export
Multiple DXF Export
Multiple DXF Export
# NAME:
#
# dxfExport.py
import sys
from string import *
import kcs_ui
import kcs_util
import kcs_draft
import kcs_db
#-------------------------------------------------------------------------------
def dxfExport():
#while 1:
crit = ObjectCriteria()
crit.SetName(None)
crit.SetCode1(None)
crit.SetCode2(None)
crit.SetSize(None)
crit.SetCreationDate(None)
name = crit.GetName()
name='1250070800*'
dbname = 'SB_PDB'
targdir="C:\\TEMP\\DXF_EXPORT\\"
kcs_ui.message_noconfirm('Script interrupted')
res, dbname = kcs_ui.string_req("from DB: SB_PDB-General drawing... ", dbname)
if res ==kcs_util.ok():
res1, targdir = kcs_ui.string_req('Target directory for export dxf-files:
(before make dir on local disk)', targdir)
if res1 ==kcs_util.ok():
res2, name = kcs_ui.string_req('Name/Criteria :', name)
if res2 ==kcs_util.ok():
crit.SetName(name)
list = []
kcs_db.object_list_get(crit, dbname, list)
objstrlist = []
index = 1
if kcs_draft.dwg_current():
kcs_draft.dwg_close()
for item in list:
stritems = split(str(item), '\n')
stritems[0] = 'Object %i' % index
index = index+1
objstrlist = objstrlist + stritems
sketch=stritems[1][9:]
kcs_ui.message_noconfirm(sketch)
kcs_draft.dwg_open(sketch,dbname)
# sketch=replace(sketch,'_','-')
sketch=targdir+sketch
kcs_ui.message_noconfirm('exporting ...'+sketch)
kcs_draft.dwg_dxf_export(sketch,12,1)
kcs_draft.dwg_close()
# kcs_ui.message_noconfirm('Script interrupted')
dxfExport()
def run(*args):
dxfExport()