明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1886|回复: 9

[讨论] 可视化DCL新思路简易版

[复制链接]
发表于 2013-9-11 13:22:37 | 显示全部楼层 |阅读模式

试试能用不?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2013-9-11 13:28:01 | 显示全部楼层
什么呀,根本不能用
发表于 2013-9-11 13:28:36 | 显示全部楼层
下载下来看看。
发表于 2013-9-11 13:35:30 | 显示全部楼层
error:no function definition: GETDCL
; 错误: *error* 函数中出错quit / exit abort
发表于 2013-9-11 13:43:07 | 显示全部楼层
命令: TT
; 错误: no function definition: GETDCL
发表于 2013-9-11 16:52:18 | 显示全部楼层
LZ。是否可以截个图看看?
发表于 2013-9-11 18:13:55 | 显示全部楼层
呵呵,可以看到,函数里面都有
发表于 2013-9-14 19:14:37 | 显示全部楼层
可以用的,很好
发表于 2013-9-15 21:22:17 | 显示全部楼层
1:tt命令里的局部函数定义要放在前面,否则函数无效。
Autolisp默认是一行一行执行,
  1. (defun c:tt (/ dcl_id f file i stra)        ;这里就是你要的排列样式
  2.    

  3.    



  4.     ;;按钮
  5.     (defun buttond1 (/ dinf)
  6.         (setq
  7.             dinf
  8.                (strcat
  9.                    " : button {  "
  10.                    " label ="预览(R)"; "
  11.                    " key =  "PreviewBtn "; "
  12.                    "  mnemonic = "R"; "
  13.                    "  is_enabled = false; "
  14.                    "  }  "
  15.                   )
  16.         )
  17.         dinf
  18.     )

  19.     ;;图像
  20.     (defun imaged (/ dinf)
  21.         (setq
  22.             dinf
  23.                (strcat
  24.                    " : image {  "
  25.                    " key =  "Previewss "; "
  26.                    "  mnemonic = "R"; "
  27.                    "  is_enabled = false; "
  28.                    "  }  "
  29.                   )
  30.         )
  31.         dinf
  32.     )


  33.     ;;文字
  34.     (defun textd (/ dinf)
  35.         (setq
  36.             dinf
  37.                (strcat
  38.                    " : text { "
  39.                    " label = "打印设备名:";  "
  40.                    " value = "打印设备名:";  "
  41.                    " key = "PlotterLabel"; "
  42.                    " } "
  43.                   )
  44.         )
  45.         dinf
  46.     )
  47.     ;;编辑框
  48.     (defun edit_boxd (/ dinf)
  49.         (setq dinf (strcat
  50.                        ": edit_box {"
  51.                        " label = "打印份数:";"
  52.                        " value = "1";"
  53.                        " key = "CopiesEdit";"
  54.                        " width = 8;"
  55.                        " fixed_width = true;"
  56.                        " }"
  57.                       )
  58.         )
  59.         dinf
  60.     )


  61.     ;;单选钮
  62.     (defun radio_buttond (str1v / dinf)
  63.         (setq dinf (strcat
  64.                        " : radio_button { "
  65.                        " label = "适合图纸"; "
  66.                        (strcat " key = "" str1v " "; ")
  67.                        " }"
  68.                    )
  69.         )
  70.         dinf
  71.     )

  72.     ;;多选钮
  73.     (defun toggled (str1 / dinf)
  74.         (setq dinf (strcat
  75.                        " : toggle {  "
  76.                        " label = "自动旋转";  "
  77.                        (strcat " key = " " str1 " ";   ")
  78.                        " } "
  79.                    )
  80.         )
  81.         dinf
  82.     )

  83.     ;;下拉菜单
  84.     (defun popup_listd (/ dinf)
  85.         (setq dinf (strcat
  86.                        " : popup_list { "
  87.                        " key = "LayerNameEdit"; "
  88.                        " fixed_height = false; "
  89.                        " fixed_width = true;  "
  90.                        " width = 20; "
  91.                        " }  "
  92.                       )
  93.         )
  94.         dinf
  95.     )


  96.     ;;行框
  97.     (defun boxed_rowd (/ dinf)
  98.         (setq dinf (strcat
  99.                        ": boxed_row {"
  100.                        "label = "图纸定位";"
  101.                        "key = "LocationSettings";"
  102.                    )
  103.         )
  104.         dinf
  105.     )
  106.     ;;少“}”


  107.     ;;单选行
  108.     (defun radio_rowd (/ dinf)
  109.         (setq dinf " : radio_row { ")
  110.         dinf
  111.     )
  112.     ;;少“}”

  113.     ;;单选列
  114.     (defun radio_columnd (/ dinf)
  115.         (setq dinf " : radio_column { ")
  116.         dinf
  117.     )
  118.     ;;少“}”


  119.     ;;行
  120.     (defun rowd        (/ dinf)
  121.         (setq dinf " : row {  ")
  122.         dinf
  123.     )
  124.     ;;少“}”


  125.     ;;列
  126.     (defun columnd (/ dinf)
  127.         (setq dinf " : column {  ")
  128.         dinf
  129.     )
  130.     ;;少“}”
  131.   ;;局部函数先加载
  132.   (setq stra "nonsmall:dialog{label="可视化DCL";")
  133.     (setq stra (strcat stra (getdcl dcl)))
  134.     (setq stra (strcat stra "ok_cancel;}"))
  135.                                         ;把DCL代码写出并且调用观看效果
  136.     (setq file "d:\\test.dcl")
  137.     (if        (findfile file)
  138.         (setq f (open "d:\\test.dcl" "w"))
  139.         (setq f (open "d:\\test.dcl" "a"))
  140.     )
  141.     (write-line stra f)
  142.     (close f)
  143.     (setq dcl_id (load_dialog file))
  144.     (new_dialog "nonsmall" dcl_id)
  145.     (start_dialog)
  146.     (unload_dialog dcl_id)
  147.     (startapp "notepad" file)
  148.     (princ)



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



  20. );;;;;;TT函数结束
  21.    

  22.    



  23.     ;;按钮
  24.     (defun buttond1 (/ dinf)
  25.         (setq
  26.             dinf
  27.                (strcat
  28.                    " : button {  "
  29.                    " label ="预览(R)"; "
  30.                    " key =  "PreviewBtn "; "
  31.                    "  mnemonic = "R"; "
  32.                    "  is_enabled = false; "
  33.                    "  }  "
  34.                   )
  35.         )
  36.         dinf
  37.     )

  38.     ;;图像
  39.     (defun imaged (/ dinf)
  40.         (setq
  41.             dinf
  42.                (strcat
  43.                    " : image {  "
  44.                    " key =  "Previewss "; "
  45.                    "  mnemonic = "R"; "
  46.                    "  is_enabled = false; "
  47.                    "  }  "
  48.                   )
  49.         )
  50.         dinf
  51.     )


  52.     ;;文字
  53.     (defun textd (/ dinf)
  54.         (setq
  55.             dinf
  56.                (strcat
  57.                    " : text { "
  58.                    " label = "打印设备名:";  "
  59.                    " value = "打印设备名:";  "
  60.                    " key = "PlotterLabel"; "
  61.                    " } "
  62.                   )
  63.         )
  64.         dinf
  65.     )
  66.     ;;编辑框
  67.     (defun edit_boxd (/ dinf)
  68.         (setq dinf (strcat
  69.                        ": edit_box {"
  70.                        " label = "打印份数:";"
  71.                        " value = "1";"
  72.                        " key = "CopiesEdit";"
  73.                        " width = 8;"
  74.                        " fixed_width = true;"
  75.                        " }"
  76.                       )
  77.         )
  78.         dinf
  79.     )


  80.     ;;单选钮
  81.     (defun radio_buttond (str1v / dinf)
  82.         (setq dinf (strcat
  83.                        " : radio_button { "
  84.                        " label = "适合图纸"; "
  85.                        (strcat " key = "" str1v " "; ")
  86.                        " }"
  87.                    )
  88.         )
  89.         dinf
  90.     )

  91.     ;;多选钮
  92.     (defun toggled (str1 / dinf)
  93.         (setq dinf (strcat
  94.                        " : toggle {  "
  95.                        " label = "自动旋转";  "
  96.                        (strcat " key = " " str1 " ";   ")
  97.                        " } "
  98.                    )
  99.         )
  100.         dinf
  101.     )

  102.     ;;下拉菜单
  103.     (defun popup_listd (/ dinf)
  104.         (setq dinf (strcat
  105.                        " : popup_list { "
  106.                        " key = "LayerNameEdit"; "
  107.                        " fixed_height = false; "
  108.                        " fixed_width = true;  "
  109.                        " width = 20; "
  110.                        " }  "
  111.                       )
  112.         )
  113.         dinf
  114.     )


  115.     ;;行框
  116.     (defun boxed_rowd (/ dinf)
  117.         (setq dinf (strcat
  118.                        ": boxed_row {"
  119.                        "label = "图纸定位";"
  120.                        "key = "LocationSettings";"
  121.                    )
  122.         )
  123.         dinf
  124.     )
  125.     ;;少“}”


  126.     ;;单选行
  127.     (defun radio_rowd (/ dinf)
  128.         (setq dinf " : radio_row { ")
  129.         dinf
  130.     )
  131.     ;;少“}”

  132.     ;;单选列
  133.     (defun radio_columnd (/ dinf)
  134.         (setq dinf " : radio_column { ")
  135.         dinf
  136.     )
  137.     ;;少“}”


  138.     ;;行
  139.     (defun rowd        (/ dinf)
  140.         (setq dinf " : row {  ")
  141.         dinf
  142.     )
  143.     ;;少“}”


  144.     ;;列
  145.     (defun columnd (/ dinf)
  146.         (setq dinf " : column {  ")
  147.         dinf
  148.     )
  149.     ;;少“}”
发表于 2013-9-16 16:40:18 | 显示全部楼层
这根本就是不能用!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-26 09:48 , Processed in 0.198095 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表