Jump to content

Recommended Posts

Posted

Hi:

 

I want to call this ync program and have it load the dcl dialog boxes. Both programs are saved in the same folder and recognized in the path.

 

Actually, ync might be incorporated into my newly defined quit command. This command would either save the drawing with specific save options (prior releases for AutoCAD Mechanical or Vanilla), or quit.

 

According to my understanding, the code below should run if I type 'ync'. However, I get an invalid command error. The LISP code is inside our mnl file, if that is a problem?

 

Much thanks in advance for any understanding here you can provide.

 

ync lisp code:

(defun c:ync(/ dcl_ync_id)

(setq dcl_ync_id (load_dialog "ync.dcl")

(if (not (new dialog "quit" dcl_ync_id))

(exit)

 

)

(action_tile "Yes" "(setq cmd ($key) (done_dialog)" )

(action_tile "No" "(setq cmd ($key) (done_dialog)" )

(action_tile "Cancel" "(setq cmd ($key) (done_dialog)" )

(start_dialog)

(unload_dialog dcl_ync_id)

(command cmd)

)

 

 

ync dcl code:

// ync.dcl

// Dialog box for yes, no, cancel options to be referenced from AutoLISP

//

ync: dialog {

label = "Save Drawing?";

: text_part {

label = "Drawing will be saved to AutoCAD Mechanical 2006 or AutoCAD 2004 depending on profile used... ";

}

: row {

:button {

key = "Yes";

label = "Yes";

mnemonic = "Y";

fixed_width = true;

}

:button {

key = "No";

label = "No";

mnemonic = "N";

fixed_width = true;

}

:button {

key = "Cancel";

label = "Cancel";

mnemonic = "C";

fixed_width = true;

}

}

}

Posted

Just looking at it quickly.

 

(defun c:ync(/ dcl_ync_id)

(setq dcl_ync_id (load_dialog "ync.dcl")

(if (not (new dialog "ync" dcl_ync_id))

(exit)

Posted

Some other errors in the code

 

(defun c:ync(/ dcl_ync_id)
 (setq dcl_ync_id (load_dialog "ync.dcl"))
 (if (not (new[color=red]_[/color]dialog "ync" dcl_ync_id))
   (exit))
 (action_tile "Yes"    "(setq cmd ($key)(done_dialog)" )
 (action_tile "No"     "(setq cmd ($key)(done_dialog)" )
 (action_tile "Cancel" "(setq cmd ($key)(done_dialog)" )
 (start_dialog)
 (unload_dialog dcl_ync_id)
 (command cmd)

Posted

You also have a problem in the dcl file. I am looking at that now.

Posted

Somewhere in here, there is a malformed list on input. Do you see it??

 

(defun c:ync(/ dcl_ync_id)

(setq dcl_ync_id (load_dialog "ync.dcl")

(if (not (new_dialog "ync" dcl_ync_id))

(exit)

 

)

(action_tile "Yes" "(setq cmd ($key) (done_dialog)" )

(action_tile "No" "(setq cmd ($key) (done_dialog)" )

(action_tile "Cancel" "(setq cmd ($key) (done_dialog)" )

(start_dialog)

(unload_dialog dcl_ync_id)

(command cmd)

)

Posted
Somewhere in here, there is a malformed list on input. Do you see it??

 

(defun c:ync(/ dcl_ync_id)

(setq dcl_ync_id (load_dialog "ync.dcl")

(if (not (new_dialog "ync" dcl_ync_id))

(exit)

 

)

(action_tile "Yes" "(setq cmd ($key) (done_dialog)" )

(action_tile "No" "(setq cmd ($key) (done_dialog)" )

(action_tile "Cancel" "(setq cmd ($key) (done_dialog)" )

(start_dialog)

(unload_dialog dcl_ync_id)

(command cmd)

)

Your missing a bracket look at the code I posted.

 

(defun c:ync(/ dcl_ync_id)
(setq dcl_ync_id (load_dialog "ync.dcl")[color=red])[/color]
(if (not (new_dialog "ync" dcl_ync_id))
(exit)

)
(action_tile "Yes" "(setq cmd ($key) (done_dialog)" )
(action_tile "No" "(setq cmd ($key) (done_dialog)" )
(action_tile "Cancel" "(setq cmd ($key) (done_dialog)" )
(start_dialog)
(unload_dialog dcl_ync_id)
(command cmd)
) 

Posted

Here is the dcl, Your will need to bump it to your likings.

 

// ync.dcl
// Dialog box for yes, no, cancel options to be referenced from AutoLISP
// 
ync: dialog {
    label = "Save Drawing?";
    : text_part {
      label = "Drawing will be saved to AutoCAD Mechanical 2006 or AutoCAD 2004 depending on profile used... ";
    }
    : row {
     : button { label = "&Yes";  key = "Yes";    is_Yes = true; }
     : button { label = "&No";   key = "No";     is_No = true; }
     : button { label = "&Exit"; key = "cancel"; is_cancel = true;  }
    }
  }

Posted

I removed the accept button, Sorry about that.

Posted

Thank you for that. I never see those )'s.

 

Can you now tell me how I return the answer back to my code? I plan to redefine the quit command, have it pop up this dialog and use the result (y/n/c). I'm not sure if I should keep ync (preferred), or just add the code into the redefined command?

Posted

I noticed that the Yes and No functions return a Malformed list on Input as well??

 

Command: ync

*Cancel*

Command: nil

Command: ync (used Yes)

error: malformed list on input

Command:

Command: ync (used No)

error: malformed list on input

Posted
Thank you for that. I never see those )'s.

 

Can you now tell me how I return the answer back to my code? I plan to redefine the quit command, have it pop up this dialog and use the result (y/n/c). I'm not sure if I should keep ync (preferred), or just add the code into the redefined command?

 

I am not sure why you are doing that, But thats your choice. All you need to do is add you conditional coding for Yes or No and what its suppose to do in the rest of the code.

 

The dcl appears now, So I think you can take it from here. If you get stuck, Please call again.

Posted
I noticed that the Yes and No functions return a Malformed list on Input as well??

 

Command: ync

*Cancel*

Command: nil

Command: ync (used Yes)

error: malformed list on input

Command:

Command: ync (used No)

error: malformed list on input

 

Try This.

 

(defun c:ync(/ dcl_ync_id)
 (setq dcl_ync_id (load_dialog "ync.dcl"))
 (if (not (new_dialog "ync" dcl_ync_id))
   (exit))
 (action_tile "Yes"    "(setq cmd ($key)[color=red])[/color](done_dialog)" )
 (action_tile "No"     "(setq cmd ($key)[color=red])[/color](done_dialog)" )
 (action_tile "Cancel" "(setq cmd ($key)[color=red])[/color](done_dialog)" )
 (start_dialog)
 (unload_dialog dcl_ync_id)
 (command cmd)
)

Posted

You are on your own at this point.

I was helping with the DCL and not what the code is supose to do.

 

Maybe now repost to a new thread with a new topic.

Posted

Okay, here's the new scoop. Instead of malformed lists, I now have bad functions. Also, how do I pass back or call this, so I can use the returned value? This should do it, and again - thanks for your help!!!

 

Command: (ync)

error: bad function: "Yes"

Command: (ync)

error: bad function: "No"

Command: (ync)

*Cancel*

Posted
Okay, here's the new scoop. Instead of malformed lists, I now have bad functions. Also, how do I pass back or call this, so I can use the returned value? This should do it, and again - thanks for your help!!!

 

Command: (ync)

error: bad function: "Yes"

Command: (ync)

error: bad function: "No"

Command: (ync)

*Cancel*

 

 

 

Ok, See if this is what you want.

 

YNC.DCL

 

// ync.dcl
// Dialog box for yes, no, cancel options to be referenced from AutoLISP
// 
ync: dialog {
    label = "Save Drawing?";
    : text_part {
      label = "Drawing will be saved to AutoCAD Mechanical 2006 or AutoCAD 2004 depending on profile used... ";
    }
    : row {
     : button { label = "&Yes";  key = "Yes";    is_Yes = true; }
     : button { label = "&No";   key = "No";     is_No = true; }
     : button { label = "&Exit"; key = "cancel"; is_cancel = true;  }
    }
  }

 

 

YNC.lsp

 

(defun c:YNC (/ dcl_ync_id)
 (setq dcl_ync_id (load_dialog "ync.dcl"))
 (if (not (new_dialog "ync" dcl_ync_id))
   (exit))
 (action_tile "Yes"    "(Yes)(done_dialog)")
 (action_tile "No"     "(No) (done_dialog) ")
 (action_tile "cancel" "(done_dialog)")
 (start_dialog)
 (unload_dialog dcl_ync_id)
 (princ)
)
(defun Yes ()
 (princ "You selected Yes.")
 (princ)
)
(defun No ()
 (princ "You selected No.")
 (princ)
)

 

 

Of course you will still need to provide your own coding.

Posted

sanderson,

 

I am not sure, But trying to operate the Quit command from within lisp might not be doable, But again I am not sure. You need to fiqure out how to tab the Quit dialog box. This command it seems cannot be answered from the command prompt.

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