由于我不能用lisp编写代码,我将尝试起草代码的概念,欢迎对lsp的每个部分提供任何帮助。我会试着把它组合起来。。。
多斯利卜
- (defun C:CHLSTATEB (/ LAYOUTS PATTERN LAYERLIST ALLVIEWPORTLIST LISTALLST LAYERSTORE)
- (setq LAYOUTS(mapcar 'strcase(cons "MODEL" (layoutlist))))
- (if(and(setq PATTERN(strcase(getstring "Layoutname (with wildcards):")))
- (/= PATTERN "")
- )
- (progn
- ;;;Create LAYOUTS list using wildcards
- (setq LAYOUTS(vl-remove-if-not '(lambda(X)(wcmatch X PATTERN))LAYOUTS))
- (princ (strcat "\n" (itoa(length LAYOUTS))" layouts found."))
- (terpri)
- (princ LAYOUTS)
- (princ)
- (terpri)
- ;;;Create LAYERLIST list using onscreen list box
- (setq LAYERLIST (dos_layerlistbox
- "Select layers to use:"
- "(Off and frozen layers available)"
- 256) ;;enable multiple selection
- )
- (terpri)
- (princ LAYERLIST)
- (princ)
- (terpri)
- ;;;Create ALLVIEWPORTLIST all viewports
- (setq ALLVIEWPORTLIST (vports))
- (terpri)
- (princ ALLVIEWPORTLIST)
- (princ)
- ;;;Select Layerstate to restore
- (setq LISTALLST (layerstate-getnames includehidden includexref))
- (terpri)
- (princ LISTALLST)
- (princ)
- (terpri)
- (setq LAYERSTORE (dos_listbox "Layerstates" "Select Layerstate to Restore" LISTALLST))
- )
- )
- )
;;;那么,我做了选择,现在怎么办?
- (foreach item (layoutlist)
- (if (wcmatch item LAYOUTS)
- (progn
- (setvar "CTAB" item)
- ;;;Do the layerstate_restore if viewports are on the selected layers
- ;;;using: layerstate-restore layerstatename viewport [restoreflags])
- ;;;problem: viewport must not be nil to use flag 4 which is what i need here...
- ;;;is there a way to specify all or any?
- )
- )
- )
|