PDA

View Full Version : help me please...... modify lisp script



gianni154
8th Jun 2003, 08:30 pm
hello i have this lisp script to move the text to a z positions with text contents;
I need thath insert a point to the insert text point;

(defun c:movez()
(prompt "\Select text:")
(setq sset (ssget)
ndx 0)
(repeat (sslength sset)
(setq elist (entget (ssname sset ndx)))
(setq zcoord (cdr (assoc 1 elist)))
(setq ccoord (cdr (assoc 10 elist)))
(setq jcoord (cdr (assoc 11 elist)))
(setq zcoord (distof zcoord))
(if (= zcoord nil)
(setq zcoord 0)
)
(setq xc (car ccoord)
yc (cadr ccoord)
xj (car jcoord)
yj (cadr jcoord)
)
(setq ccoord (list xc yc zcoord)
jcoord (list xj yj zcoord)
)
(setq elist (subst (cons 10 ccoord)(assoc 10 elist) elist))
(setq elist (subst (cons 11 jcoord)(assoc 11 elist) elist))
(entmod elist)
(setq ndx (1+ ndx))
)
)

-------------------------------------------
and a script for insert a point to polyline vertex;

thank you, and sorry for my fatal english ;)

fuccaro
9th Jun 2003, 06:17 am
Hello
You have my sympathy; my English is not better as yours is.
I do not understand your questions. Do you wish to move some text to a polyline vertex? Or to create a POINT object at the insert position of the text? Please give us more information, I am sure we will find a solution to fix your problems.
Cheers.

gianni154
9th Jun 2003, 09:24 am
hello
I need Or to create a POINT object at the insert position of the text, and on 2º lisp create a point object to the poyline vertex...

than you

fuccaro
9th Jun 2003, 11:07 am
Ok Gianni
Here is the first routine. Is it what you need? If yes, I will return with the other routine. What AutoCAD are you using? It is not the same thing to work with POLYLINEs and with LWPOLYlines

(defun c:tpo();Text POint- create a point at the insertion of a text
(command "point" (cdr (assoc 10 (entget (car (entsel "\ntext?")))))))

gianni154
9th Jun 2003, 11:55 am
hello
yes is this, but is posible with a multiple selection text?

thank you, very

fuccaro
9th Jun 2003, 03:15 pm
This routine will insert points at the vertexes of a POLYLINE (rectangle, polygon etc) and at the insertion point of TEXT and MTEXT objects. Other objects are ignored, so you may include in the selection set CIRCLEs, LINEs and so on, the routine will not affect them.
Please write me, what will you do with this Lisp?


; Draw POINTs at POLYLINE vertexes
; and at (M)TEXT insertion points
;;; mfuccaro@hotmail.com 09.06.2003
;
(defun c:pts( / ss i elist zero first)
(setvar "CMDECHO" 0)
(command "UNDO" "begin")
(setq ss (ssget) i 0)
(repeat (sslength ss)
(setq elist (entget (ssname ss i))
zero (cdr (assoc 0 elist)))
(if (OR (= zero "TEXT") (= zero "MTEXT") (= zero "LWPOLYLINE"))
(while elist
(setq first (car elist) elist (cdr elist))
(if (= 10 (car first)) (command "POINT" (cdr first)))
))
(setq i (1+ i))
)
(command "undo" "end")
(setvar "CMDECHO" 1)
(princ)
)

gianni154
9th Jun 2003, 05:10 pm
THANK YOU VERY MUTCH....

THE CODE IS PERFECT...

fuccaro
10th Jun 2003, 02:12 am
:D :D :D :D :D You are welcome!

Please write me, what will you do with this Lisp?

gianni154
10th Jun 2003, 10:27 am
the code for drawing poin to to text point insert or polyline vertex is for a topografy work...... and sincerely i necesited a script for proyecting a polyline standing to te zoordinate z=0 to a series of 3d face with coordinate z variabily ;
I send on your e-mail a drawing for this problem.