Leader/Reactor woes
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Leader/Reactor woes

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Josh
Guest





Posted: Fri Apr 08, 2005 7:58 pm    Post subject: Leader/Reactor woes Reply with quote

I have a reactor designed to catch the leader command and, with viewtwist /= 0, make the leader text horizontal on the screen.

My problem is that the tail of the leader won't show properly...sometimes it shows at the default non-viewtwisted angle or it doesn't show at all (see attached pic). I've tried redraw, entupd (which works occasionally) and vla-move to no avail...and, of course, I can't use (command "move" in a reactor. If I redraw or use another command after the leader command then the leader tail updates properly.

Any ideas as to what I can do to "kick" the tail of the stupid leader?

;;;dim2hrz
;;;changes Leader text and dimension text to horizontal with respect to current viewtwist
(defun dim2hrz (reactor data / mtext leader viewtwist dimension)
;;(princ "\nKickin' the reactor")
(setq viewtwist (getvar "viewtwist"))
(cond
((and (wcmatch (car data) "LEADER,QLEADER")
(/= 0 viewtwist)
(= "MTEXT" (dxf 0 (setq mtext (entget (entlast)))))
)
(progn
(entmod (elist mtext 50 (- (* 2 pi) (getvar "viewtwist"))))
;;redraw (dxf -1 mtext) 1)
(entupd (dxf -1 mtext))
;;(princ "\nKick the leader.")
)
)
((and (wcmatch (car data) "DIMLINEAR,DIMALIGNED")
(/= 0 viewtwist)
)
(progn
(setq dimension (entget (entlast)))
(if (= (dxf 0 dimension) "DIMENSION")
(entmod (elist dimension 51 viewtwist))
)
;;(princ "\nKick the dimension.")
)
)
)
(PRINc)
)

(or rea:dim2hrz
(progn
(setq rea:dim2hrz
(VLR-command-Reactor nil '((:vlr-commandEnded . dim2hrz)))
)
(vlr-set-notification rea:dim2hrz 'active-document-only)
)
)

(princ)

;;;change entity list contents if found otherwise add to list
(defun elist (el grp new)
(if (assoc grp el)
(subst (cons grp new) (assoc grp el) el)
(append el (list (cons grp new)))
)
)
;;;extract data from dotted pair
(defun dxf (code elist) (cdr (assoc code elist)))

Back to top
Josh
Guest





Posted: Sat Apr 09, 2005 2:19 am    Post subject: Re: Leader/Reactor woes Reply with quote

Come on...does no one has any idea how to help me?
Back to top
Walt Engle
Guest





Posted: Sat Apr 09, 2005 3:00 am    Post subject: Re: Leader/Reactor woes Reply with quote

I don't use reactors and don't know that much about them. However, I can
give you a lsp routine that will draw the leader you want:

; LDR.LSP
(defun c:ldr ( / np g:ts ts n tdata p1 p2 p3 p4)
(graphscr)
(setvar "osmode" 0)
(prompt "\nDraws leader with a standard arrowhead and text [NO
OPTIONS]")
(terpri)
(setq g:ts (* 0.125 (getvar "dimscale")))
(setq asz (getvar "dimasz"))
(setq asz (* asz (getvar "dimscale")))
(setq woah (/ asz 3.0))
(setq ts g:ts)
(setvar "textsize" ts)
(setq n 0)
(c:ldr1)
(setq tdata nil)
(while (/= "" (setq tl (getstring t "\nEnter text: ")))
(setq tdata (cons tl tdata))
)

(setq htet (getdist (strcat "\n<Current text Height>/or Enter
new text Height <"
(rtos (/ (getvar "textsize")(getvar
"dimscale"))) ">: ")))

(if (null htet)(setq htet (/ (getvar "textsize")(getvar
"dimscale"))))
;(setq ts (* htet (getvar "dimscale")))
;(if (<= htet 0.125)(command "-layer" "s" "0" ""))
;(if (> htet 0.125)
;(progn
(if (> htet 0.375)(command "-layer" "s" "2" ""))
;)
;)

(setq tdata (reverse tdata))
(if (<= (car p1)(car p2))
(progn
(setq p3 (list (+ (car p2) g:ts)(cadr p2))
p4 (list (+ (car p3) g:ts)(- (cadr p3)(* 0.5
ts)))
)
(command "line" p2 p3 "")
(repeat (length tdata)
(command "text" p4 ts 0 (nth n tdata))
(setq p4 (polar p4 (* 1.5 pi)(* 1.75 ts)))
(setq n (1+ n))
)
)
)
(if (> (car p1)(car p2))
(progn
(setq p3 (list (- (car p2) g:ts)(cadr p2))
p4 (list (- (car p3) g:ts)(- (cadr p2)(* 0.5
ts)))
)
(command "line" p2 p3 "")
(repeat (length tdata)
(command "text" "r" p4 ts 0 (nth n tdata))
(setq p4 (polar p4 (* 1.5 pi)(* 1.75 ts)))
(setq n (1+ n))
)
)
)
(princ)
(SETVAR "OSMODE" 32)
)
;
(defun c:ldr1 ()
(initget 1)
(setq p1 (getpoint "\nStart leader (Tip of arrowhead): "))
(initget 1)
(setq p2 (getpoint p1 "\nNext point on leader or end: "))
(setq p3 (polar p1 (angle p1 p2) (* 1.5 g:ts)))
(command "Pline" p1 "w" "0" (* 0.5 g:ts) p3 "w" "0" "" p2)
(while
(setq np (getpoint (getvar "lastpoint") "\nNext point on
leader or <ENTER> to end: "))
(if (/= np "")
(progn
(setq p1 (getvar "lastpoint"))
(setq p2 np)
(command p2)
)
)
(if (= np "")
(command "")
)
)
)

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB