Autocad checklist after each project is done?

Autocad checklist after each project is done?

Jgmargarito26
Enthusiast Enthusiast
2,940 Views
15 Replies
Message 1 of 16

Autocad checklist after each project is done?

Jgmargarito26
Enthusiast
Enthusiast
I have a question on small homes surveys custom comand. or possiblem lisp. So in my line of business i deal on high volume amount of cad drawings that are sealed and check. So my idea is enabling a command were it asked you or prompt you in the command bar if you did all 5 steps before saving or printing each job. Is anything possible like this for autocad??
0 Likes
Accepted solutions (1)
2,941 Views
15 Replies
Replies (15)
Message 2 of 16

pendean
Community Legend
Community Legend
There is no lisp in LT where you are posting, and programming in LT doesn't really offer a convenient "did you forget" prompt unless you only click on very specific buttons you alone create, which to be honest, if you can't remember you have 5+steps to always do all the time before saving or printing may not be memorable to execute either.
0 Likes
Message 3 of 16

Jgmargarito26
Enthusiast
Enthusiast

How would i start making a command like that. maybe a button next to the saving button up on the express tabs. i just want to make it were it prompts you that command ask's you if you did everything and i would hit enter for every step that i did. and then after that maybe it saves. i  guess like a custom save button would be more appropriate.

0 Likes
Message 4 of 16

rkmcswain
Mentor
Mentor
Wait....? You have an Express Tools tab? Then this isn't AutoCAD LT.
R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 5 of 16

pendean
Community Legend
Community Legend
>>>...next to the saving button up on the express tabs...<<<
LT has no Express Tools: you are in the wrong forum.

You actually need to be posting in the LISP forum way over there https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1
0 Likes
Message 6 of 16

Ranjit_Singh
Advisor
Advisor
Accepted solution

Maybe something like this post here

(command "_.undefine" "PLOT")
(defun c:plot  (/ wsobj)
 (if (= 7 (vlax-invoke (setq wsobj (vlax-get-or-create-object "wscript.shell"))
                     'popup "If sending to shop bla bla bla and if sending to client bla bla bla.\nDid you do this?" 5 "Plot warning" 292))
  (progn (vlax-invoke wsobj 'popup "Make the changes and then plot" 5 "Plot Warning" 64)
         (vlax-release-object wsobj))
  (progn (initdia) (command "._plot")))
(princ))
(vl-load-com)
0 Likes
Message 7 of 16

Kent1Cooper
Consultant
Consultant

How about something like this?

 

(defun C:Check (/ answers)
  (foreach subprompt
    '("walk the dog" "feed the goldfish" "brush your teeth" "say your prayers" "kiss Mommy good night")
    (initget "Yes No")
    (setq answers
      (cons
        (getkword (strcat "\nDid you " subprompt "? [Yes/No] <Yes>: "))
        answers
      ); cons
    ); setq
  ); foreach
  (if (member "No" answers); answered No to any of the questions?
    (alert "\nTake care of what you missed, and check again."); then
    (progn ; else
      (command "_.qsave")
      (initdia) (command "_.plot")
    ); progn
  ); if
); defun

 

That's set up for "Yes" to be the default answer to each question, so if you've been good, you can just hit Enter repeatedly.  It could be done differently, with No as the default answer, if that seems safer to you.  A somewhat different structure could end the questioning as soon as you answer No to any question, instead of always asking all five of them, if you prefer.

 

Kent Cooper, AIA
0 Likes
Message 8 of 16

Jgmargarito26
Enthusiast
Enthusiast

DING DING DING! THIS IS EXACTLY WHAT I WAS LOOKING FOR, I JUST DINDT KNOW JUST IF IT WAS POSSIBLE WITH A LISP.

0 Likes
Message 9 of 16

linwest
Observer
Observer

Would it be possible to pass the prompts answered as "N" to text in model space?

@Kent1Cooper 

 

(if (member "No" answers); answered No to any of the questions?
(alert "\nBeg for help on AutoDesk forum."); then
(entmake (list () subprompt))
(progn ; else
(command "_.qsave")
(initdia) (command "_.plot")
); progn
); if

0 Likes
Message 10 of 16

Kent1Cooper
Consultant
Consultant

@linwest wrote:

Would it be possible to pass the prompts answered as "N" to text in model space?

....


I can picture several ways to go about that.  Here's one [minimally tested]:

(defun C:Check (/ warn ans answers)
  (setq warn ""); initially empty
  (foreach subprompt
    '("walk the dog" "feed the goldfish" "brush your teeth" "say your prayers" "kiss Mommy good night")
    (initget "Yes No")
    (setq answers
      (cons
        (setq ans (getkword (strcat "\nDid you " subprompt "? [Yes/No] <Yes>: ")))
        answers
      ); cons
    ); setq
    (if (= ans "No")
      (setq warn (strcat warn (if (> (strlen warn) 0) " or " "") subprompt)); then
    ); if
  ); foreach
  (if (member "No" answers); answered No to any of the questions?
    (progn ; then
      (alert "\nTake care of what you missed, and check again.")
      (command "_.text" "_mc" "_non" (getvar 'viewctr) "" ""
        (strcat "You did not " warn ".")
      ); command
    ); progn
    (progn ; else
      (command "_.qsave")
      (initdia) (command "_.plot")
    ); progn
  ); if
); defun

Text on current Layer, current size, etc. -- any of those could have values built in.  It assumes the current Text Style is without a fixed height.  If it might be, that can be accounted for.

Kent Cooper, AIA
0 Likes
Message 11 of 16

linwest
Observer
Observer

That is very helpful, and I appreciate your answer. What do you think about using MText instead of Text so that the prompt strings are stacked in a to-do like list?  Or is there some formatting that can be added to the sub prompt strings that can achieve a to-do like list?

0 Likes
Message 12 of 16

Kent1Cooper
Consultant
Consultant

@linwest wrote:

.... What do you think about using MText instead of Text so that the prompt strings are stacked in a to-do like list?  ....


Try this:

(defun C:Check (/ warn ans answers)
  (setq warn ""); initially empty
  (foreach subprompt
    '("walk the dog" "feed the goldfish" "brush your teeth" "say your prayers" "kiss Mommy good night")
    (initget "Yes No")
    (setq answers
      (cons
        (setq ans (getkword (strcat "\nDid you " subprompt "? [Yes/No] <Yes>: ")))
        answers
      ); cons
    ); setq
    (if (= ans "No")
      (setq warn (strcat warn (if (> (strlen warn) 0) "\\P or\\P" "") subprompt)); then
    ); if
  ); foreach
  (if (member "No" answers); answered No to any of the questions?
    (progn ; then
      (alert "\nTake care of what you missed, and check again.")
      (command "_.mtext" "_non" (getvar 'viewctr) "_justify" "ML" "_width" 0
        (strcat "You did not:\\P" warn ".") ""
      ); command
    ); progn
    (progn ; else
      (command "_.qsave")
      (initdia) (command "_.plot")
    ); progn
  ); if
); defun
Kent Cooper, AIA
0 Likes
Message 13 of 16

linwest
Observer
Observer

That is so very helpful. Thank you for sharing this. May you have a great weekend.

0 Likes
Message 14 of 16

cmacdonald
Contributor
Contributor

Hello,

 

Re-igniting this discussion.  I have found that the code that @Ranjit_Singh  shared works wonderfully.  However, it seems that it only works when manually initiating the PLOT (or PUBLISH if edited for that) command outside of SSM.  Is there a way to get this to work when initiating plotting/publishing via the SSM?  It seems as though that command is different, or is initiated via another route.  I don't see anything in the command line when this is plotted/published from the SSM.  ALso, I am using full ACAD.

FYI - I am extremely novice with LISP.

TIA!

cmacdonald_0-1735922210089.png

 

0 Likes
Message 15 of 16

pendean
Community Legend
Community Legend

@cmacdonald LISP is not going to replace to change/edit/replace/add/remove from any core command pop-up like in your screenshot, sorry. That's going to have to come from Autodesk ultimately.

0 Likes
Message 16 of 16

Sea-Haven
Mentor
Mentor

A maybe you can Redefine commands using a lisp defun so if you type "Plot" it now runs a lisp 1st then executes the PLOT command, the other way can be to use a reactor that traps the plot command and again runs a lisp then the normal command, I have used this for Close and Save where other steps where to be carried out 1st.

 

This is a simple tick for yes you just check is any value returned "0"

 

(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (ah:toggs   '("Yes or No" "Did you clean teeth" "Put water in dog bowl" "Did you do step 22" )))

SeaHaven_0-1735947383437.png

 

("0" "0" "0")

 

0 Likes