那么,您要加载给定图层的关联线型吗?这是我用的
- ;;; ------------------------------------------------------------------------
- ;;; STDLIB_LOAD_LINETYPE.LSP
- ;;;
- ;;; Copyright © December, 2008
- ;;; Timothy G. Spangler
- ;;;
- ;;; Permission to use, copy, modify, and distribute this software
- ;;; for any purpose and without fee is hereby granted, provided
- ;;; that the above copyright notice appears in all copies and
- ;;; that both that copyright notice and the limited warranty and
- ;;; restricted rights notice below appear in all supporting
- ;;; documentation.
- ;;;
- ;;; STDLIB_LOAD_LINETYPE
- ;;;
- ;;; Description:
- ;;; Called from a menu pulldown or rightclick menu
- ;;; * (STDLIB_LOAD_LINETYPE <LINETYPE>)
- ;;; <LINETYPE> = STRING = Valid linetype
- ;;;
- ;;; Returns:
- ;;; T if found and loaded otherwise nil
- ;;;
- ;;; ------------------------------------------------------------------------
- ;;; MAIN FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;
- (defun STDLIB_LOAD_LINETYPE (Linetype / OldCmdEcho LineFiles FullFile Found OpenFile CurrentLine LinePath Result)
- ;; Set system variables
- (setq OldCmdEcho (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- ;; Load linetype
- (if (not (tblsearch "LTYPE" Linetype))
- (progn
- ;; Check each search path for a .lin file
- (foreach Path (STR->LIST (getenv "ACAD") ";")
- (if (setq LineFiles (vl-directory-files Path "*.lin"))
- (progn
- (foreach File LineFiles
- (setq FullFile (cons (strcat Path "\" File) FullFile))
- )
- (setq Found (cons Path Found))
- )
- )
- )
- ;; Read each line file found and check for the linetype
- (foreach LineFile FullFile
- (setq OpenFile (open LineFile "r"))
- (while (setq CurrentLine (read-line OpenFile))
- (if (wcmatch (strcase CurrentLine) (strcat "*" (strcase LineType) "*"))
- (setq LinePath Linefile)
- )
- )
- (close OpenFile)
- )
- ;; Load result
- (if LinePath
- (setq Result T)
- (setq Result nil)
- )
- )
- )
- (if Result
- (command "-linetype" "load" Linetype LinePath "")
- )
- ;; Reset system
- (setvar "CMDECHO" OldCmdEcho)
- ;; Send Result
- Result
- )
- (princ)
只要它是在一个。lin文件应该加载到您的支持路径中。我还没有遇到任何问题。
HTH公司 |