Jump to content

qleader lisp


ravenboyy

Recommended Posts

hi everyone..i just wanted to ask if anyone has a lisp routine which draws a leader with a horizontal line and a 45deg inclined second line but you only have to pick on the origin point and the arrowhead point?

 

 

pickpoint 1 _________

___________________\

____________________\

_____________________\

______________________\

___________________pickpoint 2

 

and also..the length of the lines should be limitless...

 

thanks...

Link to comment
Share on other sites

thanks for helping me out...the lisp routine in the link you provided was amazing, but what im looking for is a routine which has a default angle like 45deg or 30 deg while the horizontal line can be extended..i intend to use it for call-outs in a plan or elevation drawing..hope you still have some other sources for the routine im looking for..

Link to comment
Share on other sites

You can do this within the standard Autocad Leader settings.

 

Type LE to initiate the leader command

Type S to enter the "Leader Settings" dialog

Click on the "Leader Line & Arrow" tab

Under "Angle Constraints"

set "First Segment" to 45 or 30

set "Second Segment" to 90

Hit OK and then draw out your leader

Link to comment
Share on other sites

thats the step im currently using....but i have to pick 3 points to create the leader ....

 

well, i have a colleague who uses the routine but the guy doesnt want to share the lisp file......he just types in "AQ"..then picks on area near the mtext call-out then picks on the area or object that he wants to point the arrow head then the leader just appears...just 2 clicks then a leader with a 45d second line inclination appears....it would be really helpful for my team....

 

thanks for helping me you guys...

Link to comment
Share on other sites

Why the hell won't he share the routine with you? Did he write it? Is it his most prized possession? Was it passed down through generations from his grandfather to his father and now to him? Is it some type of top secret routine that only special people like him are granted access to? No, it's a simple little lisp routine that Lee could probably write in his sleep.

 

I could understand if the guy paid for it, so he doesn't want to give it up for free, but I seriously doubt that's the case. So I don't get it, he's your co-worker, right? Shouldn't he be willing to help out his fellow employees?

 

Although, I don't really see the benefit of this routine. 2 clicks or 3 clicks. What's the difference? I generally just create one leader and then copy and paste it wherever I need it.

Link to comment
Share on other sites

You could, of course, put something like this in your ACADDOC.lsp file to automatically set your leader settings on startup:

 

;;; qlset.lsp - example initialization of QLEADER settings
;;; Frank Whaley, Autodesk
;;; 
;;; Two functions are included in this file:
;;; 
;;; (acet-ql-Set)
;;; Returns an association list containing the current QLEADER settings from the
;;; Named Object Dictionary.
;;; 
;;; (acet-ql-get <alist>)
;;; Sets the specified values for QLEADER settings from the given association
;;; list.
;;; Returns an association list containing the new values.
;;; 
;;; These functions can be used to examine the current QLEADER settings, or to
;;; initialize the setting before using the QLEADER command.
;;; For example, to use splined leaders and framed text:
;;; 
;;; (acet-ql-set '((65 . 1)(72 . 1)))
;;; 
;;; Both functions use the following group codes to identify QLEADER settings:
;;; 
;;;  3: user arrowhead block name (default="")
;;;  40: default text width (default=0.0)
;;;  60: annotation type (default=0)
;;;      0=MText
;;;      1=copy object
;;;      2=Tolerance
;;;      3=block
;;;      4=none
;;;  61: annotation reuse (default=0)
;;;      0=none
;;;      1=reuse next
;;;  62: left attachment point (default=1)
;;;  63: right attachment point (default=3)
;;;      0=Top of top line
;;;      1=Middle of top line
;;;      2=Middle of multiline text
;;;      3=Middle of bottom line
;;;      4=Bottom of bottom line
;;;  64: underline bottom line (default=0)
;;;  65: use splined leader line (default=0)
;;;  66: no limit on points (default=0)
;;;  67: maximum number of points (default=3)
;;;  68: prompt for MText width (word wrap) (default=1)
;;;  69: always left justify (default=0)
;;;  70: allowed angle, first segment (default=0)
;;;  71: allowed angle, second segment (default=0)
;;;      0=Any angle
;;;      1=Horizontal
;;;      2=90deg
;;;      3=45deg
;;;      4=30deg
;;;      5=15deg
;;;  72: frame text (default=0)
;;; 170: active tab (default=0)
;;;      0=Annotation
;;;      1=Leader Line & Arrow
;;;      2=Attachment
;;; 340: object ID for annotation reuse
;;; 
;;; |;

acad-push-dbmod
(defun acet-ql-get  (/ xr cod itm reply)
 (if (setq xr (dictsearch (namedobjdict) "AcadDim"))
   (progn
     (foreach cod  '(3 40 60 61 62 63 64 65 66 67 68 69 70 71 72 170 340)
       (if (setq itm (assoc cod xr))
         (setq reply (append reply (list itm)))))
     reply)
   '((3 . "none")
     (40 . 0.0)
     (60 . 0)
     (61 . 1)
     (62 . 1)
     (63 . 3)
     (64 . 0)
     (65 . 0)
     (66 . 0)
     (67 . 3)
     (68 . 1)
     (69 . 0)
     (70 . 0)
     (71 . 0)
     (72 . 0)
     (170 . 0))))

(defun acet-ql-set  (arg / cur prm)
 ;;  fetch current
 (setq cur (acet-ql-get))

 ;;  override per argument
 (while arg
   (setq prm (car arg)
         arg (cdr arg)
         cur (subst prm (assoc (car prm) cur) cur))
   ;;  handle DIMLDRBLK
   (if (= 3 (car prm))
     (setvar "DIMLDRBLK" (cdr prm))))

 ;;  put back
 (dictremove (namedobjdict) "AcadDim")
 (setq cur (append '((0 . "XRECORD") (100 . "AcDbXrecord") (90 . 990106))
                   cur))
 (dictadd (namedobjdict) "AcadDim" (entmakex cur))

 (acet-ql-get))


;Example Usage

(acet-ql-set
   '((3 . "_Open30")
     (40 . 0.0)
     (60 . 4) ; No Annotation
     (61 . 0) ; No re-use
     (62 . 1)
     (63 . 3)
     (64 . 0)
     (65 . 0) ; Not splined
     (66 . 0) 
     (67 . 3) ; Three point Leader
     (68 . 0) ; No MT width prompt
     (69 . 0)
     (70 . 3) ; 45deg restriction
     (71 . 1) ; Horizontal
     (72 . 0)
     (170 . 0)))
(princ)

Link to comment
Share on other sites

  • 6 years later...

Hi Lee,

 

Sorry to bring up an old post. I was directed here by the user ReMark from my thread http://www.cadtutor.net/forum/showthread.php?97530-Quick-leader-with-DOT-arrowhead&highlight=QUICK+LEADER+DOT.

 

I have been looking over the above code you have kindly shared, and I'm trying to work out a way of utilizing it for my specific task (and I am failing miserably:( due to a poor understanding of lisp).

 

My understanding of the code is that you can change the default values of the Quickleader command at startup, is it possible to 'splice' the command to have multiple versions, which they then can be called upon from the command line or an icon??

 

E.g a quickleader command which has a 'closed filled' arrowhead and a serperate command with a 'dot' arrowhead.

 

Sorry again for digging up old bones and thanks in advanced should you come back, or anyone for that matter.

 

Buzzy.

Link to comment
Share on other sites

My advice was to create two separate lisp routines. One for each of the two different conditions you wish to satisfy. One could be named qlfilled.lsp and the other qldot.lsp.

Link to comment
Share on other sites

Apologies if I'm incorrect, but with the above suggestion i would have to load each respective lisp every time I want a Dot or Closed filled leader?

 

I was under the impression Lee's code changed the default values of the quick leader settings upon running the lisp, so therefore i would have to run one of the two separate lisps each time I want to achieve a different arrowhead block and vice versa every time?

 

The only solution I can think of is to create two lisps as suggested, then create a new quick leader command macro to run the 'dot' lisp then immediately run the QL command. This should change the default values in the background then start the quick leader command automatically. Don't even know if this is possible:o

 

Again apologies for mistakes in ready the code, my understanding is very limited, to say the least.

Link to comment
Share on other sites

Lisp routines can be automatically loaded and immediately ready for use in a couple of different ways so "no" you don't have to do load the routines every time you work on a different drawing. To execute the lisp routine you type the unique series of letters assigned in the routine. It could be something as simple as qlf and qld as long as the letter combination is not something already programmed into AutoCAD for use by a native command.

Link to comment
Share on other sites

That is true.

 

I didn't think Lee's code featured the line that can allow the lisp to be called from the command line such as: (defun C:qlf (). I am unaware of the name given to this feature, apologies.

 

Plus his lisp doesn't execute the quickleader command, as it only changes the default values, for when you manually run the quickleader command at a later date.

 

So my understanding is that if I wanted to use 'closedfilled' and 'dot' heads separately, it would be quicker for me to draw a quickleader and change the arrowhead manually in the properties, which is what i am currently doing lol

 

I think my limited understanding of lisp is too weak, and i may have to study it more in order to achieve your suggestion. Sorry for wasting your time:oops:

Link to comment
Share on other sites

You could, of course, put something like this in your ACADDOC.lsp file to automatically set your leader settings on startup:

 

I don't have the "acad-push-dbmod" in my version of "qlset.lsp" shouldn't that be in ( )?

 

That lisp needs to be used in any lisp that uses the qleader command as it's the only way it will work for other users with different settings.

 

Example:

(defun c:lead ( / *error* curlay)
(defun *Error* (msg) ; embedded defun
  (setvar "clayer" clay)
  (acet-ql-set (list(cons 67 vrtcs)))		;reset maximum # of points to previous value
  (if (/= s "Function cancelled")
    (princ (strcat "\nError: " msg))
  )
  (princ)
)
(or acet-ql-get (load "qlset.lsp"))
(setvar "cmdecho" 0)
(setq curlay (getvar "clayer"))
(if (= (tblsearch "layer" "dim") nil)(command "layer" "n" "dim" "c" 6 "" ""))  ;New not Make
(command "layer" "s" "dim" "")     ;change to "dimen" layer
(command "ortho" "off")
(setq vrtcs (cdr(assoc 67(acet-ql-get))))
(acet-ql-set '((67 . 2)))				;set maximum # of points to 2
(princ "Specify leader start point:")
(if(= 1(cdr(assoc 68(acet-ql-get)))); prompt for MText width (word wrap) (default=1)
  (command "qleader" PAUSE PAUSE "0")
  (command "qleader" PAUSE PAUSE)
)
(while (= 1 (logand 1 (getvar "cmdactive")))
  (command (getstring T "Enter Leader Text: "))
)  ;null responce exits text
(command "layerp")     ;change back to previous layer
(setvar "clayer" curlay)
(setq TextObj (entlast))
(setq EnTyp (cdr (assoc 0 (entget TextObj))))
(setq vlText (vlax-ename->vla-object TextObj))
(vlax-put-property vlText 'backgroundfill :vlax-true)  ; background mask
(acet-ql-set (list(cons 67 vrtcs)))		;reset maximum # of points to previous value
(princ)
)

Link to comment
Share on other sites

I don't have the "acad-push-dbmod" in my version of "qlset.lsp" shouldn't that be in ( )?

 

It should be, yes - note that the code is not my own, but rather an example from Autodesk. ;)

Link to comment
Share on other sites

It should be, yes - note that the code is not my own, but rather an example from Autodesk. ;)

 

Old routine that's been reposted by others many times through the years. Wish there was a link to any code that came from Autodesk, probably some gems out there.

  • Like 1
Link to comment
Share on other sites

  • 4 years later...
On 7/20/2009 at 3:42 AM, Lee Mac said:

; No Annotation (61 . 0) ; No re-use (62 . 1) (63 . 3) (64 . 0) (65 . 0) ; Not splined (66 . 0) (67 . 3) ; Three point Leader (68 . 0

 

Edited by amir0914
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...