Jump to content

Cannot find definition for dialog


TunzaGibbo

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

 (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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...