Jump to content
TunzaGibbo

Cannot find definition for dialog

Recommended Posts

TunzaGibbo

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 ;       
} 

Share this post


Link to post
Share on other sites
Tharwat

Hi,

 

Copy the following in the command line in AutoCAD and let me know what would that returns.

(findfile "Welds1.dcl")

Share this post


Link to post
Share on other sites
dlanorh

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

Share this post


Link to post
Share on other sites
TunzaGibbo

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)
)

Share this post


Link to post
Share on other sites
rlx
Posted (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 by rlx

Share this post


Link to post
Share on other sites
dlanorh

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 ;       
} 

Share this post


Link to post
Share on other sites
TunzaGibbo

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 ;       
} 

Share this post


Link to post
Share on other sites
rlx
(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)

Share this post


Link to post
Share on other sites
TunzaGibbo

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

Share this post


Link to post
Share on other sites
rlx
Posted (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 by rlx

Share this post


Link to post
Share on other sites
TunzaGibbo

Thank you very much RLX

I will study your code and put it into practice

 

Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×