Earlzii 发表于 2022-7-5 17:15:03

绘制lisp和DCL

大家好,
 
我一直在努力做一些我自己的命令,使我的生活更轻松一点,其中大部分都是非常基本的。其中之一是使用不同的方法自动设置打印到PDF。ctb文件和图纸尺寸等。这些取决于客户和图纸类型。
 
我已经为每一个客户编写了一个LISP,它们都很有效,我现在正在尝试使用一个对话框,该对话框有一些选项,例如它是哪一个客户机,以及它是否需要以彩色打印。
 
但是,我不确定如何从对话框中获取信息以运行正确的打印设置。我的想法是得到各个选项,然后将它们串在一起,并使用我已经做过的lisp例程打印出来。下面是我到目前为止提出的,我还需要添加更多选项,我很确定我在这方面的尝试将非常可悲,并且充满了错误,但是如果有人能给我一个正确的方向,我将不胜感激。
 
此外,如果有人可以帮助我,我也想尝试单选按钮,而不仅仅是列表,所以如果有人可以给任何建议,以及我将不胜感激。
 
这是DCL
 
CarlosPlot : dialog {                                //dialog name
   label = "Print to PDF" ;                //give it a label
: list_box {
        label = "Client"
        key = "ClientSelection"
        height = 12;
        allow_accept = false ;
}

: list_box {
        label = "Colour Style"
        key = "ColourSelection"
        height = 12;
        allow_accept = false ;
}

: list_box {
        label = "Sheet Size"
        key = "SizeSelection"
        height = 12;
        allow_accept = false ;
}

: list_box {
        label = "Drawing Style"
        key = "StyleSelection"
        height = 12;
        allow_accept = false ;
}

ok_cancel ;
:text_part {
label = "Designed and Created by";
}
:text_part {
label = "Carl Earles";
}
}
 
这是Lisp程序
 
前4个函数是我所做的绘图例程,我知道它们是有效的。
 
(defun A Colour()
(progn
(setq CurrentDWG (strcat(vl-filename-base (getvar "dwgname"))""))
(setq NewFile (strcat "C:\\Users\\A\\Documents\\PDF's\\A\\" CurrentDWG))

(command "vports" "s" "a" "all" "" )

(command "plot" "y" "" "DWG to PDF.pc3" "ISO full bleed A1 (841.00 x 594.00 MM)" "Millimeters" "Landscape" "No" "Extents" "1:1" "C" "Yes" "A - Colour.ctb" "yes" "no" "no" "no" NewFile "no" "yes")
)
)

(defun A Mono()
(progn
(setq CurrentDWG (strcat(vl-filename-base (getvar "dwgname"))""))
(setq NewFile (strcat "C:\\Users\\A\\Documents\\PDF's\\A\\" CurrentDWG))

(command "vports" "s" "a" "all" "" )

(command "plot" "y" "" "DWG to PDF.pc3" "ISO full bleed A1 (841.00 x 594.00 MM)" "Millimeters" "Landscape" "No" "Extents" "1:1" "C" "Yes" "A Mono.ctb" "yes" "no" "no" "no" NewFile "no" "yes")
)
)

(defun B Colour()
(progn
(setq CurrentDWG (strcat(vl-filename-base (getvar "dwgname"))""))
(setq NewFile (strcat "C:\\Users\\A\\Documents\\PDF's\\B\\" CurrentDWG))

(command "vports" "s" "a" "all" "" )

(command "plot" "y" "" "DWG to PDF.pc3" "ISO full bleed A1 (841.00 x 594.00 MM)" "Millimeters" "Landscape" "No" "Extents" "1:1" "C" "Yes" "B - Colour.ctb" "yes" "no" "no" "no" NewFile "no" "yes")
)
)

(defun B Mono()
(progn
(setq CurrentDWG (strcat(vl-filename-base (getvar "dwgname"))""))
(setq NewFile (strcat "C:\\Users\\A\\Documents\\PDF's\\B\\" CurrentDWG))

(command "vports" "s" "a" "all" "" )

(command "plot" "y" "" "DWG to PDF.pc3" "ISO full bleed A1 (841.00 x 594.00 MM)" "Millimeters" "Landscape" "No" "Extents" "1:1" "C" "Yes" "B Mono.ctb" "yes" "no" "no" "no" NewFile "no" "yes")
)
)

;;; Define the doList code for later use in command
(defun doList    (a)
(cond
;;;
;;; - - - If the options selected by the used is equal to A Colour
;;;
   ((= a 1) (A Colour))

;;;
;;; - - - If the options selected by the used is equal to A Mono
;;;
   ((= a 2) (A Mono))
)
)

;;;
;;; - - - If the options selected by the used is equal to B Colour
;;;
   ((= a 3) (B Colour))
)
)

;;;
;;; - - - If the options selected by the used is equal to B Mono
;;;
   ((= a 4) (B Mono))
)
)

;;;
;;; - - - Command
;;;

(defun C:CarlosPlot ( / dcl_id server_path drv)

(setq CLIENTSELECTION '("A" "B" ); list of Clients
)
(setq COLOURSELECTION '("Colour" "Mono"); list of Colour Styles
)

(setq dialogshow T)                        ;set flag
(setq dcl_id (load_dialog "CarlosPlot.dcl"))        ;initialise dialog box
(if (not                                        ;check dcl exists
(new_dialog "CarlosPlot" dcl_id)        ;load into memory
);not
(setq dialogshow nil)                ;if not exit
);if
(if dialogshow                                ;if dialog
(progn                                        ;continue with programme
(start_list "ClientSelection")                        ;start list box
(mapcar 'add_list CLIENTSELECTION)        ;add names from list
(end_list)                                ;end list box
(start_list "ColourSelection")                        ;start list box
(mapcar 'add_list COLOURSELECTION)        ;add names from list
(end_list)                                ;end list box
(action_tile                                       
   "cancel"                                ;if cancel selected
   "(done_dialog) (setq userclick1 nil)"                ;close dialog, set flag
);action tile
(action_tile
   "accept"                                ;if OK or double click
(strcat
"(progn (setq CLIENT (atof (get_tile \"ClientSelection\")))"                ;get Client Selection
"(done_dialog) (setq userclick1 T))"                                ;close dialog and set flag
"(progn (setq COLOUR (atof (get_tile \"ColourSelection\")))"        ;get Colour Selection
"(done_dialog) (setq userclick1 T))"                                ;close dialog and set flag
);strcat
);action tile
);progn
);if
(setq drv (start_dialog))                        ;display dialog
(unload_dialog dcl_id)                ;unload dialog
(if userclick1
(progn
        (setq CLIENT (nth CLIENT CLIENTSELECTION))                        ;retrieve Client from list
        (setq COLOUR (nth COLOUR COLOURSELECTION))                ;retrieve Colour from list
(cond
((=drv A Colour)(doList 1))
((=drv A Mono)(doList 2))
((=drv B Colour)(doList 3))
((=drv B Mono)(doList 4))
);cond
);progn
);if
;;;- - - Supress the last echo for a clean exit
(princ)
)

BIGAL 发表于 2022-7-5 17:24:02

通过这种方式将列表传递给dcl,您可以拥有它们的所有名称,并返回与COND一起使用的缩写名称,然后运行lisp,您只需要1个defun,将一些答案替换为变量(setq colctb colortable),键=“colortable”从dcl返回。非常肯定www.Lee-mac。com有一个列表dcl示例。
 
part of above
"Yes" "B - Colour.ctb" "yes"
"Yes" colctb "yes"

"DWG to PDF.pc3" is now dwgto so can become printer as well.

(command "plot" "y" "" DWGto PAPERSZ "Millimeters" "Landscape" "No" "Extents" scale "C" "Yes" COLCTB ""Y" "n" "n" "n" dwgname "N" "y")
note I have added dwgname this for us is read from the dwg details and save pdf to a specific directory.

Earlzii 发表于 2022-7-5 17:26:35

谢谢比格尔的建议,我已经研究过了,并找到了一个例子。试着去理解它,所以现在这是一项正在进行的工作。然而,我需要更多的帮助,当我打印PDF并保存它时,我需要将版本添加到文件名的末尾。这些信息存储在一个名为CHECK PRINT-A1的块中,标记名为PRINT\u REF。我只是不知道如何获取这些信息,所以我可以设置它,然后将其添加到文件名的末尾。

rlx 发表于 2022-7-5 17:32:03

嗨,厄尔齐,
 
 
也许我的wai tai util可以帮你。
 
 



;--------------------------------------------- Attribute Utilities ----------------------------------------------------
(defun wai (b a v)
(setq a (strcase a) b (ent->vla b))
(vl-some '(lambda (x)(if (= a (strcase (vla-get-tagstring x)))(progn (vla-put-textstring x v) v)))
       (vlax-invoke b 'getattributes)))
(defun tai ( blk tag )
(setq tag (strcase tag) blk (ent->vla blk))
(if blk (vl-some '(lambda (x) (if (= tag (strcase (vla-get-tagstring x))) (vla-get-textstring x)))
    (vlax-invoke blk 'getattributes))))
(defun ent->vla ( e )
(cond ((= (type e) 'VLA-OBJECT) e)
((= (type e) 'ENAME)(vlax-ename->vla-object e))
((and (= (type e) 'STR) (tblsearch "block" e))
(ent->vla (ssname (ssget "x" (list (cons 0 "INSERT")(cons 2 e))) 0)))    (t nil)))



wai代表“wijzig attribute inhoud”(更改属性值)en tai代表“toon attribute inhoud”(显示属性值)
 
 
这两个例程都通过ent->vla函数接受ename、vla name of string作为块名。
 
 
在你的情况下(tai“CHECK PRINT-A1”“PRINT\u REF”)应该可以做到这一点(我希望)
 
 
gr.Rlx
 
 
p、 有关属性处理的更多信息,请参见:http://www.lee-mac.com/attributefunctions.html

Earlzii 发表于 2022-7-5 17:35:05

谢谢rlx,它工作得很好!!

BIGAL 发表于 2022-7-5 17:41:17

plotpdf lisp向pdf添加布局名称的示例,第二个是从所有布局的标题栏中检索属性值。需要getval。lsp一个不断变化的自动DCL例程。
绘图PDF。lsp
getval。lsp
发布用于施工。lsp

Earlzii 发表于 2022-7-5 17:43:43

谢谢大家,我终于开始有所进展了,但我再次陷入困境,我想定义可以选择的不同情节。然而,当你从对话框中选择OK时,它应该运行这个命令,但它告诉我它是未知的,这真的很烦人。
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;                                                                                ;;;;;
;;;;;        DEFINES ALL THE DIFFERENT PLOT SETTINGS FOR                                ;;;;;
;;;;;        A DRAWINGS TO BE PRINTED TO PDF                               ;;;;;
;;;;;                                                                                ;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun C:AA12DMONOCHECK_PRINT(CurrentDWG UName ARev ACP)
(setq CurrentDWG (strcat(vl-filename-base (getvar "dwgname"))""))                                        ;;;Gets the current drawing name
(setq UName (getenv "UserName"))                                                                        ;;;Gets the username
(setq ARev (showattvalue "CHECK PRINT - A1" "PRINT_REF"))                                                ;;;Gets the revision from A Drawings.
(setq ACP (strcat "C:\\Users\\" UName "\\Documents\\PDF's\\A\\" CurrentDWG "_" ARev))                        ;;;Sets the path to save to for a A Check Print

(command "vports" "s" "a" "all" "" )

(command "plot" "y" "" "DWG to PDF.pc3" "ISO full bleed A0 (841.00 x 1189.00 MM)" "Millimeters" "Landscape" "No" "Extents" "1:1" "C" "Yes" "A - Mono.ctb" "yes" "no" "no" "no" ACP "no" "yes")
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;                                                                                ;;;;;
;;;;;        BELOW ARE THE COMMANDS THAT SHOW THE ATTRIBUTE AND ALSO                ;;;;;
;;;;;        CHANGE THE ATTRIBUTE VALUE IF REQUIRED (FROM rlx)                        ;;;;;
;;;;;                                                                                ;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun changeattvalue (b a v)
(setq a (strcase a) b (ent->vla b))
(vl-some '(lambda (x)(if (= a (strcase (vla-get-tagstring x)))(progn (vla-put-textstring x v) v)))
       (vlax-invoke b 'getattributes)))
(defun showattvalue ( blk tag )
(setq tag (strcase tag) blk (ent->vla blk))
(if blk (vl-some '(lambda (x) (if (= tag (strcase (vla-get-tagstring x))) (vla-get-textstring x)))
    (vlax-invoke blk 'getattributes))))
(defun ent->vla ( e )
(cond ((= (type e) 'VLA-OBJECT) e)
((= (type e) 'ENAME)(vlax-ename->vla-object e))
((and (= (type e) 'STR) (tblsearch "block" e))
(ent->vla (ssname (ssget "x" (list (cons 0 "INSERT")(cons 2 e))) 0)))    (t nil)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;                                                                                ;;;;;
;;;;;        LEE MACKS LIST DEPENDENCY DEFINED HERE AND USED LATER                ;;;;;
;;;;;        IN THE MAIN PLOT COMMAND                                                ;;;;;
;;;;;                                                                                ;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; DCL List-Tile Dependency-Lee Mac
;; Configures action_tile statements for the list of keys to enabled dependency between the DCL tiles.
;; key   - List of DCL tile keys in order of dependency
;; lst-sym - Quoted variable containing list data
;; rtn-sym - Quoted variable containing initial selection indexes

(defun LM:dcld:action ( key lst-sym rtn-sym )
   
   (defun LM:dcld:addlist ( key lst )
       (start_list key)
       (foreach itm lst (add_list itm))
       (end_list)
   )
   (defun LM:dcld:getlists ( idx lst )
       (if (cdr idx)
         (cons (mapcar 'car lst) (LM:dcld:getlists (cdr idx) (cdr (nth (car idx) lst))))
         lst
       )
   )
   (defun LM:substnth ( itm idx lst )
       (if lst
         (if (zerop idx)
               (cons itm (cdr lst))
               (cons (car lst) (LM:substnth itm (1- idx) (cdr lst)))
         )
       )
   )
   (defun LM:dcld:actions ( key lst-sym rtn-sym lvl / fun )
       (setq fun
         (if (cdr key)
               (list 'lambda '( val lst / tmp )
                   (list 'setqrtn-sym(list 'LM:substnth '(atoi val) lvl rtn-sym)
                               'tmp      (list 'LM:dcld:getlists rtn-sym 'lst)
                   )
                   (list 'LM:dcld:addlist (cadr key) (list 'nth (1+ lvl) 'tmp))
                   (list 'if (list '<= (list 'length (list 'nth (1+ lvl) 'tmp)) (list 'nth (1+ lvl) rtn-sym))
                     (list 'setq rtn-sym (list 'LM:substnth 0 (1+ lvl) rtn-sym))
                   )
                   (list
                     (LM:dcld:actions (cdr key) lst-sym rtn-sym (1+ lvl))
                     (list 'set_tile (cadr key) (list 'itoa (list 'nth (1+ lvl) rtn-sym))) 'lst
                   )
               )
               (list 'lambda '( val lst )
                   (list 'setq rtn-sym (list 'LM:substnth '(atoi val) lvl rtn-sym))
               )
         )
       )
       (action_tile (car key) (vl-prin1-to-string (list fun '$value lst-sym)))
       fun
   )
   (mapcar 'LM:dcld:addlist key (LM:dcld:getlists (eval rtn-sym) (eval lst-sym)))
   (   (eval (LM:dcld:actions key lst-sym rtn-sym 0))
       (set_tile (car key) (itoa (car (eval rtn-sym))))
       (eval lst-sym)
   )
   (princ)
)

;; DCL List-Tile Dependency-Get Items-Lee Mac
;; Returns a list of the items selected from each dependent list tile.
;; idx - List of selection indexes
;; lst - List data

(defun LM:dcld:getitems ( idx lst / tmp )
   (if (cdr idx)
       (cons (car (setq tmp (nth (car idx) lst))) (LM:dcld:getitems (cdr idx) (cdr tmp)))
       (list (nth (car idx) (car lst)))
   )
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:PDFPlot ( / *error* dch dcl des lst rtn )

   (defun *error* ( msg )
       (if (= 'file (type des))
         (close des)
       )
       (if (< 0 dch)
         (unload_dialog dch)
       )
       (if (and (= 'str (type dcl)) (findfile dcl))
         (vl-file-delete dcl)
       )
       (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
         (princ (strcat "\nError: " msg))
       )
       (princ)
   )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;                                                                                ;;;;;
;;;;;                SETS THE LISTS TO BE DISPLAYED IN THE WINDOW                        ;;;;;
;;;;;                                                                                ;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (setq lst
      '(
         (
               "A"
               (
                   "A0"
                   (
                     "2D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )                (
                   "A1"
                   (
                     "2D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )                (
                   "A3"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )
         )
         (
               "B"
               (
                   "A0"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )                (
                   "A1"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )                (
                   "A3"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )
         )
         (
               "C"
               (
                   "A0"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )               
(
                   "A1"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )                (
                   "A3"
                   (
                     "2D"
                        (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
                           "Significant Hazard"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
                   (
                     "3D"
                     (
                           "Mono"
                ( "Check_Print"
                  "Issue"
                )
                     )
                     (
        "Colour"
                ( "Check_Print"
                  "Issue"
                )
                     )
                   )
               )
         )
   )
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (if
       (and
         (setq dcl (vl-filename-mktemp "tmp.dcl"))
         (setq des (open dcl "w"))
         (foreach str
            '(
                   "lbx : list_box"
                   "{"
                   "    alignment = centered;"
                   "    fixed_width = true;"
                   "    fixed_height = true;"
                   "    width = 20;"
                   "    height = 15;"
                   "}"
                   "test : dialog"
                   "{"
                   "    label = \"List Box Dependency Example\";"
                   "    spacer;"
                   "    : row"
                   "    {"
                   "      : lbx { key = \"lb0\"; label = \"Client\"; }"
                   "      : lbx { key = \"lb1\"; label = \"Sheet Size\"; }"
                   "      : lbx { key = \"lb2\"; label = \"2D / 3D\"; }"
                   "      : lbx { key = \"lb3\"; label = \"Colour Table\"; }"
                   "      : lbx { key = \"lb4\"; label = \"Issue / Check Print\"; }"
                   "    }"
                   "    spacer;"
                   "    ok_cancel;"
                   "}"
               )
               (write-line str des)
         )
         (not (setq des (close des)))
         (< 0 (setq dch (load_dialog dcl)))
         (new_dialog "test" dch)
       )
       (progn         
         (setq rtn '(0 0 0 0 0))
         (LM:dcld:action '("lb0" "lb1" "lb2" "lb3" "lb4") 'lst 'rtn)
         (if (= 1 (start_dialog))
               (command
                     (substr
                           (apply 'strcat
                               (mapcar '(lambda ( x ) (strcat "" x))
                                 (LM:dcld:getitems rtn lst)
                               )
                           )
        1
                     )
               )
               (princ "\n*Cancel*")
         )
       )
   )
   (*error* nil)
   (princ)
)
 
这意味着您正在传递定义已设置的4个变量值CurrentDWG UName ARev ACP,但在下一行中设置它们,可能很简单,只需将其设置为局部变量。
 
defun C:AA12DMONOCHECK_PRINT(CurrentDWG UName ARev ACP)
 
当你在做dcl a plot range选项时,也可以使用Mybe。

BIGAL 发表于 2022-7-5 17:50:30

恐怕这还没有解决这个问题。我仍然在命令行中看到这个,
 
AA12DMonoCheck\u Print未知命令“AA12DMonoCheck\u Print”。按F1键获取帮助。
 
就像我说的,当我运行主PDFPLOT命令时,如果我输入AA12DMONOCHECK\u PRINT,它还不能工作。这一定是我告诉它运行用户选择的方式。我在下面用过这个
defun AA12DMONOCHECK_PRINT(CurrentDWG UName ARev ACP)
 
可能是因为我告诉它,这是一个命令,但它不是AutoCAD命令,所以它不知道它是什么。但我不知道如何告诉它运行。
 
此外,我很喜欢添加绘图范围选项的想法,但在我的工作领域,在多个选项卡上有东西是一个很大的禁忌,它只是模型空间和一个布局允许。虽然我可能会考虑添加这样的东西,作为一种学习锻炼,一旦我能想出如何让它发挥作用。

Earlzii 发表于 2022-7-5 17:53:28

您可以用与普通defun相同的方式调用c:defun,(c::AA12DMONOCHECK\u PRINT)您不需要使用命令

BIGAL 发表于 2022-7-5 17:58:37

所以如果我改变
defun AA12DMONOCHECK_PRINT(CurrentDWG UName ARev ACP)


(defun C:AA12DMONOCHECK_PRINT( / CurrentDWG UName ARev ACP)

如果它工作,因为我已经改变了它,它没有哈哈,整个事情运行良好,它没有告诉我AA12DMONOCHECK\u PRINT是一个未知的命令,但它也没有做任何事情后,选择了。
页: [1] 2
查看完整版本: 绘制lisp和DCL