乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 33|回复: 9

[编程交流] dcl和lisp帮助

[复制链接]

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-5 20:25:00 | 显示全部楼层 |阅读模式
嗨,我的朋友和哈里新年!!!
 
我使用此lisp代码来管理图形中插入块的比例。
 
这段代码很简单
 
  1. ( DEFUN C:SETSC ()
  2.    (SETQ CURSC (getvar "useri1" ))
  3.    (princ "the print scale is 1:")(princ cursc)
  4.    (setq newsc (getint "\nNew scale  1:"))
  5.    (setvar "useri1" newsc)
  6.      (setq a1 (getvar "useri1"))
  7.      (princ "\n The new print scale is 1:")(princ newsc)(princ)
  8. )

 
我正在尝试使用dcl更新此代码
 
dcl代码
-------------
  1. setsc1: dialog {
  2.         label = "print scale";
  3. : text_part {
  4.             label = " ";
  5.           key = "useri1";
  6. alignment = left;
  7. }
  8. spacer_1;
  9. : boxed_column {
  10.     label = " scale ";
  11.    : radio_column {
  12.       : radio_button { label = "1 : 10"; key = "10"; }
  13.       : radio_button { label = "1 : 20"; key = "20"; }
  14.       : radio_button { label = "1 : 50"; key = "50"; }
  15.       : radio_button { label = "1 : 100"; key = "100"; }
  16.       : radio_button { label = "1 : 200"; key = "200"; }
  17.       : radio_button { label = "1 : 500"; key = "500"; }
  18.       : radio_button { label = "1 : 1000"; key = "1000"; }
  19.       : radio_button { label = "1 : 2000"; key = "2000"; }
  20.       : radio_button { label = "1 : 5000"; key = "5000"; }
  21.       : radio_button { label = "1 : 10000"; key = "10000"; }
  22.    }
  23. }
  24. : edit_box {
  25. label = "Other scale    1  : ";
  26. key = "newsc";
  27. alignment = left;
  28. edit_limit = 30;
  29. edit_width = 10;
  30. fixed_width = true ;
  31. allow_accept = true ;
  32. }
  33. spacer_1;
  34. ok_cancel_help;
  35. spacer_1;
  36. : errtile {
  37. width = 34;
  38. }
  39. : text_part {
  40.             label = " © 2015";
  41.           key = "selection_msg";
  42. alignment = right;
  43. }
  44. }
  45. //DCL CODING ENDS HERE

 
新lisp代码
----------------
 
  1. ( DEFUN C:SETSC1 ()
  2. (setq dcl_id (load_dialog "setsc1.dcl"))
  3.     (if (not (new_dialog "setsc1" dcl_id))
  4. (exit )
  5.     );if
  6.    (SETQ CURSC (getvar "useri1" ))
  7. ;    (setq newsc (getint "\nNew scale  1:"))
  8.    (setvar "useri1" newsc)
  9.      (setq a1 (getvar "useri1"))
  10. )

 
我很困惑,因为我不知道如何让这一切顺利进行。有人能帮忙吗?
 
谢谢
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-5 20:35:22 | 显示全部楼层
有什么想法吗?
 
谢谢
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:39:57 | 显示全部楼层
 
嗨,prodromosm,
也许是这个?
注意:我假设您的dcl名为setsc1。dcl和处于有效的支持路径中
  1. (defun c:SETSC (/ dd dcl newsc pass)
  2. ;hanhphuc 07/01/2015 *happy new year*
  3. (if (and (setq fn (findfile [b]"[color="blue"]setsc[color="red"]1.dcl[/color][/color]"[/b])) (setq dcl (load_dialog fn))) ;_ end of and
  4.    (progn (setq newsc (if (or (= "" (setq newsc(getvar "users1"))) (not (numberp (read newsc))))
  5.                  "10"
  6.                  newsc
  7.                  ) ;_ end of if
  8.          ) ;_ end of setq
  9.    (new_dialog "setsc1" dcl)
  10.    (set_tile "newsc" newsc)
  11.           (set_tile newsc "1")
  12.    (mapcar ''((x) (action_tile x "(set_tile "newsc" (get_attr $key "key"))"))
  13.            '("10" "20" "50" "100" "200" "500" "1000" "2000" "5000" "10000")
  14.            ) ;_ end of mapcar
  15.    (action_tile "accept" "(setq newsc (get_tile "newsc"))(done_dialog dcl)")
  16.    (setq dd (start_dialog))
  17.    (if (setq pass(numberp (read newsc)))
  18.      (setvar "users1" newsc)
  19.      ) ;_ end of if
  20.    (set_tile "newsc" newsc)
  21.    ) ;_ end of progn
  22.    ) ;_ end of if
  23. (unload_dialog dcl)
  24. (if (and (/= dd 0) pass)
  25.    (alert (strcat "\nThe new print scale is 1: " newsc))
  26.    ;(alert "Invalid :-( ")
  27.    ) ;_ end of if
  28. (princ)
  29. )
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-5 20:49:37 | 显示全部楼层
你好,韩。谢谢你的尝试,但是这个代码不起作用。。。
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:53:57 | 显示全部楼层
 
很抱歉,之前的帖子我以为你的文件名是setsc。(缺少扩展名*.dcl)
所以我把它改成了setsc1。dcl
 
注意:警报只是一个示例输出。
您可以将newsc修改并转换为numberp
HTH公司
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-5 20:59:50 | 显示全部楼层
代码现在正在运行,但规模没有改变。我不知道;我不知道问题出在哪里??
 
 
dcl代码
 
  1. setsc1: dialog {
  2.         label = "print scale";
  3. : text_part {
  4.             label = " ";
  5.           key = "useri1";
  6. alignment = left;
  7. }
  8. spacer_1;
  9. : boxed_column {
  10.     label = " scale ";
  11.    : radio_column {
  12.       : radio_button { label = "1 : 10"; key = "10"; }
  13.       : radio_button { label = "1 : 20"; key = "20"; }
  14.       : radio_button { label = "1 : 50"; key = "50"; }
  15.       : radio_button { label = "1 : 100"; key = "100"; }
  16.       : radio_button { label = "1 : 200"; key = "200"; }
  17.       : radio_button { label = "1 : 250"; key = "250"; }
  18.       : radio_button { label = "1 : 500"; key = "500"; }
  19.       : radio_button { label = "1 : 1000"; key = "1000"; }
  20.       : radio_button { label = "1 : 2000"; key = "2000"; }
  21.       : radio_button { label = "1 : 5000"; key = "5000"; }
  22.       : radio_button { label = "1 : 10000"; key = "10000"; }
  23.    }
  24. }
  25. : edit_box {
  26. label = "new scale    1  : ";
  27. key = "newsc";
  28. alignment = left;
  29. edit_limit = 30;
  30. edit_width = 10;
  31. fixed_width = true ;
  32. allow_accept = true ;
  33. }
  34. spacer_1;
  35. ok_cancel_help;
  36. spacer_1;
  37. : errtile {
  38. width = 34;
  39. }
  40. : text_part {
  41.             label = " ©1.1-2015";
  42.           key = "selection_msg";
  43. alignment = right;
  44. }
  45. }
  46. //DCL CODING ENDS HERE

 
 
lisp代码
  1. (defun c:SETSC1 (/ dd dcl newsc pass)
  2. (if (and (setq fn (findfile "setsc1.dcl")) (setq dcl (load_dialog fn))) ;_ end of and
  3.    (progn (setq newsc (if (or (= "" (setq newsc(getvar "users1"))) (not (numberp (read newsc))))
  4.                  "10"
  5.                  newsc
  6.                  ) ;_ end of if
  7.          ) ;_ end of setq
  8.    (new_dialog "setsc1" dcl)
  9.    (set_tile "newsc" newsc)
  10.           (set_tile newsc "1")
  11.    (mapcar ''((x) (action_tile x "(set_tile "newsc" (get_attr $key "key"))"))
  12.            '("10" "20" "50" "100" "200" "500" "1000" "2000" "5000" "10000")
  13.            ) ;_ end of mapcar
  14.    (action_tile "accept" "(setq newsc (get_tile "newsc"))(done_dialog dcl)")
  15.    (setq dd (start_dialog))
  16.    (if (setq pass(numberp (read newsc)))
  17.      (setvar "users1" newsc)
  18.      ) ;_ end of if
  19.    (set_tile "newsc" newsc)
  20.    ) ;_ end of progn
  21.    ) ;_ end of if
  22. (unload_dialog dcl)
  23. (if (and (/= dd 0) pass)
  24.    (alert (strcat "\nThe new print scale is 1: " newsc))
  25.    ;(alert "Invalid :-( ")
  26.    ) ;_ end of if
  27. (princ)
  28. )
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 21:09:03 | 显示全部楼层
dcl代码
</blockquote>您应该能够利用产值新闻来修改自己
上面的例子是:(alert(strcat“\n新的打印比例是1:“newsc”)
 
我不确定您是否要插入新块或修改现有块(可以在属性对话框中更改)
插入示例:
  1. (vl-load-com)
  2. (vla-InsertBlock object InsertionPoint Name [color="red"](atof newsc) (atof newsc)[/color] 1.0 0.0 )
  3. ; example newsc applied to Xscale, Yscale in red.
回复

使用道具 举报

5

主题

31

帖子

26

银币

初来乍到

Rank: 1

铜币
26
发表于 2022-7-5 21:15:36 | 显示全部楼层
 
你好,韩先生,你很专业。你今天看起来很棒。你有空吗?
 
我有个问题,你能帮我吗?
http://www.cadtutor.net/forum/showthread.php?90298-智能线路
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 21:21:22 | 显示全部楼层
嗨,卡德凡,谢谢,但我还没有资格
 
我认为M.R(MarkoRibar)在这个论坛上有一个类似的lisp,它以一定的角度画线,但我不记得了。
请耐心在这里搜索。。
 
编辑:>在此处找到
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-5 21:29:45 | 显示全部楼层
谢谢你,我会测试的。。
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 09:07 , Processed in 1.281829 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表