乐筑天下

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

[编程交流] 基本lisp+dcl=(条件

[复制链接]

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 08:35:10 | 显示全部楼层
杆式PP
我尝试了你的上一个版本,我建议:
-在一开始,添加
修改SL、SR和ST变量的代码:
  1.   (action_tile "SL" "(setq SL t   SR nil ST nil)")
  2. (action_tile "SR" "(setq SL nil SR t   ST nil)")
  3. (action_tile "ST" "(setq SL nil SR nil ST t  )")
-最后一个(条件..应为
当然,添加“OSMODE”和“Error”元素。
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 08:39:36 | 显示全部楼层
 
不,你没有,只是困惑而已。
你试过斯特凡的建议吗?您的原始代码在这里运行良好(以及mods)。
 
哦,好吧。如果您需要hekp,请呼叫[见帖子#8]
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:42:09 | 显示全部楼层
斯特凡BMR
 
也谢谢你的帮助。
 

事实上,每个人,它仍然不工作,呵呵。
天哪。。
 
这就是我正在做的和正在发生的事情,
一步一步地:
 
加载AutoCAD;
加载程序;
键入W1以运行例程;
DCL负载完美;
我选择1000、1000和50作为编辑框的值;
我标记左;
检查斜接;
单击“插入”;
 
当第一次选择点时,它总是会返回:
  1. Pick Point: ; error: bad argument type: numberp: nil

 
然后我再试一次。。。
 
我不关闭AutoCAD或重新启动新文件,我保持原样;
我甚至没有重新加载例程;
我只需键入W1并重复上述所有步骤;
现在它终于插入了窗口,但是。。。
斜接处无线条,窗扇开口侧无线条;
 
我再试一次,仍然没有重新加载例程;
 
W1;
选择相同的值1000、1000、50;
更改为右选项;选中的;
斜接检查;
插入
 
然后它把我拉进窗户,
转角处无斜接,
它确实将窗扇向右拉。
 
我再试一次,重复所有的事情,但换到顶端;
它工作得很好,很好,但。。。
无斜接角。
 
我再次尝试返回左侧选项:
它仍然绘制没有斜接的窗口,并且仍然指向顶部。
 
我再试一次:
1000,1000,50,左,斜接。
它确实画得很好,在左边,但仍然没有斜接的角落。
 
 
.....
所以这很奇怪,选择或不选择左,右,顶。。大多数时候,它并没有遵循我的选择,我想它一直在“记忆”中绘制任何东西。
斜接选项不起作用。
 
我不能将OW设置为50,或将Mitre设置为1,因为用户将决定该值,因此,例如,如果我将OW设置为50,我将无法绘制一个面向80或100帧的窗口。
=/
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:44:09 | 显示全部楼层
pBe,
 
=)
 
伙计。。。
我复制了我的LISP代码并用你的替换了它,
用你标记的蓝色修改了DCL,
....但随之而来的是以下错误:
 
(重新加载例程后)
 
  1. Command: w1
  2. ; error: quit / exit abort
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 08:47:36 | 显示全部楼层
 
我的错
 
测试时我在那里加了一个“W”
  1. (setq dcl_id (load_dialog "[color=blue]w[/color]w1_dcl.dcl"))

应该是
  1. (setq dcl_id (load_dialog "w1_dcl.dcl"))<------
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 08:51:01 | 显示全部楼层
 
是的,也许也是这样
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 08:53:54 | 显示全部楼层
MSasu-谢谢,但文件位于支持文件搜索路径上=/
 
pBe-再次感谢。=)
 
...
 
嘿,大家好,很抱歉我以前无法回复,只是现在我有机会玩AutoLISP,看看会发生什么。。。
所以,我试着重新加载这个样本,并按照pBe所述修改了额外的W,效果很好。
但是
是 啊(有一个但是)。。。。但是英雄联盟
我决定改变一些东西,添加其他东西,但现在它不起作用了。。呵呵
这就是它要传达的信息:
 
  1. (setq dcl_id (load_dialog "[color=red]C:\\MyLispTools\\[/color]w1_dcl.dcl"))

 
为了澄清,我现在使用的代码是:
 
  1. too few arguments: (IF ((EQ M "1") (COMMAND "Color" "250" "" "PLine" B1 I1 ""
  2. "PLine" B2 I2 "" "PLine" B3 I3 "" "PLine" B4 I4 "")))

 
  1. (defun c:w1 ( / SL SR ST)
  2. (setq dcl_id (load_dialog "w1_dcl.dcl"))
  3. (if (not (new_dialog "w1_dcl" dcl_id))
  4.    (exit)
  5. )   
  6. (set_tile "LL" (if (null LW) "0.00" (rtos LW 2 2)))
  7. (set_tile "HH" (if (null HW) "0.00" (rtos HW 2 2)))
  8. (set_tile "OO" (if (null OW) "50.0" (rtos OW 2 2)))   
  9. (action_tile "LL" "(setq LW (distof $value))")
  10. (action_tile "HH" "(setq HW (distof $value))")
  11. (action_tile "OO" "(setq OW (distof $value))")
  12. (action_tile "SL" "(setq SL $value)")
  13. (action_tile "SR" "(setq SR $value)")
  14. (action_tile "ST" "(setq ST $value)")
  15. (action_tile "M" "(setq M $value)")
  16. (action_tile "accept" "(setq pik T)(done_dialog 1)")
  17. (action_tile "cancel" "(setq pik nil)(done_dialog 0)")
  18. (start_dialog)
  19. (unload_dialog dcl_id)
  20. (defun dtr (x) (* pi (/ x 180.0)))
  21. (defun w1_act ()
  22. (setq b1 (getpoint "\nPick Point: "))
  23. (setq b2 (polar B1 (dtr 90.0) HW))
  24. (setq b3 (polar b2 (dtr 0.0) LW))
  25. (setq b4 (polar B1 (dtr 0.0) LW))
  26. (setq bi1 (polar B1 (dtr 0.0) OW))
  27. (setq i1 (polar bi1 (dtr 90.0) OW))
  28. (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
  29. (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
  30. (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
  31. (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
  32. (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
  33. (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
  34. (setq is1 (polar i1 (dtr 0.0) OW))
  35. (setq s1 (polar is1 (dtr 90.0) OW))
  36. (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
  37. (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
  38. (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
  39. (setvar 'osmode 0)
  40. (setq LtH1 "Hidden")
  41. (if (= (tblsearch "ltype" LtH1) nil)
  42.    (command "-linetype" "l" LtH1 "acadiso.lin" "")
  43.    (princ))
  44. (setq LyF1 "APL Frame")
  45. (if (= (tblsearch "layer" LyF1) nil)
  46.    (command "._Layer" "M" "APL Frame" "C" "140" "")
  47.    (princ))
  48. ; DRAWS THE MAIN FRAME
  49. (command
  50. "PLine" B1 b2 b3 b4 "c"
  51. "Color" "8" ""
  52. "PLine" i1 i2 i3 i4 "c"
  53. )
  54. ; DRAWS the Mitre
  55. (IF
  56.    ((eq M "1")
  57.     (command
  58.       "Color" "250" ""
  59.       "PLine" B1 i1 ""
  60.       "PLine" b2 i2 ""
  61.       "PLine" b3 i3 ""
  62.       "PLine" b4 i4 ""
  63.       ))
  64.       )
  65. ; DRAWS SASH TO RIGHT
  66.    (IF
  67.      ((eq SL "1")
  68.       (command
  69. "Color" "250" ""
  70. "PLine" s1 s2 s3 s4 "c"
  71. "-Linetype" LtH1 "20" ""
  72. "PLine" i4 SIL i3 ""
  73. ))
  74.       )
  75. ; DRAWS SASH TO LEFT
  76. (IF
  77.    ((eq SR "1")
  78.     (command
  79.       "Color" "250" ""
  80.       "PLine" s1 s2 s3 s4 "c"
  81.       "-Linetype" LtH1 "20" ""
  82.       "PLine" i1 SIR i2 ""
  83.       ))
  84.     )
  85. ; DRAWS SASH TO TOP
  86. (IF
  87.    ((eq ST "1")
  88.       (command
  89. "Color" "250" ""
  90. "PLine" s1 s2 s3 s4 "c"
  91. "-Linetype" LtH1 "20" ""
  92.         "PLine" i1 SIT i4 ""
  93. ))
  94.     )
  95. ; Am not sure about that...
  96. (command
  97.    "Ltype" "ByLayer" ""
  98.    "Color" "ByLayer" ""
  99.    )
  100. (princ)
  101. )
  102. (if pik (w1_act))
  103. (princ)
  104. )
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:57:40 | 显示全部楼层
好啊我发誓我正在努力,但真的没有前进。
 
我知道我要问的很多,所以只要有人不介意帮我,教我,我真的很想学。
 
这是我尝试使用例程时显示的新消息:
 
  1. w1_dcl
  2. : dialog
  3. {
  4. label = "1 PANEL";
  5. :row{
  6. :column{
  7. : edit_box{label = "Lenght :";
  8. mnemonic = "L";
  9. key = "LL";
  10. alignment = centered;
  11. edit_limit = 5;
  12. edit_width = 5;
  13. value="";
  14. }
  15. : edit_box{label = "Height :";
  16. mnemonic = "H";
  17. key = "HH";
  18. alignment = centered;
  19. edit_limit = 5;
  20. edit_width = 5;
  21. value = "";
  22. }
  23. : edit_box{label = "Frame :";
  24. mnemonic = "O";
  25. key = "OO";
  26. alignment = centered;
  27. edit_limit = 5;
  28. edit_width = 5;
  29. value = "";
  30. }
  31. : button{
  32. key = "accept";
  33. label = "Insert";
  34. mnemonic = "I";
  35. is_default = true;
  36. fixed_width = true;
  37. alignment = right;
  38. }
  39. : button{
  40. key = "cancel";
  41. label = "Cancel";
  42. mnemonic = "C";
  43. fixed_width = true;
  44. alignment = right;
  45. }
  46. } //column
  47. :column{
  48.       :radio_button{label="Fixed Panel";
  49.    key="F";
  50.    value="1";
  51.    }
  52.    :radio_button{label="Left";
  53. key="SL";
  54. }
  55. :radio_button{label="Right";
  56. key="SR";
  57. }
  58. :radio_button{label="Top";
  59. key="ST";
  60. }
  61.    :toggle{label="Mitre corners";
  62.    key="M";
  63.    value="1";}
  64.      } //column
  65.   } //row
  66.    is_cancel = true;
  67. } //dcl

 
所以,这与图层和线型有关,但我根本找不到问题。
 
我在尝试更改后使用的新代码:
 
  1. Command: w1
  2. Pick Point: _layer
  3. Current layer:  "0"
  4. Enter an option
  5. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  6. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _M
  7. Enter name for new layer (becomes the current layer) <0>: APL frame Enter an
  8. option
  9. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  10. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
  11. New color [Truecolor/COlorbook] : 140
  12. Enter name list of layer(s) for color 140 <APL frame>: Enter an option
  13. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  14. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
  15. Command: _Linetype
  16. Current line type:  "ByLayer"
  17. Enter an option [?/Create/Load/Set]: L
  18. Enter linetype(s) to load: Hidden Enter name of linetype file to search
  19. <C:\Users\Rod\AppData\Roaming\Autodesk\AutoCAD 2012 -
  20. English\R18.2\enu\Support\acadiso.lin>:
  21. Linetype "HIDDEN" loaded.
  22. Enter an option [?/Create/Load/Set]:
  23. Command: PLine
  24. Specify start point:
  25. Current line-width is 0.0000
  26. Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
  27. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  28. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  29. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c
  30. Command: Color
  31. Enter default object color [Truecolor/COlorbook] <BYLAYER>: 8
  32. [b][u]Command: W1 Unknown command "W1".  Press F1 for help.[/u][/b]
  33. Command: PLine
  34. Specify start point:
  35. Current line-width is 0.0000
  36. Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
  37. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  38. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  39. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c
  40. Command: _Linetype
  41. Current line type:  "ByLayer"
  42. [b][u]Enter an option [?/Create/Load/Set]: ByLayer[/u][/b]
  43. [b][u]Invalid option keyword.[/u][/b]
  44. [b][u]; error: Function cancelled[/u][/b]
  45. [b][u]Enter an option [?/Create/Load/Set]:[/u][/b]

 
  1. (defun c:w1 ( / SL SR ST)
  2. (setq dcl_id (load_dialog "w1_dcl.dcl"))
  3. (if (not (new_dialog "w1_dcl" dcl_id))
  4.    (exit)
  5. )   
  6. (set_tile "LL" (if (null LW) "" (rtos LW 2 2)))
  7. (set_tile "HH" (if (null HW) "" (rtos HW 2 2)))
  8. (set_tile "OO" (if (null OW) "" (rtos OW 2 2)))   
  9. (action_tile "LL" "(setq LW (distof $value))")
  10. (action_tile "HH" "(setq HW (distof $value))")
  11. (action_tile "OO" "(setq OW (distof $value))")
  12. (action_tile "SL" "(setq SL $value)")
  13. (action_tile "SR" "(setq SR $value)")
  14. (action_tile "ST" "(setq ST $value)")
  15. (action_tile "M" "(setq M $value)")
  16. (action_tile "accept" "(setq pik T)(done_dialog 1)")
  17. (action_tile "cancel" "(setq pik nil)(done_dialog 0)")
  18. (start_dialog)
  19. (unload_dialog dcl_id)
  20. (defun dtr (x) (* pi (/ x 180.0)))
  21. (defun w1_act ()
  22. (setq b1 (getpoint "\nPick Point: "))
  23. (setq b2 (polar B1 (dtr 90.0) HW))
  24. (setq b3 (polar b2 (dtr 0.0) LW))
  25. (setq b4 (polar B1 (dtr 0.0) LW))
  26. (setq bi1 (polar B1 (dtr 0.0) OW))
  27. (setq i1 (polar bi1 (dtr 90.0) OW))
  28. (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
  29. (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
  30. (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
  31. (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
  32. (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
  33. (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
  34. (setq is1 (polar i1 (dtr 0.0) OW))
  35. (setq s1 (polar is1 (dtr 90.0) OW))
  36. (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
  37. (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
  38. (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
  39. (setvar 'osmode 0)
  40. ; Am trying to create Layer and Ltype
  41. (command "_layer"
  42.    "_M" "APL frame" "_C" "140" "" ""
  43.    "_Linetype" "L" "Hidden" "" ""
  44.    )
  45. ; DRAWS THE MAIN FRAME
  46. (command
  47.    "PLine" B1 b2 b3 b4 "c"
  48.    "Color" "8" ""
  49.    "PLine" i1 i2 i3 i4 "c"
  50.    )
  51. ; DRAWS the Mitre
  52. (IF(= M 1)
  53.     (command
  54.       "Color" "250" ""
  55.       "PLine" B1 i1 ""
  56.       "PLine" b2 i2 ""
  57.       "PLine" b3 i3 ""
  58.       "PLine" b4 i4 ""
  59.      )(princ)
  60.    )
  61. ; DRAWS SASH TO RIGHT
  62.    (COND
  63.      ((eq SL "1")
  64.       (command
  65. "Color" "250" ""
  66. "PLine" s1 s2 s3 s4 "c"
  67. ; Here am trying to make Sashes with Hidden Ltype
  68. "_Linetype" "Hidden" "20"
  69.        "PLine" i4 SIL i3 ""
  70. ))(princ)
  71.       )
  72. ; DRAWS SASH TO LEFT
  73. (COND
  74.    ((eq SR "1")
  75.     (command
  76.       "Color" "250" ""
  77.       "PLine" s1 s2 s3 s4 "c"
  78.         ; Here am trying to make Sashes with Hidden Ltype
  79. "_Linetype" "Hidden" "20"
  80.       "PLine" i1 SIR i2 ""
  81.       ))(princ)
  82.     )
  83. ; DRAWS SASH TO TOP
  84. (COND
  85.    ((eq ST "1")
  86.       (command
  87. "Color" "250" ""
  88. "PLine" s1 s2 s3 s4 "c"
  89. ; Here am trying to make Sashes with Hidden Ltype
  90. "_Linetype" "Hidden" "20"
  91.         "PLine" i1 SIT i4 ""
  92. ))(princ)
  93.     )
  94. ; Am not sure about that...
  95. (command
  96.    "_Linetype" "ByLayer" ""
  97.    "_Color" "ByLayer" ""
  98.    )
  99. (princ)
  100. )
  101. (if pik (w1_act))
  102. (princ)
  103. )
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 09:00:55 | 显示全部楼层
由于您现在使用的是cond函数,因此不局限于一行。不要把三只浣熊挤在一条线上
 
  1. w1_dcl
  2. : dialog
  3. {
  4. label = "1 PANEL";
  5. :row{ //ROW A
  6. :column{ //COLUMN A
  7. label="Dimensions";
  8. : edit_box{label = "Lenght :";
  9. key = "LL";
  10. alignment = centered;
  11. edit_limit = 5;
  12. edit_width = 5;
  13. value="";
  14. }
  15. : edit_box{label = "Height :";
  16. key = "HH";
  17. alignment = centered;
  18. edit_limit = 5;
  19. edit_width = 5;
  20. value = "";
  21. }
  22. : edit_box{label = "Frame :";
  23. key = "OO";
  24. alignment = centered;
  25. edit_limit = 5;
  26. edit_width = 5;
  27. value = "";
  28. }
  29. : button{
  30. key = "accept";
  31. label = "Insert";
  32. mnemonic = "I";
  33. is_default = true;
  34. fixed_width = true;
  35. alignment = right;
  36. }
  37. : button{
  38. key = "cancel";
  39. label = "Cancel";
  40. mnemonic = "C";
  41. fixed_width = true;
  42. alignment = right;
  43. }
  44. } //column A
  45. :column{ // COLUMN B
  46. label="Type";
  47.       :radio_button{label="Fixed Panel";
  48.    key="F";
  49.    value="1";
  50.    }
  51.    :radio_button{label="Left";
  52. key="SL";
  53. }
  54. :radio_button{label="Right";
  55. key="SR";
  56. }
  57. :radio_button{label="Top";
  58. key="ST";
  59. }
  60.    :toggle{label="Mitre corners";
  61.    key="M";
  62.    value="1";}
  63.      } //column B
  64.   } //row A
  65.    is_cancel = true;
  66. } //dcl

 
你最好把这些分开
  1. ((eq ST "1") (command "Color" "250" "" "PLine" s1 s2 s3 s4 "c" "_Linetype" "Hidden" "[b]20"[/b]
  2.         "PLine" i1 SIT i4 "")

 
但不确定命令行上的“20”是用来做什么的。
为什么要使用此选项:
  1. ((eq ST "1")
  2. (command "Color" "250")
  3. (command "PLine" s1 s2 s3 s4 "c")
  4. (command "_Linetype" "Hidden")
  5. (command "PLine" i1 SIR i2 ""))

什么时候应该这样
  1. 24

 
请告诉我们修改后的最终结果,以便我们更好地理解。
 
查看此系统变量
  1. 25
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 09:05:46 | 显示全部楼层
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 21:53 , Processed in 0.411073 second(s), 70 queries .

© 2020-2025 乐筑天下

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