Message 1 of 10
Add undo function to routine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI
I have this code, and i'm looking for an undo function, so i can eliminate the last introduced copied block and continue with the Routine.
(defun Punktkopie ( / ent obj att fieldcode gesch str ulay klay pt inserted) (defun LM:getattributevalue ( blk tag / enx ) (if (and (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk)))))) (if (= (strcase tag) (strcase (cdr (assoc 2 enx)))) (cdr (assoc 1 (reverse enx))) (LM:getattributevalue blk tag) ) ) ) (while T (if (and (setq ent (entsel "\nGeoreferenzierter Punkt wählen: ")) (= (vla-get-ObjectName (setq obj (vlax-ename->vla-object (car ent)))) "AcDbBlockReference") (= (vla-get-EffectiveName obj) "SPI-Datenextraktionspunkt-CM") (setq att (nentselp (cadr ent))) (= (vla-get-ObjectName (setq att (vlax-ename->vla-object (car att)))) "AcDbAttribute") ) (progn (setq gesch (LM:GetAttributeValue (car ent) "01" ) str (if (vl-string-search "-" gesch)(vl-string-right-trim "-" (vl-string-right-trim "0123456789" gesch))(vl-string-right-trim "0123456789" gesch)) ulay (if (= str "")(strcat "-I-Koordinatenpunkte-" str "Unsichtbar")(strcat "-I-Koordinatenpunkte-" str "-Unsichtbar")) klay (if (= str "")(strcat "-I-Koordinatenpunkte-" str "Kopie")(strcat "-I-Koordinatenpunkte-" str "-Kopie"))) (if (wcmatch gesch "*;*") (progn (alert "Punktkopie mit dem alten Textformat nicht möglich!") (exit))) (command "_.-layer" "_m" ulay "_co" "251" ulay "_p" "_n" ulay "") (vla-put-Layer obj ulay) (command "_.-LAYER" "_m" klay "_co" "2" klay "") (setq fieldcode (strcat "%<\\AcObjProp Object\(%<\\_ObjId " (itoa (vla-get-objectid att)) ">%\).TextString>%")) (setq pt (getpoint (strcat "\nEinfügepunkt für Punktkopie von " gesch " angeben: "))) (command "_.-INSERT" "SPI-Punktkopie" "_none" pt 1 1 "" fieldcode "")) ) ) ; end of if ) ; end of while ) ; end of defun
Please help