乐筑天下

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

[编程交流] Basic LISP + DCL problem

[复制链接]

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:04:11 | 显示全部楼层 |阅读模式
I am a beguiner.
I have just started yesterday!!!!!
 
I am placing LISP and DCL codes below. If anyone could point what I am doing wrong and how to fix it. Thanks a lot.
 
P.S.: The main goal here is to create a simple Fixed Panel. Later on I will try to add mullion, transoms and sashes (hinged, sliding, etc). All to do with my job. Trying to make things faster and easier, i guess.
 
LISP
  1. (defun dtr (x)(* pi (/ x 180.0)))(defun w1_act()(action_tile "LL" "(setq LW $value)")(action_tile "HH" "(setq HW $value)")(action_tile "OO" "(setq OW $value)")(setq B1 (getpoint))(setq b2 (polar B1 (dtr 90.0) HW))(setq b3 (polar b2 (dtr 0.0) LW))(setq b4 (polar B1 (dtr 0.0) LW))(setq bi1 (polar B1 (dtr 0.0) OW))(setq i1 (polar bi1 (dtr 90.0) OW))(setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))(setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))(setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))(command "PLine" B1 b2 b3 b4 "c" "PLine" i1 i2 i3 i4 "c" "PLine" B1 i1 "" "PLine" b2 i2 "" "PLine" b3 i3 "" "PLine" b4 i4 "")(princ))(defun c:w1 ()(setq dcl_id (load_dialog "w1_dcl.dcl"))    (if (not (new_dialog "w1_dcl" dcl_id)) (exit )    );if(action_tile "accept" "(w1_act)")(start_dialog)(unload_dialog dcl_id)(princ))

DCL
  1. w1_dcl: dialog{label = "FIXED PANELS";: edit_box{label = "Lenght :";mnemonic = "L";key = "LL";alignment = centered;edit_limit = 5;edit_width = 5;}: edit_box{label = "Height :";mnemonic = "H";key = "HH";alignment = centered;edit_limit = 5;edit_width = 5;value = "";}: edit_box{label = "Offset :";mnemonic = "O";key = "OO";alignment = centered;edit_limit = 5;edit_width = 5;value = "50";}: errtile {width = 15;}: button {key = "accept";label = "PICK POINT";is_default = true;fixed_width = true;alignment = centered;}}
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:10:44 | 显示全部楼层
  1. (defun dtr (x)(* pi (/ x 180.0)))(defun w1_act  ()     (setq b1 (getpoint "\nPick Point: "))     (setq b2 (polar B1 (dtr 90.0) HW))     (setq b3 (polar b2 (dtr 0.0) LW))     (setq b4 (polar B1 (dtr 0.0) LW))     (setq bi1 (polar B1 (dtr 0.0) OW))     (setq i1 (polar bi1 (dtr 90.0) OW))     (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))     (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))     (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))(command"PLine" B1 b2 b3 b4 "c""PLine" i1 i2 i3 i4 "c""PLine" B1 i1 """PLine" b2 i2 """PLine" b3 i3 """PLine" b4 i4 "")     (princ)     )(defun c:w1  ()     (setq dcl_id (load_dialog "w1_dcl.dcl"))     (if (not (new_dialog "w1_dcl" dcl_id))           (exit)           )                           ;if[color=blue]      (action_tile "LL" "(setq LW [color=purple][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")(action_tile "HH" "(setq HW [color=#800080][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")(action_tile "OO" "(setq OW [color=#800080][b]([/b]distof [/color]$value[b][color=purple])[/color][/b])")[/color]     (action_tile "accept" "[b][color=blue](done_dialog 1)[/color][/b]")     (start_dialog)     (unload_dialog dcl_id)     [color=blue][b](w1_act)[/b][/color]     (princ)     )
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:15:14 | 显示全部楼层
Thanks for your attention.
 
I have tried to use and understand what you have passed, but it is coming with the following error:
 
Command: w1
Pick Point: ; error: bad argument type: numberp: nil
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:19:42 | 显示全部楼层
Copy and paste what i posted there Rod PP and try again
 
You will notice i move the action_tile line out of w1_act function and into w1
 
BTW: use Code Tags
 
CODE POSTING GUIDELINES
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:25:17 | 显示全部楼层
That's what I have done, I Copied and Posted the code. Reloaded, and it comes with that message.
=(
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:26:30 | 显示全部楼层
Glad you read and followed the CPG RodPP
 
Again. make sure you copied and pasted the code i posted and SAVE

LOOK CLOSELY:

[code] (action_tile "accept" "(done_dialog 1)")     (start_dialog)     (unload_dialog dcl_id)     (w1_act);
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 08:31:26 | 显示全部楼层
Localizing variables is a very good habit
 
I think the OW has no value and that's why the error message appears .
 
  1. (setq bi1 (polar B1 (dtr 0.0) [b][color="red"]OW[/color][/b]))     (setq i1 (polar bi1 (dtr 90.0) [b][color="red"]OW[/color][/b]))
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:35:11 | 显示全部楼层
 
Tharwat,
 
LOOK CLOSELY:
  1. (action_tile "OO" "(setq [b][color=blue]OW[/color][/b] (distof $value))")
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 08:39:57 | 显示全部楼层
 
Correct , i have just noticed it , this is the way that the code worked for me , ..
 
  1. (defun c:w1 () (setq dcl_id (load_dialog "w1_dcl.dcl")) (if (not (new_dialog "w1_dcl" dcl_id))   (exit) )                                     ;if (action_tile "LL" "(setq LW (distof $value))") (action_tile "HH" "(setq HW (distof $value))") (action_tile "OO" "(setq OW (distof $value))") (action_tile "accept" "(done_dialog 1)") (start_dialog) (unload_dialog dcl_id) (defun dtr (x) (* pi (/ x 180.0)))(defun w1_act () (setq b1 (getpoint "\nPick Point: ")) (setq b2 (polar B1 (dtr 90.0) HW)) (setq b3 (polar b2 (dtr 0.0) LW)) (setq b4 (polar B1 (dtr 0.0) LW)) (setq bi1 (polar B1 (dtr 0.0) OW)) (setq i1 (polar bi1 (dtr 90.0) OW)) (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW)))) (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW)))) (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW)))) (command  "PLine"  B1     b2  b3     b4 "c"    "PLine" i1     i2  i3     i4 "c"    "PLine"  B1     i1  ""     "PLine"  b2     i2   ""     "PLine"   b3     i3  ""     "PLine"  b4     i4  ""  ) (princ)) (w1_act) (princ))
回复

使用道具 举报

2

主题

16

帖子

14

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:46:20 | 显示全部楼层
Thanks a lot everyone, it worked for me the way Tharwat wrote above. I will check what he has done now. Then I will try to add extra pieces, like mullions, transoms, sashes, option for sliding, hinged door, etc etc.
Gosh, its a long way ahead, but I want to try. I am sorry to distrub the Forum (and I will... a lot)... so whatever I can do to help, please let me know. Thanks you all!!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 21:54 , Processed in 0.346958 second(s), 72 queries .

© 2020-2025 乐筑天下

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