这就是我的Bigal,但我在加载时遇到了一个错误:
- (defun c:Getmaptile (/ bn chk pp bnloc)
- (setq bn "" chk nil); set block name nil
- (while (= chk nil)
- (setq chk (ssget "\nPick a Block: "))
- )
- (setq pp (cadr chk))
- (setq chk (entget (car chk)))
- (setq bn (cdr (assoc 2 chk))); get block name
- [color="red"](setq fout (open "C:\acadtemp\tiles.scr "w"))
- (setvar "filedia" 0)
- (write-line "new " fout) ; note 2 spaces check for using default dwt etc[/color]
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (setq Drawings (matchfiles (strcat "M:\\os\\Maps\\AutoCAD\\5000\" bn "*.dwg")))
- (foreach Dwg Drawings
- [color="red"] ;(command "_.insert" Dwg "0,0,0" "1" "1" "0")
- (setq dwgtile (strcat "_.insert" dwg "0,0,0" "1" "1" "0"))
- (Write-line dwgtile fout)
-
- (close fout)
- )[/color]
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (setq Drawings (matchfiles (strcat "M:\\os\\Maps\\AutoCAD\\2500\" bn "*.dwg")))
- (foreach Dwg Drawings
- [color="red"] ;(command "_.insert" Dwg "0,0,0" "1" "1" "0")
- (setq dwgtile (strcat "_.insert" dwg "0,0,0" "1" "1" "0"))
- (Write-line dwgtile fout)
-
- (close fout)
- )[/color]
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (setq Drawings (matchfiles (strcat "M:\\os\\Maps\\AutoCAD\\1000\" bn "*.dwg")))
- (foreach Dwg Drawings
- [color="red"] ;(command "_.insert" Dwg "0,0,0" "1" "1" "0")
- (setq dwgtile (strcat "_.insert" dwg "0,0,0" "1" "1" "0"))
- (Write-line dwgtile fout)
-
- (close fout)
- )[/color]
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (princ)
- )
- [color="red"](command "script" "C:\acadtemp\tiles")[/color]
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Function to list files from a wildcard match
- (defun matchfiles (path / item dir match lst fil files)
- (setq path (strsplit "," path))
- (foreach item path
- (setq dir (strcat (vl-string-right-trim "\" (vl-filename-directory item)) "\")
- match (substr item (1+ (strlen dir)))
- lst (vl-directory-files dir match 1)
- )
- (foreach fil lst
- (setq files (cons (strcat dir fil) files))
- )
- )
- (reverse files)
- )
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Function to split a string on a specified character
- (defun strsplit (c str / lst p n)
- (setq n 0)
- (while (setq p (vl-string-search c str n))
- (setq lst (cons (substr str (1+ n) (- p n)) lst))
- (setq n (1+ p))
- )
- (if (< n (strlen str))
- (setq lst (cons (substr str (1+ n)) lst))
- )
- (reverse lst)
- )
你能看一下吗?
谢谢 |