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

Rotate text lisp

2 REPLIES 2
Reply
Message 1 of 3
wundrlik
644 Views, 2 Replies

Rotate text lisp

I have an older lisp file (cirra 1993) that used to work up until the advent of LWPOLYLINES. Now I need to know if I can modify this to use them. It's supposed to rotate text to match the rotation of a line.

Thanks,

(princ "\nChange angle of TEXT to selected Line or Polyline")(princ)

(SETQ MARK 0)

(setq p1 (entget (car (nentsel "\nSelect text: "))))
(redraw (cdr (assoc -1 P1)) 3)
(setq P2 (nentsel "\nSelect Line: ")
P3 (entget (car P2)))
(cond ((= (cdr (assoc 0 P3)) "LINE")
(setq P6 (angle (cdr (assoc 10 P3)) (cdr (assoc 11 P3))))
)
((= (cdr (assoc 0 P3)) "VERTEX")
(setq P4 (cdr (assoc 10 P3))
P5 (osnap (cadr p2) "near")
P6 (angle P4 P5))
)
)
(if (and (< P6 4.7124)(> P6 1.5708)) (setq P6 (+ P6 3.1416)))
(entmod (subst (cons 50 P6) (assoc 50 P1) P1))

(SETQ ATOMLIST (CDR (MEMBER 'MARK ATOMLIST)))
(GC)(PRINC)
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: wundrlik

The following function will return a list of vertices for the selected
LWPolyline. You need to figure out WHICH 2 vertices your chosen point is
between and use them to define your angle. If and when I get a chance, I'll
see what I can come up with--unless someone else has something first. But
at least this can provide something to help get you started.

(defun GetPLVertices (ent / cnt ptlist)
(if (=(cdr(assoc 0 ent)) "LWPOLYLINE")
(progn(setq cnt 0)
(repeat (length ent)
(setq cnt (1+ cnt))
(if (= 10 (car (nth cnt ent)))
(if ptlist
(setq ptlist (append ptlist (list(nth cnt ent))))
(setq ptlist (list(nth cnt ent)))
)
)
)
ptlist)
;else - NOT LWPolyline!
(progn(Princ "\nERROR- This is NOT a valid element.")
(princ))
)
)

wrote in message news:4935082@discussion.autodesk.com...
I have an older lisp file (cirra 1993) that used to work up until the
advent of LWPOLYLINES. Now I need to know if I can modify this to use them.
It's supposed to rotate text to match the rotation of a line.

Thanks,

(princ "\nChange angle of TEXT to selected Line or Polyline")(princ)

(SETQ MARK 0)

(setq p1 (entget (car (nentsel "\nSelect text: "))))
(redraw (cdr (assoc -1 P1)) 3)
(setq P2 (nentsel "\nSelect Line: ")
P3 (entget (car P2)))
(cond ((= (cdr (assoc 0 P3)) "LINE")
(setq P6 (angle (cdr (assoc 10 P3)) (cdr (assoc 11 P3))))
)
((= (cdr (assoc 0 P3)) "VERTEX")
(setq P4 (cdr (assoc 10 P3))
P5 (osnap (cadr p2) "near")
P6 (angle P4 P5))
)
)
(if (and (< P6 4.7124)(> P6 1.5708)) (setq P6 (+ P6 3.1416)))
(entmod (subst (cons 50 P6) (assoc 50 P1) P1))

(SETQ ATOMLIST (CDR (MEMBER 'MARK ATOMLIST)))
(GC)(PRINC)
Message 3 of 3
Anonymous
in reply to: wundrlik

Don,

Here's a link to SegmentPts by John Uhden: http://tinyurl.com/bsgf4

Joe Burke

"Don Ireland" wrote in message
news:4935144@discussion.autodesk.com...
The following function will return a list of vertices for the selected
LWPolyline. You need to figure out WHICH 2 vertices your chosen point is
between and use them to define your angle. If and when I get a chance, I'll
see what I can come up with--unless someone else has something first. But
at least this can provide something to help get you started.

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

Post to forums  

Autodesk Design & Make Report

”Boost