View Full Version : Some DCL Help
fletch97
2005-06-09, 05:21 PM
Morning -
I need to modify the close command but I want to duplicate the exact behavior and just add a few commands. I need to duplicate this attached image of the DCL file and a lisp to assign action to each tiles. Any help would be appreciated?
Please feel free to offer any better solutions to tweaking the close command!
Thanks,
Steve
kennet.sjoberg
2005-06-09, 07:53 PM
... and a lisp to assign action to each tiles.....
What is your purpose ?
: ) Happy Computing !
kennet
imblueflies
2005-06-09, 09:02 PM
What sort of features are you interested in adding?
Maybe add a button for a "Yes, but Save As..." or something? Or a button that would activate that Tracking command you've been working on? That would be pretty cool, just click a button when closing and it'll log the information to a txt file.
Many posibilities, just not sure what ones would really be usefull every day.
Mike
fletch97
2005-06-09, 10:26 PM
Mike -
Yea I am trying to just add my tracking lisp into the "yes" response when asked to save drawing before closing. It woudl be ideal and I have been making progress with it but haven't gotten it there just yet. But I am working really hard at it getting this done......just curious if there's an easier way out there?
Steve
Oh....I didn't forget about you, just got wrapped up in this issue.
imblueflies
2005-06-09, 11:01 PM
Steve, don't worry about it. If you get a chance to work on it, of course, I'd appreciate it but no rush.
Mike
fletch97
2005-06-09, 11:06 PM
Ok I really need some help with this lisp file that's connected to my dcl file.
First problem, when you hit the Yes button, it activates the qsave but at the command line....it doesn't pull up the dialog box?
Second problem, when I hit the No button, it closes the drawing but my dialog box stays open....weird??
-------------------------------------------------------------------------------
(defun C:Close1 ()
(setq dcl_id (load_dialog "l:/tsa-custom/dcl/close1.dcl"))
(if (not (new_dialog "close1" dcl_id)) (exit))
(action_tile "Yes" "(done_dialog)(save)" )
(action_tile "No" "(done_dialog)(close)" )
(action_tile "Cancel" "(done_dialog)" )
(start_dialog)
(unload_dialog dcl_id)
(princ)
)
(defun save ()
(command "qsave")
(princ)
)
(defun close ()
(command "close")
(princ)
)
---------------------------------------------------------------------
close1
: dialog
{
label = "AutoCAD";
: text
{
label = "";
alignment = centered;
}
: text
{
label = "Save changes to dwg?";
alignment = centered;
}
: text
{
label = "";
alignment = centered;
}
: row {
: button
{
label = "Yes";
key = "Yes";
mnemonic = "Y";
alignment = centered;
width = 12;
is_default = true;
}
: button
{
label = "No";
key = "No";
mnemonic = "N";
alignment = centered;
width = 12;
is_default = true;
}
: button
{
label = "Cancel";
key = "cancel";
mnemonic = "C";
alignment = centered;
width = 12;
is_default = true;
}
}
}
fletch97
2005-06-10, 01:25 AM
Ok.....I tried a different approach but the yes and no buttons don't work but the code makes more sense to me.
(setvar "cmdecho" 0)
(command ".undefine" "close")
(setvar "cmdecho" 1)
(defun C:close ()
(setq dcl_id (load_dialog "l:/tsa-custom/dcl/close.dcl"))
(if (not (new_dialog "close" dcl_id)) (exit))
(action_tile "Yes" "(done_dialog) (setq SV)" )
(action_tile "No" "(done_dialog) (setq CLS)" )
(action_tile "Cancel" "(done_dialog)" )
(start_dialog)
(unload_dialog dcl_id)
(if SV
(progn
(command "qsave")
(initdia)
(command ".close")
)
)
(if CLS
(progn
(initdia)
(command ".close")
)
)
(princ)
)
kennet.sjoberg
2005-06-10, 01:44 AM
If you use my reactor in the "Tracking Lisp" thread
You can forgot about the DCL and lisp programs behind the buttons.
The reactor check if you are saving the drawing ( AutoCAD standard command )
and if that is true, the trigger activates and save the info to the log file.
And if I don't miss mind you can not redefine the [X] ,_exit, ._quit and ._close
so i think you have to drop your idea. You may try and modify the reactor.
Just cut and paste the code in to your command prompt window, and see what happens when you save or exit/save your drawing.You may be :) surprised.
: ) Happy Computing !
kennet
CAB2k
2005-06-10, 01:49 PM
Try this, not tested..
(defun C:Close1 ()
(setq dcl_id (load_dialog "l:/tsa-custom/dcl/close1.dcl"))
(if (not (new_dialog "close1" dcl_id))
(exit)
)
(action_tile "Yes" "(done_dialog 1)")
(action_tile "No" "(done_dialog 2)")
(action_tile "Cancel" "(done_dialog)")
(setq action (start_dialog))
(unload_dialog dcl_id)
(cond
((= action 0)
(prompt "\nUser Canceled")
)
((= action 1)
(initdia)
(command "save")
)
((= action 2)
(command "close")
)
)
(princ)
)
bbapties
2005-06-10, 02:31 PM
I agree with kennet on this one.... I see an issue if you just add it into the close dialog box....
what if someones saves manually directly before they close?......that dialog only comes up upon closing with out saving......
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.