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

two lsp at once

3 REPLIES 3
Reply
Message 1 of 4
chrisA
189 Views, 3 Replies

two lsp at once

Hi,
I've pieced together the following routine that works but it needs some refinement.
I need to be able to draw a line on a created layer and then to delete the layer after a set time. I use this as a temp layer for trimming, extensions etc...
Although it's probably a bit messy, everything works except I need to be able to continue using other functions while this routine runs in the background e.g line, text etc...
Is this possible or am I dreaming?

here's the routine so far:

(defun c:TL (/ clyr)
(setq clyr (getvar "clayer"))

(defun GET_DATE ( / A yr mo dax hr mi); second (se) passed on
(setq A (rtos (getvar "CDATE") 2 6)) ; get Julian date
(if (/= A nil)
(progn
(setq yr (substr A 3 2)); year (2 digit)
(setq mo (substr A 5 2)); month
(setq dax (substr A 7 2)); day
(setq hr (substr A 10 2)); hour
(setq mi (substr A 12 2)); minute
(setq se (substr A 14 2)); second
(princ)
); end progn
); end if
); end GET_DATE
;

(command ".layer" "M" "TEMP_LAYER" "c" "202" "TEMP_LAYER" "L" "" "TEMP_LAYER" "T" "TEMP_LAYER" "U" "TEMP_LAYER" "")
(setvar "clayer" "TEMP_LAYER")
(command "._line")
(while (= (logand (getvar "cmdactive") 1) 1)
(command pause)
)
(setvar "clayer" clyr)
;need to allow other functions here while this routine continues in background
;
(GET_DATE)
(setq sec (atoi se))
(if (or (= sec 55)(> sec 55))
(setq target (- sec 55)); 0 thru 4
(setq target (+ sec 10))
); end if
(while (/= sec target)
(get_date)
(setq sec (atoi se))
); end while
(command "-layer" "M" "0" "T" "0" "U" "0" "")
(setvar "clayer" "0")
(command "_laydel" "N" "TEMP_LAYER" "" "Y")
)
3 REPLIES 3
Message 2 of 4
andrew_nao
in reply to: chrisA

as far as i know lisp dont run in the background


wrote in message news:5780805@discussion.autodesk.com...
Hi,
I've pieced together the following routine that works but it needs some
refinement.
I need to be able to draw a line on a created layer and then to delete the
layer after a set time. I use this as a temp layer for trimming, extensions
etc...
Although it's probably a bit messy, everything works except I need to be
able to continue using other functions while this routine runs in the
background e.g line, text etc...
Is this possible or am I dreaming?

here's the routine so far:

(defun c:TL (/ clyr)
(setq clyr (getvar "clayer"))

(defun GET_DATE ( / A yr mo dax hr mi); second (se) passed on
(setq A (rtos (getvar "CDATE") 2 6)) ; get Julian date
(if (/= A nil)
(progn
(setq yr (substr A 3 2)); year (2 digit)
(setq mo (substr A 5 2)); month
(setq dax (substr A 7 2)); day
(setq hr (substr A 10 2)); hour
(setq mi (substr A 12 2)); minute
(setq se (substr A 14 2)); second
(princ)
); end progn
); end if
); end GET_DATE
;

(command ".layer" "M" "TEMP_LAYER" "c" "202" "TEMP_LAYER" "L" ""
"TEMP_LAYER" "T" "TEMP_LAYER" "U" "TEMP_LAYER" "")
(setvar "clayer" "TEMP_LAYER")
(command "._line")
(while (= (logand (getvar "cmdactive") 1) 1)
(command pause)
)
(setvar "clayer" clyr)
;need to allow other functions here while this routine continues in
background
;
(GET_DATE)
(setq sec (atoi se))
(if (or (= sec 55)(> sec 55))
(setq target (- sec 55)); 0 thru 4
(setq target (+ sec 10))
); end if
(while (/= sec target)
(get_date)
(setq sec (atoi se))
); end while
(command "-layer" "M" "0" "T" "0" "U" "0" "")
(setvar "clayer" "0")
(command "_laydel" "N" "TEMP_LAYER" "" "Y")
)
Message 3 of 4
Anonymous
in reply to: chrisA

i don´t think so, but maybe a simple toolbar button can do the same for
you...
1)if the temp-layer exist, ssget all elemnts on this layer and del them
and the layer
2)if the layer doesn´t exists, create it an make it the current one...
between these to steps you can use whatever function you like
maybe add in the startup, that the elements on your temp-layer and the
layer should be deleted, everytime a dwg is opend...



chrisA wrote:
> Hi,
> I've pieced together the following routine that works but it needs some refinement.
> I need to be able to draw a line on a created layer and then to delete the layer after a set time. I use this as a temp layer for trimming, extensions etc...
> Although it's probably a bit messy, everything works except I need to be able to continue using other functions while this routine runs in the background e.g line, text etc...
> Is this possible or am I dreaming?
>
> here's the routine so far:
>
> (defun c:TL (/ clyr)
> (setq clyr (getvar "clayer"))
>
> (defun GET_DATE ( / A yr mo dax hr mi); second (se) passed on
> (setq A (rtos (getvar "CDATE") 2 6)) ; get Julian date
> (if (/= A nil)
> (progn
> (setq yr (substr A 3 2)); year (2 digit)
> (setq mo (substr A 5 2)); month
> (setq dax (substr A 7 2)); day
> (setq hr (substr A 10 2)); hour
> (setq mi (substr A 12 2)); minute
> (setq se (substr A 14 2)); second
> (princ)
> ); end progn
> ); end if
> ); end GET_DATE
> ;
>
> (command ".layer" "M" "TEMP_LAYER" "c" "202" "TEMP_LAYER" "L" "" "TEMP_LAYER" "T" "TEMP_LAYER" "U" "TEMP_LAYER" "")
> (setvar "clayer" "TEMP_LAYER")
> (command "._line")
> (while (= (logand (getvar "cmdactive") 1) 1)
> (command pause)
> )
> (setvar "clayer" clyr)
> ;need to allow other functions here while this routine continues in background
> ;
> (GET_DATE)
> (setq sec (atoi se))
> (if (or (= sec 55)(> sec 55))
> (setq target (- sec 55)); 0 thru 4
> (setq target (+ sec 10))
> ); end if
> (while (/= sec target)
> (get_date)
> (setq sec (atoi se))
> ); end while
> (command "-layer" "M" "0" "T" "0" "U" "0" "")
> (setvar "clayer" "0")
> (command "_laydel" "N" "TEMP_LAYER" "" "Y")
> )
Message 4 of 4
chrisA
in reply to: chrisA

thanks guys, I thought as much.
I think I'll have to try your suggestion gert.
Thanks again.

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

Post to forums  

Autodesk Design & Make Report

”Boost