YANGGY 发表于 2013-9-11 13:22:37

可视化DCL新思路简易版


试试能用不?

自贡黄明儒 发表于 2013-9-11 13:28:01

什么呀,根本不能用

vlisp2012 发表于 2013-9-11 13:28:36

下载下来看看。

机械工程师 发表于 2013-9-11 13:35:30

error:no function definition: GETDCL
; 错误: *error* 函数中出错quit / exit abort

vlisp2012 发表于 2013-9-11 13:43:07

命令: TT
; 错误: no function definition: GETDCL

xiaoyuzj-503 发表于 2013-9-11 16:52:18

LZ。是否可以截个图看看?

hao3ren 发表于 2013-9-11 18:13:55

呵呵,可以看到,函数里面都有

梦回唐朝 发表于 2013-9-14 19:14:37

可以用的,很好

edata 发表于 2013-9-15 21:22:17

1:tt命令里的局部函数定义要放在前面,否则函数无效。
Autolisp默认是一行一行执行,(defun c:tt (/ dcl_id f file i stra)        ;这里就是你要的排列样式
   

   



    ;;按钮
    (defun buttond1 (/ dinf)
        (setq
          dinf
             (strcat
                   " : button {"
                   " label =\"预览(R)\"; "
                   " key =\"PreviewBtn \"; "
                   "mnemonic = \"R\"; "
                   "is_enabled = false; "
                   "}"
                  )
        )
        dinf
    )

    ;;图像
    (defun imaged (/ dinf)
        (setq
          dinf
             (strcat
                   " : image {"
                   " key =\"Previewss \"; "
                   "mnemonic = \"R\"; "
                   "is_enabled = false; "
                   "}"
                  )
        )
        dinf
    )


    ;;文字
    (defun textd (/ dinf)
        (setq
          dinf
             (strcat
                   " : text { "
                   " label = \"打印设备名:\";"
                   " value = \"打印设备名:\";"
                   " key = \"PlotterLabel\"; "
                   " } "
                  )
        )
        dinf
    )
    ;;编辑框
    (defun edit_boxd (/ dinf)
        (setq dinf (strcat
                     ": edit_box {"
                     " label = \"打印份数:\";"
                     " value = \"1\";"
                     " key = \"CopiesEdit\";"
                     " width = 8;"
                     " fixed_width = true;"
                     " }"
                      )
        )
        dinf
    )


    ;;单选钮
    (defun radio_buttond (str1v / dinf)
        (setq dinf (strcat
                     " : radio_button { "
                     " label = \"适合图纸\"; "
                     (strcat " key = \"" str1v " \"; ")
                     " }"
                   )
        )
        dinf
    )

    ;;多选钮
    (defun toggled (str1 / dinf)
        (setq dinf (strcat
                     " : toggle {"
                     " label = \"自动旋转\";"
                     (strcat " key = \" " str1 " \";   ")
                     " } "
                   )
        )
        dinf
    )

    ;;下拉菜单
    (defun popup_listd (/ dinf)
        (setq dinf (strcat
                     " : popup_list { "
                     " key = \"LayerNameEdit\"; "
                     " fixed_height = false; "
                     " fixed_width = true;"
                     " width = 20; "
                     " }"
                      )
        )
        dinf
    )


    ;;行框
    (defun boxed_rowd (/ dinf)
        (setq dinf (strcat
                     ": boxed_row {"
                     "label = \"图纸定位\";"
                     "key = \"LocationSettings\";"
                   )
        )
        dinf
    )
    ;;少“}”


    ;;单选行
    (defun radio_rowd (/ dinf)
        (setq dinf " : radio_row { ")
        dinf
    )
    ;;少“}”

    ;;单选列
    (defun radio_columnd (/ dinf)
        (setq dinf " : radio_column { ")
        dinf
    )
    ;;少“}”


    ;;行
    (defun rowd        (/ dinf)
        (setq dinf " : row {")
        dinf
    )
    ;;少“}”


    ;;列
    (defun columnd (/ dinf)
        (setq dinf " : column {")
        dinf
    )
    ;;少“}”
;;局部函数先加载
(setq stra "nonsmall:dialog{label=\"可视化DCL\";")
    (setq stra (strcat stra (getdcl dcl)))
    (setq stra (strcat stra "ok_cancel;}"))
                                        ;把DCL代码写出并且调用观看效果
    (setq file "d:\\test.dcl")
    (if        (findfile file)
        (setq f (open "d:\\test.dcl" "w"))
        (setq f (open "d:\\test.dcl" "a"))
    )
    (write-line stra f)
    (close f)
    (setq dcl_id (load_dialog file))
    (new_dialog "nonsmall" dcl_id)
    (start_dialog)
    (unload_dialog dcl_id)
    (startapp "notepad" file)
    (princ)



)2:将局部函数定义成全局函数(defun c:tt (/ dcl_id f file i stra)        ;这里就是你要的排列样式
   
(setq stra "nonsmall:dialog{label=\"可视化DCL\";")
    (setq stra (strcat stra (getdcl dcl)))
    (setq stra (strcat stra "ok_cancel;}"))
                                        ;把DCL代码写出并且调用观看效果
    (setq file "d:\\test.dcl")
    (if        (findfile file)
        (setq f (open "d:\\test.dcl" "w"))
        (setq f (open "d:\\test.dcl" "a"))
    )
    (write-line stra f)
    (close f)
    (setq dcl_id (load_dialog file))
    (new_dialog "nonsmall" dcl_id)
    (start_dialog)
    (unload_dialog dcl_id)
    (startapp "notepad" file)
    (princ)



);;;;;;TT函数结束
   

   



    ;;按钮
    (defun buttond1 (/ dinf)
        (setq
          dinf
             (strcat
                   " : button {"
                   " label =\"预览(R)\"; "
                   " key =\"PreviewBtn \"; "
                   "mnemonic = \"R\"; "
                   "is_enabled = false; "
                   "}"
                  )
        )
        dinf
    )

    ;;图像
    (defun imaged (/ dinf)
        (setq
          dinf
             (strcat
                   " : image {"
                   " key =\"Previewss \"; "
                   "mnemonic = \"R\"; "
                   "is_enabled = false; "
                   "}"
                  )
        )
        dinf
    )


    ;;文字
    (defun textd (/ dinf)
        (setq
          dinf
             (strcat
                   " : text { "
                   " label = \"打印设备名:\";"
                   " value = \"打印设备名:\";"
                   " key = \"PlotterLabel\"; "
                   " } "
                  )
        )
        dinf
    )
    ;;编辑框
    (defun edit_boxd (/ dinf)
        (setq dinf (strcat
                     ": edit_box {"
                     " label = \"打印份数:\";"
                     " value = \"1\";"
                     " key = \"CopiesEdit\";"
                     " width = 8;"
                     " fixed_width = true;"
                     " }"
                      )
        )
        dinf
    )


    ;;单选钮
    (defun radio_buttond (str1v / dinf)
        (setq dinf (strcat
                     " : radio_button { "
                     " label = \"适合图纸\"; "
                     (strcat " key = \"" str1v " \"; ")
                     " }"
                   )
        )
        dinf
    )

    ;;多选钮
    (defun toggled (str1 / dinf)
        (setq dinf (strcat
                     " : toggle {"
                     " label = \"自动旋转\";"
                     (strcat " key = \" " str1 " \";   ")
                     " } "
                   )
        )
        dinf
    )

    ;;下拉菜单
    (defun popup_listd (/ dinf)
        (setq dinf (strcat
                     " : popup_list { "
                     " key = \"LayerNameEdit\"; "
                     " fixed_height = false; "
                     " fixed_width = true;"
                     " width = 20; "
                     " }"
                      )
        )
        dinf
    )


    ;;行框
    (defun boxed_rowd (/ dinf)
        (setq dinf (strcat
                     ": boxed_row {"
                     "label = \"图纸定位\";"
                     "key = \"LocationSettings\";"
                   )
        )
        dinf
    )
    ;;少“}”


    ;;单选行
    (defun radio_rowd (/ dinf)
        (setq dinf " : radio_row { ")
        dinf
    )
    ;;少“}”

    ;;单选列
    (defun radio_columnd (/ dinf)
        (setq dinf " : radio_column { ")
        dinf
    )
    ;;少“}”


    ;;行
    (defun rowd        (/ dinf)
        (setq dinf " : row {")
        dinf
    )
    ;;少“}”


    ;;列
    (defun columnd (/ dinf)
        (setq dinf " : column {")
        dinf
    )
    ;;少“}”

xhq1954425 发表于 2013-9-16 16:40:18

这根本就是不能用!
页: [1]
查看完整版本: 可视化DCL新思路简易版