Jeff,
I have made a bunch of modifications. But, it still does not work correctly. I think you can figure out what I am trying to do by reviewing the code. The problem I am having now is that it works once and then not again. I know it is a simple for you to see the problem, but as usual..not I.
;TITLE: COPYINC.LSP
;WRITTEN: J.RICHARDSON for CAD User Magazine
;DATE: March 1996
;FUNCTION: Copy a piece of text which is an integer and increment it by 1
;LIMITATIONS: Since no check is made on the contents of text if a string is
; selected then its conversion will be 0 and it will be incremented to
;define error handling function to deal with cancelled commands
(defun *error* (msg / )
(princ "\nerror: ")
(princ msg)
(terpri)
(princ)
)
;;;
(defun DTR (a);added
(* PI (/ a 180.0));added
)
;define main program section
(defun c:COPYINC (/ OLDENT HJ VJ NEWENT)
(setq OLDENT (cdr (entget (car (entsel "Select The Text: ")))))
(while (/= (cdr (assoc 0 OLDENT)) "TEXT"); if we did not select any text
(princ "\nNo Text Selected... Select Again..."); alert the user
(setq OLDENT (cdr (entget (car (entsel "Select The Text: "))))); and ask again
);got some text
;;;
(setq HJ (cdr (assoc 72 OLDENT))); Horizontal point for use below
(setq VJ (cdr (assoc 73 OLDENT))); Vertical point for use below
;;;
;loop until user cancels command
(while T
(progn
;increment text and substitute it in the DXF group 1 entity data
;;;
(setq NEWENT (subst (cons 1 (itoa (1+ (atoi (cdr(assoc 1 OLDENT)))))) (assoc 1 OLDENT) OLDENT))
;get a new point and substitute the DXF group 10 or 11 code with the new point that is 4 units to the left or right
(setvar "OSMODE" 64);added
(cond
((and (= VJ 0)(= HJ 0)
(setq NEWENT (subst (cons 10 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 180) 4)) (assoc 10 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Left
((and (= VJ 0)(= HJ 1)
(princ "\nThis Command Does NOT Work on Center Justified Text...end")
(setq T nil)
)
);Center
((and (= VJ 0)(= HJ 2)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 0) 4)) (assoc 10 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Right
((and (= VJ 0)(= HJ 3)
(princ "\nThis Command Does NOT Work on Aligned Justified Text...end")
(setq T nil)
)
);Aligned
((and (= VJ 0)(= HJ 4)
(princ "\nThis Command Does NOT Work on Middle Justified Text...end")
(setq T nil)
)
);Middle
((and (= VJ 0)(= HJ 5)
(princ "\nThis Command Does NOT Work on Fit Justified Text...end")
(setq T nil)
)
);Fit
((and (= VJ 1)(= HJ 0)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 180) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Bottom Left
((and (= VJ 1)(= HJ 1)
(princ "\nThis Command Does NOT Work on Bottom Center Justified Text...end")
(setq T nil)
)
);Bottom Center
((and (= VJ 1)(= HJ 2)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 0) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Bottom Right
((and (= VJ 2)(= HJ 0)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 180) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Middle Left
((and (= VJ 2)(= HJ 1)
(princ "\nThis Command Does NOT Work on Middle Center Justified Text...end")
(setq T nil)
)
);Middle Center
((and (= VJ 2)(= HJ 2)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 0) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Middle Right
((and (= VJ 3)(= HJ 0)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 180) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Top Left
((and (= VJ 3)(= HJ 1)
(princ "\nThis Command Does NOT Work on Top Center Justified Text...end")
(setq T nil)
)
);Top Center
((and (= VJ 3)(= HJ 2)
(setq NEWENT (subst (cons 11 (polar (getpoint "\nSelect Text Insertion Point: ") (DTR 0) 4)) (assoc 11 NEWENT) NEWENT))
(setq OLDENT (entmake NEWENT))
)
);Top Right
)
)
)
(princ)
)