Lee Mac Posted April 27, 2009 Posted April 27, 2009 As quoted from ACAD help: AddLeader method [ActiveX and VBA Reference: AAR] AddLeader Method Creates a leader line, given the coordinates of the points. See Also | Example Signature RetVal = object.AddLeader(PointsArray, Annotation, Type) Object ModelSpace collection, PaperSpace collection, Block The object or objects this method applies to. PointsArray Variant (array of doubles); input-only The array of 3D WCS coordinates specifying the leader. You must provide at least two points to define the leader. The third point is optional. Annotation Object; input-only A Tolerance, MText, BlockRef object or NULL. Type AcLeaderType enum; input-only acLineNoArrow acLineWithArrow acSplineNoArrow acSplineWithArrow RetVal Leader object The newly created Leader object. Remarks The leader is a line that connects some annotation to a feature in a drawing. Leaders and their annotation are associative, which means if you modify the annotation, the leader updates accordingly. The annotation can be a Tolerance, Mtext, or BlockRef object. You can also create leaders that are not associated to a particular object. To do this, simply input a NULL object as the annotation. But how on earth do you specify a NULL object? I have tried: (vla-AddLeader <space> <variant> nil <type>) (vla-AddLeader <space> <variant> null <type>) (vla-AddLeader <space> <variant> (null) <type>) But I can't get anything to work - I think I am missing something here... but it is driving me up the wall... Any input would be much appreciated Thanks Lee Quote
ronjonp Posted April 27, 2009 Posted April 27, 2009 Do a search at theswamp dot org for "vla-addleader but with null value" ...I'd give you a link but I'm being blocked as a potential spammer. Quote
Lee Mac Posted April 27, 2009 Author Posted April 27, 2009 Just had a look - it says that it can't be done - you have got to add an MTEXT object, then delete it. Quote
Shawndoe Posted April 27, 2009 Posted April 27, 2009 Hi, You could try an empty quote "". I haven't tried it with vla/vlax, but its worth a shot. Just a thought, I've had that work in null/empty text strings. Have a good one. Shawndoe Quote
Lee Mac Posted April 27, 2009 Author Posted April 27, 2009 Nice idea.... but... :P ; error: lisp value has no coercion to VARIANT with this type: "" Quote
Shawndoe Posted April 27, 2009 Posted April 27, 2009 One more crack, and I'll claim ignorence on this one. I found this in a search at the Autodesk board. 'null[/Code]I think the null needs to be quoted LaterShawndoe Quote
Lee Mac Posted April 28, 2009 Author Posted April 28, 2009 Same error Shawn, but nice idea all the same. Quote
Shawndoe Posted April 28, 2009 Posted April 28, 2009 Hey, I noticed a VBA example that seems to do what you want is in the help file under "AddLeader Example". Shawndoe Quote
The Buzzard Posted April 28, 2009 Posted April 28, 2009 Lee, See if this is what your looking for. It seems to address the subject although I an not exactly sure since I do not work with Visual Lisp. http://www.afralisp.net/vl/Utilities1.htm Good Luck, The Buzzard Quote
Lee Mac Posted April 28, 2009 Author Posted April 28, 2009 Thanks for the link Buzzard, but I'm afraid that just explains the VL Getkword options. I shall see what Shawn's last suggestion has to offer Quote
Se7en Posted April 28, 2009 Posted April 28, 2009 I guess its not possible to specify a null value in vlisp. [ http://www.theswamp.org/index.php?topic=419.msg5041#msg5041 ] Quote
Lee Mac Posted April 28, 2009 Author Posted April 28, 2009 Yeah, I read that too John, thanks I can't see why they would put it in the ACAD Help file though.., Cheers Lee Quote
Se7en Posted April 28, 2009 Posted April 28, 2009 I think 'cause the help files are written for vb. Quote
Lee Mac Posted April 28, 2009 Author Posted April 28, 2009 Oh right - thanks. Just to add to this thread though - I did find a work around in the form of this LISP which alters the dictionary entry for the leader object (may be useful): [i][color=#990099];;; qlset.lsp - example initialization of QLEADER settings[/color][/i] [i][color=#990099];;; Frank Whaley, Autodesk[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; Two functions are included in this file:[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; (acet-ql-Set)[/color][/i] [i][color=#990099];;; Returns an association list containing the current QLEADER settings from the[/color][/i] [i][color=#990099];;; Named Object Dictionary.[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; (acet-ql-get <alist>)[/color][/i] [i][color=#990099];;; Sets the specified values for QLEADER settings from the given association[/color][/i] [i][color=#990099];;; list.[/color][/i] [i][color=#990099];;; Returns an association list containing the new values.[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; These functions can be used to examine the current QLEADER settings, or to[/color][/i] [i][color=#990099];;; initialize the setting before using the QLEADER command.[/color][/i] [i][color=#990099];;; For example, to use splined leaders and framed text:[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; (acet-ql-set '((65 . 1)(72 . 1)))[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; Both functions use the following group codes to identify QLEADER settings:[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; 3: user arrowhead block name (default="")[/color][/i] [i][color=#990099];;; 40: default text width (default=0.0)[/color][/i] [i][color=#990099];;; 60: annotation type (default=0)[/color][/i] [i][color=#990099];;; 0=MText[/color][/i] [i][color=#990099];;; 1=copy object[/color][/i] [i][color=#990099];;; 2=Tolerance[/color][/i] [i][color=#990099];;; 3=block[/color][/i] [i][color=#990099];;; 4=none[/color][/i] [i][color=#990099];;; 61: annotation reuse (default=0)[/color][/i] [i][color=#990099];;; 0=none[/color][/i] [i][color=#990099];;; 1=reuse next[/color][/i] [i][color=#990099];;; 62: left attachment point (default=1)[/color][/i] [i][color=#990099];;; 63: right attachment point (default=3)[/color][/i] [i][color=#990099];;; 0=Top of top line[/color][/i] [i][color=#990099];;; 1=Middle of top line[/color][/i] [i][color=#990099];;; 2=Middle of multiline text[/color][/i] [i][color=#990099];;; 3=Middle of bottom line[/color][/i] [i][color=#990099];;; 4=Bottom of bottom line[/color][/i] [i][color=#990099];;; 64: underline bottom line (default=0)[/color][/i] [i][color=#990099];;; 65: use splined leader line (default=0)[/color][/i] [i][color=#990099];;; 66: no limit on points (default=0)[/color][/i] [i][color=#990099];;; 67: maximum number of points (default=3)[/color][/i] [i][color=#990099];;; 68: prompt for MText width (word wrap) (default=1)[/color][/i] [i][color=#990099];;; 69: always left justify (default=0)[/color][/i] [i][color=#990099];;; 70: allowed angle, first segment (default=0)[/color][/i] [i][color=#990099];;; 71: allowed angle, second segment (default=0)[/color][/i] [i][color=#990099];;; 0=Any angle[/color][/i] [i][color=#990099];;; 1=Horizontal[/color][/i] [i][color=#990099];;; 2=90deg[/color][/i] [i][color=#990099];;; 3=45deg[/color][/i] [i][color=#990099];;; 4=30deg[/color][/i] [i][color=#990099];;; 5=15deg[/color][/i] [i][color=#990099];;; 72: frame text (default=0)[/color][/i] [i][color=#990099];;; 170: active tab (default=0)[/color][/i] [i][color=#990099];;; 0=Annotation[/color][/i] [i][color=#990099];;; 1=Leader Line & Arrow[/color][/i] [i][color=#990099];;; 2=Attachment[/color][/i] [i][color=#990099];;; 340: object ID for annotation reuse[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; |;[/color][/i] [b][color=Blue]acad-push-dbmod[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] acet-ql-get [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] xr cod itm reply[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] xr [b][color=RED]([/color][/b][b][color=BLUE]dictsearch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]namedobjdict[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"AcadDim"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] cod [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]3[/color][/b] [b][color=#009900]40[/color][/b] [b][color=#009900]60[/color][/b] [b][color=#009900]61[/color][/b] [b][color=#009900]62[/color][/b] [b][color=#009900]63[/color][/b] [b][color=#009900]64[/color][/b] [b][color=#009900]65[/color][/b] [b][color=#009900]66[/color][/b] [b][color=#009900]67[/color][/b] [b][color=#009900]68[/color][/b] [b][color=#009900]69[/color][/b] [b][color=#009900]70[/color][/b] [b][color=#009900]71[/color][/b] [b][color=#009900]72[/color][/b] [b][color=#009900]170[/color][/b] [b][color=#009900]340[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] itm [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] cod xr[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] reply [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b] reply [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] itm[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] reply[b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]3[/color][/b] . [b][color=#ff00ff]""[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]40[/color][/b] . [b][color=#009999]0.0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]60[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]61[/color][/b] . [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]62[/color][/b] . [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]63[/color][/b] . [b][color=#009900]3[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]64[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]65[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]66[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]67[/color][/b] . [b][color=#009900]3[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]68[/color][/b] . [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]69[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]70[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]71[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]72[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]170[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] acet-ql-set [b][color=RED]([/color][/b]arg [b][color=BLUE]/[/color][/b] cur prm[b][color=RED])[/color][/b] [i][color=#990099];; fetch current[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cur [b][color=RED]([/color][/b]acet-ql-get[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; override per argument[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] arg [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] prm [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] arg[b][color=RED])[/color][/b] arg [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] arg[b][color=RED])[/color][/b] cur [b][color=RED]([/color][/b][b][color=BLUE]subst[/color][/b] prm [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] prm[b][color=RED])[/color][/b] cur[b][color=RED])[/color][/b] cur[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; handle DIMLDRBLK[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]=[/color][/b] [b][color=#009900]3[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] prm[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"DIMLDRBLK"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] prm[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; put back[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]dictremove[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]namedobjdict[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"AcadDim"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cur [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#ff00ff]"XRECORD"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]100[/color][/b] . [b][color=#ff00ff]"AcDbXrecord"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]90[/color][/b] . [b][color=#009900]990106[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] cur[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]dictadd[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]namedobjdict[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"AcadDim"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entmakex[/color][/b] cur[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]acet-ql-get[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; load quietly[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b] Quote
VovKa Posted April 28, 2009 Posted April 28, 2009 (entmake (list (cons 0 "LEADER") (cons 100 "AcDbEntity") (cons 100 "AcDbLeader") (cons 71 1) (cons 72 0) (cons 73 3) (cons 74 0) (cons 75 0) (cons 10 (getpoint)) (cons 10 (getpoint)) (list -3 (list "ACAD" (cons 1000 "DSTYLE") (cons 1002 "{") (cons 1070 41) (cons 1040 2.5) (cons 1002 "}") ) ) ) ) Quote
Shawndoe Posted April 28, 2009 Posted April 28, 2009 Hi, That's Sweet VovKa Have a good one. Shawndoe Quote
wizman Posted April 28, 2009 Posted April 28, 2009 no luck also here, vovka's solution could be the best work around but it seems releasing an object sets a vla-object to nothing Quote
VovKa Posted April 28, 2009 Posted April 28, 2009 i forgot about arrowsize. so i updated my previous post. as for null value in vlisp - there's :vlax-null, but it will not work here either Quote
Se7en Posted April 28, 2009 Posted April 28, 2009 VovKa, there is also a "vlax-vbnull" as well but it also doesn't work. wizman, i dont follow your releasing comment. Quote
Recommended Posts
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.