I have two questions

I have two questions

rolisonfelipe
Collaborator Collaborator
789 Views
2 Replies
Message 1 of 3

I have two questions

rolisonfelipe
Collaborator
Collaborator
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(vl-load-com)
(DEFUN C:ALL ()
    (C:LISP01)
   (C:LISP02)
    (C:LISP03)
(princ "\n DIGITE ALL ")
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
        (setq TEXTSIZE ( (getdist (strcat "\n ESCALE 1: "))))
 (princ "\n SELECT OBJECT: ")
 (setq XX (ssget BLABLABLA))
 (Do it XX)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
 (princ "\n SELECT OBJECT: ")
 (setq YY (ssget BLABLABLA))
 (Do it YY)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
 (princ "\n SELECT OBJECT: ")
 (setq ZZ (ssget BLABLABLA))
 (Do it ZZ)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I have a main routine c:all that calls all the others, and all will act on the same object selected, then I ask:
01-has how to make a selection for all, or ssget has limitation at this point?
02-If there is another request how do I put all this in the main programming?
Because, my vision would be something like that....
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(vl-load-com)
(DEFUN C:ALL ()
    (C:LISP01)
   (C:LISP02)
    (C:LISP03)
        (setq TEXTSIZE1 ( (getdist (strcat "\n ESCALE 1: "))))
        (setq TEXTSIZE2 ( (getdist (strcat "\n ADD TEXT "))))
        (setq TEXTSIZE ( (getdist (strcat "\n ESCALE 1: "))))
 (princ "\n SELECT OBJECT: ")
 (setq ALLSELECT (ssget))
(princ "\n DIGITE ALL ")
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
        ;(setq TEXTSIZE1 ( (getdist (strcat "\n ESCALE 1: "))))
 ;(princ "\n SELECT OBJECT: ")
 (setq ALLSELECT (XX))
 (ALLSELECT TEXTSIZE1)
 (Do it XX)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
        ;(setq TEXTSIZE2 ( (getdist (strcat "\n ADD TEXT "))))
 ;(princ "\n SELECT OBJECT: ")
 (setq ALLSELECT(YY))
 (ALLSELECT TEXTSIZE2 YY)
 (Do it YY)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:LISP01 ()
 (BLABLABLA)
 ;(princ "\n SELECT OBJECT: ")
 (setq ALLSELECT (ZZ))
 (Do it ZZ)
(PRINC)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0 Likes
Accepted solutions (1)
790 Views
2 Replies
Replies (2)
Message 2 of 3

dlanorh
Advisor
Advisor
Accepted solution

You should redefine your other lisps as sub functions, that way you can pass variables into and out of them.

 

Load and run this simple code. 

(vl-load-com)
;; Main routine Note the C: This defines it as a command function that you
;; can run from the command line by typing ALL
;; Also note that the local variable list that follows is empty before the "/"
(DEFUN C:ALL ( / msg TEXTSIZE1)
(setq msg "\Enter Text Size : ");set variable msg (setq TEXTSIZE1 (RF:LISP01 msg));pass variable msg to RF:LISP01 and store return in variable TEXTSIZE1
(alert (strcat "Textsize : " (rtos TEXTSIZE1 2 3)));This shows it works by printing what you entered in a sub function (PRINC) )

;; Sub routine Note the RF: There is no C so this is now a sub function
;; can only be run from the command line by typing (RF:LISP01 arg1... ) where arg1 is the variable or
;; variables
you want to pass into the sub function
;; Also note that the local variable list that follows the RF:LISP01 has a variable msg23 before the "/"
;; Sub Routines pass back the last value defined in the sub routine or the result returned by the last operation

(DEFUN RF:LISP01 (msg23 / tsize);(defun RF:LISP01 (msg23 / tsize) but could also be (defun LISP01 ( msg23 / tsize)
 (INITGET 6)
 (setq tsize (getreal msg23));asks for a real number as a text height. Displays msg passed in as a prompt
)

https://fenix.tecnico.ulisboa.pt/downloadFile/3779571825092/autolisp.pdf

I am not one of the robots you're looking for

0 Likes
Message 3 of 3

rolisonfelipe
Collaborator
Collaborator

THANK YOU, FOR SURE I WILL TAKE NOTE.

0 Likes