Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dialog box button lisp problems

4 REPLIES 4
Reply
Message 1 of 5
boatman38
533 Views, 4 Replies

dialog box button lisp problems

I would like to creat a dialog box with buttons or radio buttons to insert various blocks.  something easy to start the dialogue, push the button desired and my block or lisp is inserted or run. I have the dcl part figured out.  i'm not quite smart enough to get the lisp down.  is there a generic lisp that can reference a lisp command that i can alter or edit and add to?

4 REPLIES 4
Message 2 of 5
Hallex
in reply to: boatman38

You may want to add few check boxes (toogles) one per

a desired lisp command

Pseudo-code:

{code}

_______________________________--
;;start lisp here
(defun C:CMD1(/ ...)
;; rest code
(princ)
)
(defun C:CMD2(/ ...)
;; rest code
(princ)
)
;;ETC

(defun C:main(/ ....)
 (action_tile
 "accept"
 (strcat "(progn "
 ;; here is your other code for rest tiles
  "(setq check1 (atoi (get_tile \"lisp1\")));<-- "lisp1" is toogle key
  "(if (= 1 check1)"
     "(setq load1 T)";<-- load1 is variable
      "(setq load1 nil))" 
 "(if (= 1 check2)"
     "(setq load2 T)";<-- load2 is variable
      "(setq load2 nil))" 

  "(done_dialog 1))")
 )

      (action_tile "cancel" "(done_dialog 0)")

      (start_dialog)
      )
    )
  (unload_dialog dcl_id)

;; then after check variables:
(if load1
(progn
(C:CMD1);<--cmd1 is command to run first lisp
(princ "\nCommand #1 executed"))
(if load2
(progn
(C:CMD2);<--cmd1 is command to run first lisp
(princ "\nCommand #2 executed"))
;;ETC...
(princ)
)
;;end lisp here
_____________________________

{code}

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 5
M_Hensley
in reply to: boatman38

A tool palette is the easiest way to do what you are after. Just highlight your blocks in Windows Explorer and select copy then right-click on your tool palette and select paste. Instant graphical block insert tool.

Message 4 of 5
boatman38
in reply to: Hallex

Ok so I'm not smart enough to figure this out.  the ";;rest code" part, is that where i put my lisp routine?  Also, the (\...) part, is that where I need to put something?  I applogize for being ignorant, i really want to learn this and figure it out.

Message 5 of 5
scot-65
in reply to: boatman38

You are asking too much at one time!

 

Start by viewing the attached file on how to structure your program for the dialog.

It is somewhat incomplete (missing the defun), but ready to populate.

 

Where to place these 2 files (DCL and LSP)?

Create a folder to hold these files.

Command OPTIONS -> Files tab -> Support Path and add a path to this folder.

 

Next, if you do not have a file called ACAD.lsp or ACADdoc.lsp, create one and

place inside the above folder.

 

Inside either one of these files (whichever you wish to employ) declare your routines:

(defun c:USR () (load "USR") (c:USR)(princ)) ;add brief descriptive comment to end of this line

One defun per each line...

 

OK, the keystroke is declared. Next you want to add a line to the screen menu, pull-down,

or create a toolbar button. The macro to use is ^C^CUSR;

You can also store icons (toolbar button BMP) in the above folder as well.

 

Good Luck!

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost