Hello All,
I found a routine to create an MLeader Style and set "most" all of it's variables. It does all I need except the "ExtendLeaderToText" is set to "on", I don't want the leader to extend to text. How does one go about modifying this to be "off"?
I have included a dump of the VLA and the routine I use. I am calling the routine from within my all encompassing lisp file that has all of the routines I use, wherever I go. Thus the (defun yaddayaddayadda (/)
I also use the much appreciated and awesomeness that is Lee Macs code for left justifying the text of the mleader. Thanks to Lee Mac.
Thanks in advance.
(defun c:ML (/)
(INITERR)
(command ".undo" "end")
(command ".undo" "m")
(GETSPACE)
(MAKETXTSTYLE)
(MAKETXTLAYER)
(make_mleader_style "ARCH" 256 256);Mleader style name "ARCH" colors set to bylayer
(setvar "CMLEADERSTYLE" "ARCH")
(setvar "MLEADERSCALE" DIMSC)
(initcommandversion)
(command ".mleader")
(while (= (logand (getvar "CMDACTIVE") 1) 1)
(command pause)
)
;;;
(command ".undo" "end")
(RESET)
(princ)
)
(defun MAKETXTSTYLE (/)
(setvar "CMDECHO" 0)
(if (not (tblsearch "style" "Simplex"))
(command ".-style" "SIMPLEX" "simplex.shx" "0.00000000" "0.90000000" "0.00000000" "N" "N" "N")
(progn
(princ "\nText Style \"Simplex\" Already Exists... Text Style Un-Changed... ")
(setvar "textstyle" "Simplex")
)
)
)
(defun GETSPACE (/)
(if (and (equal (getvar "TILEMODE") 0)
(equal (getvar "CVPORT") 1)
)
(setq CSPACE 1);paper space
(setq CSPACE 0);model space.
)
(if (= CSPACE 1)
(setq DIMSC 1.0)
(setq DIMSC(getvar "DIMSCALE"))
)
)
(defun MAKETXTLAYER (/)
(setq DISL "TEXT")
;;;
(if (not (tblsearch "layer" DISL))
(command ".-layer" "thaw" DISL "on" DISL "unlock" DISL "make" DISL "color" "4" DISL "lt" "continuous" DISL "")
(progn
(princ (strcat "\nLayer " DISL " Already Exists... Layer Un-Changed... "))
(setvar "clayer" DISL)
)
)
)
Code:
;;;original code by VV
(defun make_mleader_style (mleaderstylename textcolor leadercolor / adoc mldrdict newldrstyle objcolor)
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq mldrdict (vla-item (vla-get-dictionaries adoc) "ACAD_MLEADERSTYLE"))
(setq newldrstyle (vlax-invoke mldrdict 'addobject mleaderstylename "AcDbMLeaderStyle"))
(setq objcolor (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AutoCAD.AcCmColor."(substr (getvar "acadver") 1 2))))
(vla-put-colorindex objcolor textcolor)
(vla-put-textcolor newldrstyle objcolor)
(vla-put-colorindex objcolor leadercolor)
(vla-put-leaderlinecolor newldrstyle objcolor)
(foreach item
(list
'("AlignSpace" 4)
'("BitFlags" 0)
'("ArrowSize" 0.1250);Arrowhead Size
'("BlockConnectionType" 1)
'("BlockRotation" 0.0)
'("BlockScale" 1.0)
'("BreakSize" 0.06250);Break Size
'("ContentType" 2);Multileader Type, Mtext
'("Description" "Arch")
'("DoglegLength" 0.1250);Landing Distance
'("DrawLeaderOrderType" 0)
'("DrawMLeaderOrderType" 1)
'("EnableBlockRotation" -1)
'("EnableBlockScale" -1)
'("EnableDogleg" -1)
'("EnableFrameText" 0)
'("EnableLanding" -1)
'("ExtendLeaderToText" -1)
'("FirstSegmentAngleConstraint" 0)
'("LandingGap" 0.06250)
'("LeaderLineType" 1);Bylayer
'("LeaderLineTypeId" "ByLayer")
'("LeaderLineWeight" -1);Bylayer
'("MaxLeaderSegmentsPoints" 2)
'("ScaleFactor" 1.0)
'("SecondSegmentAngleConstraint" 0)
'("TextAlignmentType" 0)
'("TextAngleType" 1);Keep horizontal
'("TextHeight" 0.1250);Text Height
'("TextLeftAttachmentType" 1);Middle of Top Line
'("TextRightAttachmentType" 1);Middle of Top Line
'("TextString" "")
'("TextStyle" "SIMPLEX")
);_ end of list
(vlax-put newldrstyle (car item) (cadr item))
) ;_ end of foreach
newldrstyle
(MLSLEFT)
) ;_ end of defun
;;; The following code is from Lee Mac to resolve the issue with "Always Left Justify Mleader Text"
;;;
(defun MLSLEFT ( / dic itm )
(if (setq dic (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))))
(while (setq itm (dictnext dic (null itm)))
(entmod (subst '(297 . 1) (assoc 297 itm) itm))
)
)
(princ)
)
----
MultiLeader Dump
Select object: ; IAcadMLeader2: AutoCAD Multi-Leader Interface
; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140d0a1d8>
; ArrowheadBlock = ""
; ArrowheadSize = 0.125
; ArrowheadType = 0
; BlockConnectionType = 1
; BlockScale = 1.0
; ContentBlockName = ""
; ContentBlockType = 6
; ContentType = 2
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000003cb3a770>
; DogLegged = -1
; DoglegLength = 0.125
; EntityTransparency = "ByLayer"
; Handle (RO) = "2E2"
; HasExtensionDictionary (RO) = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000031515f98>
; LandingGap = 0.0625
; Layer = "MT"
; LeaderCount (RO) = 1
; LeaderLineColor = #<VLA-OBJECT IAcadAcCmColor 0000000031515390>
; LeaderLinetype = "ByLayer"
; LeaderLineWeight = -1
; LeaderType = 1
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; ObjectID (RO) = 44
; ObjectID32 (RO) = 44
; ObjectName (RO) = "AcDbMLeader"
; OwnerID (RO) = 43
; OwnerID32 (RO) = 43
; PlotStyleName = "ByLayer"
; ScaleFactor = 1.0
; StyleName = "ARCH"
; TextAttachmentDirection = 0
; TextBackgroundFill = 0
; TextBottomAttachmentType = 0
; TextDirection = 5
; TextFrameDisplay = 0
; TextHeight = 0.125
; TextJustify = 1
; TextLeftAttachmentType = 1
; TextLineSpacingDistance = 0.208333
; TextLineSpacingFactor = 1.0
; TextLineSpacingStyle = 1
; TextRightAttachmentType = 1
; TextRotation = 0.0
; TextString = "ASDFADSF\\PADSFASDF\\PADSFADFAADSFASDF"
; TextStyleName = "SIMPLEX"
; TextTopAttachmentType = 0
; TextWidth = 0.0
; TrueColor = #<VLA-OBJECT IAcadAcCm
Select object:
Color 0000000031514850>
; Visible = -1