Help with lisp routine

Status
Not open for further replies.

badder2

Usenet Archive
Joined
Aug 28, 2001
Messages
4
Reaction score
0
I have taken an existing lisp routine (downloaded) that did leader routines with dtext and have modified it to work with an ellipse instead of an arrowhead. For the most part the lisp works fine. However, I believe the existing lisp routine was written before the extra text insertion variables were added to Autocad (ie. middle-left, middle-right). Therefore the orginal routine used some fancy math to figure where to put the text insertion at the end of the leader line. What I want to do is modify the routine so the the text goes in as either middle-left of middle-right depending on the leader orientation. I need to offset the text slightly from the last point on the leader.

I've attached the lisp routine and would appreciate anyone who can offer some tips on how to modify the text placement location.

thnx, Gary

; ELEA.LSP
; Draws a PLINE leader, SPLINE it and prompt for
; the text entry, either single or multiple lines.

(defun C:ELEA
(defun *ERROR* (MSG)
(reset)
(prompt (strcat "\n\n" MSG " "))
)
(setq OSM (getvar "OSMODE"))
(setq LAYERL (getvar "CLAYER"))
; (TX)
(setq ortho (getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 0)
(setvar "CMDECHO"0)
(princ)
(setq P1 (getpoint "\nStart: "))
(COMMAND "OSNAP" "NONE")
(setq P2 (getpoint P1 "\nFirst point of curve: "))
(setq ANG (angle P1 P2))
(setq DIMSC (getvar "DIMSCALE"))
(setq LTH (* 0.045 DIMSC))
(setq PP2 (polar P1 ANG LTH))
(setq P02 (polar PP2 ANG (/ LTH 2.0)))
(setq P03 (polar PP2 (- ANG 90.0) (/ LTH 4.0)))
(command "PLINE" P02 "W" "0" "0" P2)
(while (setq P2 (getpoint "\nTo point: " P2))
(command P2)
(SETQ T1 P2)
)
(command "")
(princ)
;(command "PEDIT" "@" "S" "")
(command "ELLIPSE" "C" P1 P02 P03)
(princ)
(setvar "OSMODE" OSM)
(COMMAND "ORTHO" "ON")
(setq T2 (getpoint T1 "\nPick direction for TEXT justification:
"))
(setq DS (/ DIMSC 24))
(if (< (car T2) (car T1))
(setq T3 (polar T1 (/ 225 57.295) (* DS (sqrt 2.0)))) (setq T3 (polar T1 (/ 315 57.295) (* DS (sqrt 2.0)))) ) (prompt "\nEnter text: ") (if (< (car T3) (car T1)) (command "DTEXT" "R" T3 "0") (command "DTEXT" T3 "0") ) (setvar "ORTHOMODE" ORTHO) (command "LAYER" "S" LAYERL "") (command "OSNAP" "NONE") )
(c:ELEA)

Check out our new Unlimited Server. No Download or Time Limits!
-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----
 
The placement of text is determined by the point T3, which is calulated using the value DS. DS is set to 1/24 of the current DIMSCALE by the line

(setq DS (/ DIMSC 24))

To place your text further away, use a divisor smaller than 24; to place it closer, use a value larger than 24.
___

wrote:

I've attached the lisp routine and would appreciate anyone who can offer some tips on how to modify the text placement location.
 
Status
Not open for further replies.

Latest threads

Back
Top