|
以下的代碼你試試看,主要是第一和第二步,其第三步驟,請你自行寫,或是手動更新
- axlCmdRegister("sm" 'fnSymbolMain)
- procedure(fnSymbolMain()
- let((tSymbolDir lLayers)
- unless(axlGetVariable("noconfirm")
- axlSetVariable("noconfirm" t)
- )
- ;Symbols要存放的目錄
- tSymbolDir = "./symbols" ;此目錄名稱必須自行變更
- ;要刪除資料的層面名稱
- lLayers = list("PACKAGE GEOMETRY/ASSEMBLY_TOP" "PACKAGE GEOMETRY/ASSEMBLY_BOTTOM")
-
- fnDumpLibrary(tSymbolDir)
- fnSymbolsProcess(tSymbolDir lLayers)
- )
- )
- procedure(fnDumpLibrary(tExportDir)
- let((tSymDir tFile tDir tCmd)
- tSymDir = simplifyFilename(tExportDir)
- tFile = axlGetVariable("module")
- tDir = getWorkingDir()
- changeWorkingDir(tSymDir)
- sprintf(tCmd "dump_libraries %L" strcat(tDir "/" tFile))
- axlRunBatchDBProgram("dump_libraries" tCmd ?silent nil ?noUnload t ?reloadDB nil)
- changeWorkingDir(tDir)
- )
- )
- procedure(fnSymbolsProcess(tSymbolDir lLayers)
- let((lNewFiles tFile)
- lNewFiles = fnGetSymbolFile(tSymbolDir)
- foreach(tOne lNewFiles ;tOne = nth(0 lNewFiles)
- ;讀取資料
- tFile = simplifyFilename(strcat(tSymbolDir "/" tOne))
- axlOpenDesign(?design tFile ?mode "w")
- ;刪除某一層資料
- fnSymbolsDeleteData(lLayers)
- ;儲存資料
- axlSaveDesign(?design tFile ?mode "nocheck")
- )
- )
- )
- procedure(fnGetSymbolFile(tSymbolDir)
- let((tDir lAllPathFiles lFiles tName lNewFiles)
- tDir = simplifyFilename(tSymbolDir)
- ;取Package Symbols的檔案名稱(*.psm)
- when(isDir(tDir)
- lAllPathFiles = getDirFiles(tDir)
- lFiles = setof(x lAllPathFiles index(x ".psm"))
- foreach(tOne lFiles ;tOne = nth(0 lFiles)
- tName = cadr(axlDMFileParts(tOne))
- lNewFiles = cons(strcat(tName ".dra") lNewFiles)
- )
- )
- lNewFiles
- )
- )
- procedure(fnSymbolsDeleteData(lLayers)
- let((lSaveVisible lCSSaveArea lAllObject)
- lSaveVisible = axlVisibleGet()
- lSaveArea = axlWindowBoxGet()
- when(lLayers
- axlVisibleDesign(nil)
- foreach(tLayer lLayers
- axlVisibleLayer(sprintf(nil "%s" tLayer) t)
- )
- axlVisibleUpdate(t)
- axlClearSelSet()
- axlSetFindFilter(?enabled list("lines" "shapes") ?onButtons list("lines" "shapes"))
- axlAddSelectAll()
- lAllObject = axlGetSelSet()
- axlClearSelSet()
- axlDeleteObject(lAllObject)
- )
- axlVisibleSet(lSaveVisible)
- axlWindowBoxSet(lSaveArea)
- axlVisibleUpdate(t)
- )
- )
复制代码
|
|