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

copy text doan and change number at same time

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
129 Views, 3 Replies

copy text doan and change number at same time

Does anyone have or know of a lisp that can copy
text down, (like 1., 2. etc) and increase number by one.  So copying text
2. down would end up being 3.

 

I can write one, or concoct one from 2 or 3 from my
collection, but any help or base would be great.  I can copy the text down
no problem, its reading the text, and increasing the number by one that may be
slightly difficult.


--
John Crocco

href="mailto:Jcrocco@cartlandco.com">Jcrocco@cartlandco.com


href="http://www.skyboom.com/jcrocco/trilokin.html">http://www.skyboom.com/jcrocco/trilokin.html

Would
you like to lose weight naturally, while increasing your energy?
Click above
for more info.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous


I came up with this command to copy an attributed
block down and change the number.  It should be fairly easy to modify it to
work for text... mostly would require taking anything related to attributes and
modifing to run ddedit instead of attedit...


good luck


Joe B


;-------------------------------------------------------------------------


; This function copies plan note bubbles down the list


; while automatically changing the number


;-------------------------------------------------------------------------


(defun c:y ()


(setq FIRSTNOTE (car (entsel)))


(setq FIRSTNOTEDATA (entget FIRSTNOTE))


(setq FIRSTNOTEINS (cdr (assoc 10 FIRSTNOTEDATA)))


(setq BASEPT (polar FIRSTNOTEINS (* 1.5 pi) (* (getvar "userr1") 4.5)))


(setq BASEPT_X (nth 0 BASEPT))


(setq COUNT (atoi (cdr (assoc 1 (entget (entnext FIRSTNOTE))))))


(setq NEXTPOINT (getpoint "\nSelect NEXT POINT: "))


(while (/= NEXTPOINT nil)


(setq NEXTPOINT_Y (nth 1 NEXTPOINT))


(setq NEWPT (list BASEPT_X NEXTPOINT_Y))


(command "copy" FIRSTNOTE "" BASEPT NEWPT)


(command "attedit" "" "" "" "" (entnext (entlast)) "v" "r" (itoa (+ COUNT 1))
"")


(setq COUNT (1+ COUNT))


(setq NEXTPOINT (getpoint "\nSelect NEXT POINT or RETURN to exit: "))


)


(princ)


)


; Joe Becker 6/26/01



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Does anyone have or know of a lisp that can copy
text down, (like 1., 2. etc) and increase number by one.  So copying text
2. down would end up being 3.

 

I can write one, or concoct one from 2 or 3 from
my collection, but any help or base would be great.  I can copy the text
down no problem, its reading the text, and increasing the number by one that
may be slightly difficult.


--
John Crocco

href="mailto:Jcrocco@cartlandco.com">Jcrocco@cartlandco.com


href="http://www.skyboom.com/jcrocco/trilokin.html">http://www.skyboom.com/jcrocco/trilokin.html

Would
you like to lose weight naturally, while increasing your energy?
Click
above for more info.
Message 3 of 4
Anonymous
in reply to: Anonymous

It could go something this...

(defun C:CT+ ( / Ename Ent N p10 p11 d)
(setvar "errno" 0)
(while (/= (getvar "errno") 52)
(setq Ename (car (entsel "\nSelect text to copy: ")))
(cond
((= (getvar "errno") 52))
((not Ename))
((and (setq Ent (entget Ename)) nil))
((/= (cdr (assoc 0 Ent)) "TEXT")
(prompt " Entity is not TEXT.")
)
((not (wcmatch (setq N (cdr (assoc 1 Ent))) "#*"))
(prompt " Text is not numeric.")
)
((and (setq p10 (cdr (assoc 10 Ent)))
(setq p11 (cdr (assoc 11 Ent)))
(setq d (mapcar '- p11 p10))
(setq p10 (getpoint (trans p10 0 1) "\nNew text location: ")))
(setq p10 (trans p10 1 0)
p11 (mapcar '+ p10 d)
Ent (subst (cons 10 p10)(assoc 10 Ent) Ent)
Ent (subst (cons 11 p11)(assoc 11 Ent) Ent)
Ent (subst (cons 1 (itoa (1+ (atoi N))))(assoc 1 Ent) Ent)
)
(entmake Ent)
)
)
)
(princ)
)

--
John Uhden, Cadlantic/formerly CADvantage
[ mailto:juhden@cadlantic.com ]
[ http://www.cadlantic.com ]
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711

"john crocco" wrote in message news:43B3E9E09E249799EAE5DB2B4379FB13@in.WebX.maYIadrTaRb...
> Does anyone have or know of a lisp that can copy text down, (like 1., 2. etc) and increase number by one. So copying text 2. down
would end up being 3.
>
> I can write one, or concoct one from 2 or 3 from my collection, but any help or base would be great. I can copy the text down no
problem, its reading the text, and increasing the number by one that may be slightly difficult.
>
> --
> John Crocco
> Jcrocco@cartlandco.com
> http://www.skyboom.com/jcrocco/trilokin.html
> Would you like to lose weight naturally, while increasing your energy?
> Click above for more info.
Message 4 of 4
Anonymous
in reply to: Anonymous

Thanks to both of you, I will take a look at it.


--
John Crocco
Jcrocco@cartlandco.com
http://www.skyboom.com/jcrocco/trilokin.html
Would you like to lose weight naturally, while increasing your energy?
Click above for more info.
"John Uhden" wrote in message
news:ECF20D90FB3B16E7C126C5A8C6AD4C23@in.WebX.maYIadrTaRb...
> It could go something this...
>
> (defun C:CT+ ( / Ename Ent N p10 p11 d)
> (setvar "errno" 0)
> (while (/= (getvar "errno") 52)
> (setq Ename (car (entsel "\nSelect text to copy: ")))
> (cond
> ((= (getvar "errno") 52))
> ((not Ename))
> ((and (setq Ent (entget Ename)) nil))
> ((/= (cdr (assoc 0 Ent)) "TEXT")
> (prompt " Entity is not TEXT.")
> )
> ((not (wcmatch (setq N (cdr (assoc 1 Ent))) "#*"))
> (prompt " Text is not numeric.")
> )
> ((and (setq p10 (cdr (assoc 10 Ent)))
> (setq p11 (cdr (assoc 11 Ent)))
> (setq d (mapcar '- p11 p10))
> (setq p10 (getpoint (trans p10 0 1) "\nNew text location: ")))
> (setq p10 (trans p10 1 0)
> p11 (mapcar '+ p10 d)
> Ent (subst (cons 10 p10)(assoc 10 Ent) Ent)
> Ent (subst (cons 11 p11)(assoc 11 Ent) Ent)
> Ent (subst (cons 1 (itoa (1+ (atoi N))))(assoc 1 Ent) Ent)
> )
> (entmake Ent)
> )
> )
> )
> (princ)
> )
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> [ mailto:juhden@cadlantic.com ]
> [ http://www.cadlantic.com ]
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
>
> "john crocco" wrote in message
news:43B3E9E09E249799EAE5DB2B4379FB13@in.WebX.maYIadrTaRb...
> > Does anyone have or know of a lisp that can copy text down, (like 1., 2.
etc) and increase number by one. So copying text 2. down
> would end up being 3.
> >
> > I can write one, or concoct one from 2 or 3 from my collection, but any
help or base would be great. I can copy the text down no
> problem, its reading the text, and increasing the number by one that may
be slightly difficult.
> >
> > --
> > John Crocco
> > Jcrocco@cartlandco.com
> > http://www.skyboom.com/jcrocco/trilokin.html
> > Would you like to lose weight naturally, while increasing your energy?
> > Click above for more info.
>
>

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

Post to forums  

Autodesk Design & Make Report

”Boost