Jump to content

Place Leader line With Text(Error Layer)


johnpieter

Recommended Posts

I thing that you have to make a lisp to do that....

Something like that :

(defun c:le (/  lst10 str ent)
(setq   oldlay (getvar "clayer"))
(grtext -1 "Free Lisp LE from Cad-viet @ketxu")
;(setvar "clayer" "KCVN-MANH") : Leader Layer,del ";" and change with your layer
(defun loc (lst vl /) (setq lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) vl)) lst))))
(command "_qleader" pause pause pause)
(command \U+001B)
(setq ent (entget (entlast)))
(setq lst10 (loc ent 10))
(setq str (getstring T "\n Input String : "))
;(setvar "clayer" "KCVN-TEXT") ; Dtext Layer, del ";" and change with your layer
(setq mp (mapcar '+ (nth 1 lst10) (nth 2 lst10))
     mp (mapcar '* mp '(0.5 0.5 0.5)))
(wtxt_l str (mapcar '+ mp '(0.0 0.7 00))) ; 0.7 : space from text to Line Leader along Y axis
(setvar "clayer" oldlay)
)
(defun wtxt_l(txt p / sty d h1 h2 wf h) ;;;Write txt on graphic screen at p, midle bottom
(setq    sty (getvar "textstyle")    
d (tblsearch "style" sty)    
h1 (cdr (assoc 40 d))    
h2 (cdr (assoc 42 d))    
wf (cdr (assoc 41 d)))
(if (> h1 0) (setq h h1) (setq h h2))
(entmake (list (cons 0 "TEXT") (cons 7 sty) (cons 40 h) (cons 41 wf)(cons 72 1)(cons 11 p) (cons 1 txt) (cons 10 p))))

Link to comment
Share on other sites

I want create One Layer "Error" and its should(Text and Leader) automatically place on that layer.How to correct this?any one help please?

 

(defun c:Test (/ p1 p2 p3)

(setvar “clayer” “Error”)

(if (and (setq p1 (getpoint "\nSpecify leader Starting point: "))

(setq p2 (getpoint p1 "\nSpecify Next point: "))

)

(progn

(grdraw p1 p2 7 1)

(setq p3 (getpoint p2 "\nSpecify Next point : "))

(redraw)

(initdia)

(if p3 (progn

(command "_.leader" "_non" p1 "_non" p2 "_non" p3 "_A" "" "_M" "")

(command "_.leader" "_non" p1 "_non" p2 "_A" "" "_M" "")

)

)

)

(princ)

)

Link to comment
Share on other sites

Try this :

(defun c:Test (/ p1 p2 p3)
(setvar "clayer" "Error")
(if (and (setq p1 (getpoint "\nSpecify leader Starting point: "))
(setq p2 (getpoint p1 "\nSpecify Next point: "))
)
(progn
(grdraw p1 p2 7 1)
(setq p3 (getpoint p2 "\nSpecify Next point <Annotation>: "))
(redraw)
(initdia)
(if p3 
(command "_.leader" "_non" p1 "_non" p2 "_non" p3 "_A" "" "_M")
(command "_.leader" "_non" p1 "_non" p2 "_A" "" "_M")
)
)
)
(princ)
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...