TunzaGibbo Posted May 13, 2018 Share Posted May 13, 2018 Can somebody help me this problem? I have both the lisp file and the dcl file in the Autocad search path. I have many other lisp & dcl files in the same folder and they all work fine. This one is very stubborn. I just can't figure it out. The lisp file is called "weld1.lsp" and the dcl file is called "Welds1.dcl" weld1 : dialog { label = "WELD NOTES 1 " ; : row { label = "WELD SIZE"; : row { : edit_box { key = "dws"; label = "WELD SIZE"; edit_width = 6; alignment = left ; } } } ok_cancel ; } Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 13, 2018 Share Posted May 13, 2018 Hi, Copy the following in the command line in AutoCAD and let me know what would that returns. (findfile "Welds1.dcl") Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 13, 2018 Share Posted May 13, 2018 Can't see anything wrong with the dcl file Check the lisp file is loading "Welds1.dcl" and loading dialog "weld1". I normally call my dialog the same as the dcl file, otherwise it's easy to make a mistake and nothing appears to happen. Without seeing the lisp code relating to loading and setting the dialog i can't diagnose if there is a problem with the code. I always use the following (setq d_name (vl-filename-base dcl_name)) (if (not (setq dcl_id (load_dialog dcl_name))) (alert (strcat "Cannot Find DCL file : " dcl_name))) (if (not (new_dialog d_name dcl_id)) (alert (strcat "Cannot Start DCL dialog : " d_name))) where dcl_name is the *.dcl file Quote Link to comment Share on other sites More sharing options...
TunzaGibbo Posted May 14, 2018 Author Share Posted May 14, 2018 Command: (findfile "Welds1.dcl") "C:\\Users\\ynotsbbig\\#advance\\delta tools\\Welds1.dcl" Here is the lisp: (defun C:weld1 (d1 ddiag dcl_id p1) (defun setVars() (setq d1 (distof (get_tile "dws")))) (setq dcl_id (load_dialog "Welds1.dcl")) (if (not (new_dialog "Welds1" dcl_id)) (exit) ) (action_tile "accept" " (setVars)(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq ddiag (start_dialog)) (if (= ddiag 1) (setq p1 (getpoint "\nPick a point ")) (command "_line" p1 (polar p1 (deltadtr 0) dws)) ) (unload_dialog dcl_id) (princ) ) Quote Link to comment Share on other sites More sharing options...
rlx Posted May 14, 2018 Share Posted May 14, 2018 (edited) (new_dialog [color=red][b]"Welds1"[/b][/color] dcl_id) -> (new_dialog [color=red][b]"weld1"[/b][/color] dcl_id) deltadtr -> defun? dws in polar function is d1? Edited May 14, 2018 by rlx Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 14, 2018 Share Posted May 14, 2018 Change your lisp as per rlx or [color=red]Welds1[/color] : dialog { label = "WELD NOTES 1 " ; : row { label = "WELD SIZE"; : row { : edit_box { key = "dws"; label = "WELD SIZE"; edit_width = 6; alignment = left ; } } } ok_cancel ; } Quote Link to comment Share on other sites More sharing options...
TunzaGibbo Posted May 14, 2018 Author Share Posted May 14, 2018 Ive now renamed both the lisp and the dcl files to "weld1" I'm still struggling with it. This is the lisp: (defun C:weld1 (d1 ddiag dcl_id p1) (defun setVars() (setq d1 (distof (get_tile "dws")))) (setq dcl_id (load_dialog "weld1.dcl")) (if (not (new_dialog "weld1" dcl_id)) (exit) ) (action_tile "accept" " (setVars)(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq ddiag (start_dialog)) (if (= ddiag 1) (setq p1 (getpoint "\nPick a point ")) (command "_line" p1 (polar p1 (deltadtr 0) d1)) ) (unload_dialog dcl_id) (princ) ) This is the dcl: weld1 : dialog { label = "WELD NOTES 1 " ; : row { label = "WELD SIZE"; : row { : edit_box { key = "dws"; label = "WELD SIZE"; edit_width = 6; alignment = left ; } } } ok_cancel ; } Quote Link to comment Share on other sites More sharing options...
rlx Posted May 14, 2018 Share Posted May 14, 2018 (defun C:weld1 ( / dcl-fn dcl-fp dcl-id ddiag d1 p1) (mk_dia) (if (and (setq dcl-id (load_dialog dcl-fn)) (new_dialog "weld1" dcl-id)) (progn (vl-file-delete dcl-fn) (action_tile "accept" "(setq d1 (distof (get_tile \"dws\")))(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq ddiag (start_dialog)) (unload_dialog dcl-id) (cond ((= ddiag 1) (setq p1 (getpoint "\nPick a point ")) (command "_line" p1 (polar p1 (deltadtr 0) d1))); deltadtr = ? , dws = d1? ) ) ) (princ) ) (defun deltadtr (i) (if i i 0)) (defun mk_dia () (if (and (setq dcl-fn (vl-filename-mktemp ".dcl")) (setq dcl-fp (open dcl-fn "w"))) (mapcar '(lambda (x)(write-line x dcl-fp)) '("weld1:dialog{label=\"WELD NOTES 1\";:row{label=\"WELD SIZE\";:row {" ":edit_box{key=\"dws\";label=\"WELD SIZE\";edit_width=6;alignment=left;}}}ok_cancel;}"))) (if dcl-fp (close dcl-fp))(gc) ) ;(C:weld1) Quote Link to comment Share on other sites More sharing options...
TunzaGibbo Posted May 14, 2018 Author Share Posted May 14, 2018 Thanks RLX. Its obvious to me that you are a lot smarter than me at lisp. The one you sent me works really well. In saying that, is it possible to look at my much simpler version because I have many other dcl and lisps that I have written and they are all much the same style. I can understand my style as I am familiar with it. By the way "deltadtr" is a local lisp I have for Degrees to Radians. It works fine. Thanks Quote Link to comment Share on other sites More sharing options...
rlx Posted May 14, 2018 Share Posted May 14, 2018 (edited) Thanks RLX.Its obvious to me that you are a lot smarter than me at lisp. The one you sent me works really well. In saying that, is it possible to look at my much simpler version because I have many other dcl and lisps that I have written and they are all much the same style. I can understand my style as I am familiar with it. By the way "deltadtr" is a local lisp I have for Degrees to Radians. It works fine. Thanks (defun c:weld1 ( / ddiag dcl_id p1 d1) (defun deltadtr (a) (* pi (/ a 180.0))) (setq dcl_id (load_dialog (findfile "weld1.dcl"))) (if (not (new_dialog "weld1" dcl_id))(exit)) (action_tile "dws" "(setq d1 (distof (get_tile \"dws\")))") (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq ddiag (start_dialog)) (unload_dialog dcl_id) (if (= ddiag 1) (progn (setq p1 (getpoint "\nPick a point ")) (command-s "_line" p1 (polar p1 (deltadtr 0) d1)) ) ) (princ) ) think command-s does the trick and action-tile editbox can (should) be (action_tile "dws" "(setq d1 (distof $value))") Edited May 14, 2018 by rlx Quote Link to comment Share on other sites More sharing options...
TunzaGibbo Posted May 14, 2018 Author Share Posted May 14, 2018 Thank you very much RLX I will study your code and put it into practice Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.