Jump to content

Undoing Lisps


bagulhodoido

Recommended Posts

Is there any way to undo a whole lisp in a single command? I usually use lisps which do major changes on the drawing and undoing them sometimes takes a long time since each step of the lisp needs to be undone at a time. I wish I could undo all the lisp actions in a single command.

 

Also, another request, probably not regarding lisps, but, I usually need to make tables with materials list and stuff, related to the projects. Is there any way to fix a view of the model, like, I place the view over the table, call it TABLEVIEW. And everytime I need to see it I just call it like, GO-TABLEVIEW and it automatically goes back to that saved view... That would really speed my work up. Specially when the tables are complex and full of data which always slow down the pan and zoom process.

 

 

Thanks for your attention

Link to comment
Share on other sites

right after the DEFUN line? and right before the last ")" ???

 

btw, I copied this code from this thread:

 

 

http://www.cadtutor.net/forum/showthread.php?t=29445&highlight=Lot+area

 

(defun c:LA () ;(/ cl txtst txtsz oldecho oldsnap B ac sf kw)

(command "-undo" "BEGIN")

(setq temperr *error*);store *error*

(setq *error* errortrap);reassign *error*

(setq cl (getvar "clayer")

txtst (getvar "textstyle")

txtsz (getvar "textsize")

oldecho (getvar "cmdecho")

oldsnap (getvar "osmode")

);setq

(setvar "cmdecho" 0)

(command "-style" "SIMPLEX" "simplex.shx" "0" "0.9" "0" "n" "n" "n")

(setq ip (getpoint "\nPick internal point: "))

(command "-layer" "m" "calc" "c" "63" "calc" "p" "n" "calc" "")

(command "-boundary" ip "")

(command "region" (entlast) "")

(setq b (entlast))

(command "area" "o" b)

(setq ac (strcat (rtos (/ (getvar "area") 10.76) 2 3) " Sq.m."))

(setq sf (strcat (rtos (getvar "area") 2 2) " m²"))

(setq per (strcat (rtos (getvar "perimeter") 2 2) " m"))

(command "-layer" "m" "LOT-AREA" "c" "53" "" "")

(command "text"

"s"

"simplex"

"c"

ip

(* 3 (getvar "dimscale"))

"0"

sf

)

(command "text" "" per)

(initget "Yes No")

(setq kw (getkword "\nErase boundary Yes/No? "))

(if

(= kw nil)

(command "erase" b "")

) ;if

(command "textstyle" txtst)

(setvar "clayer" cl)

(setvar "textsize" txtsz)

(setvar "cmdecho" oldecho)

(setvar "osmode" oldsnap)

(setq *error* temperr)

(princ)

(command "undo" "END")

);defun c:

 

;==========ERROR TRAP=================

(defun errortrap (msg) ;define function

(setvar "textstyle" txtst)

(setvar "textsize" txtsz)

(setvar "clayer" cl)

(setvar "cmdecho" oldecho) ;restore variables

(setvar "osmode" oldsnap)

(setq *error* temperr) ;restore *error*

(prompt "\nResetting System Variables ") ;inform user

(princ)

);defun

;==========ERROR TRAP=================

 

(prompt "\nLotArea.lsp loaded, type LA to run")

(princ)

Link to comment
Share on other sites

You can use the undo "begin" and "end" to envelope sections in which objects are modified - so not necessarily at beginning and end, but experiment with them and use them to best suit your needs.

Link to comment
Share on other sites

Oh I'm sorry for that. That's not my job, I took that code from the forums, and I didn't knew who did it.. My bad... really sorry... btw, no code I post here will be mine, I suck at it, it would be all wrong anyway.

Link to comment
Share on other sites

I just can't get it right... If my needs would be just hitting ctrl + z once after the command LA, the whole thing got undone, where should I put the UNDO BEGIN and END? I keep swaping them from place to place and It simply doensn't make any difference.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...