运行LISP项目时出错
_$ (PUTPAGESETUP "101" "PDF LEDGER"); error: no function definition: VLAX-GET-ACAD-OBJECT
我发现下面的代码读取命名页面设置,应该能够设置它,但当最终设法让它运行时,它似乎在某个地方有错误。
; Jason Piercey . May 16th, 2003
; assign a pagesetup to a layout
; - string, layout name
; - string, pagesetup to assign
; return: T or nil
; modified by chris castelein 10-31-05
; to pass paper size as an argument.
; original prompt code left in and remarked out.
(defun putPagesetup (layout setup / layouts plots)
(defun item-p (collection item)
(if
(not
(vl-catch-all-error-p
(vl-catch-all-apply
'(lambda () (setq item (vla-item collection item))))))
item
)
)
(and
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
(setq layouts (vla-get-layouts *doc*))
(setq plots (vla-get-plotconfigurations *doc*))
(setq layout (item-p layouts layout))
(setq setup (item-p plots setup))
(not (vla-copyfrom layout setup))
)
)
(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))
)
)
(reverse nlist)
)
; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
(massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings"))
)
; Jason Piercey . May 19th, 2003
; assign pagesetup to layout(s)
; LIMITED testing
; written for Shawn McDonald
(defun psetup (page / lst res)
(vl-load-com)
(setq lst (mapcar 'strcase (getPagesetups)))
(while (not page)
;(setq page (strcase (getstring T "\nspecify pagesetup to apply: ")))
(if (or (= "" page) (not (member page lst)))
(progn (princ "\npagesetup not found") (setq page nil))
)
)
(initget "All Current")
;(if(not(setq res (getkword "\napply pagesestup to which layout(s) <all>: ")))
;(setq res "All")
(setq res "Current")
(if (= "All" res)
(foreach x (vl-remove "Model" (layoutlist)) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
)
(princ "\nFinished")
(princ)
)
添加
(vl-load-com)
直到代码的最后,在任何函数定义之外。
不是我干的,也许是我做错了什么。
页:
[1]