Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating Multileader Styles in 2012 using Visual Lisp

3 REPLIES 3
Reply
Message 1 of 4
dcampbellhutchinson
2301 Views, 3 Replies

Creating Multileader Styles in 2012 using Visual Lisp

Hello All,

 

I've been working on parts of a lisp to set up drawings with our standard basic styles and I'm now working on the multileader style part.

 

I've pieced together a couple of pieces from some other routines I've seen out there along with some other things I wanted to add, but for some reason it acts like it just skips over the important part and creates the style name and thats it.

 

Also if anyone  knows the properties to "always left justify" and "extend leader to text" that would be much appreciated.

 

I've been trying all kinds of things to get this to work so any input is appreciated.

 

Thanks in Advance!

 

(defun c:test (/ ds dsnm tts ts mlsn result dict doc mlsdict mls tc lc co)
(vl-load-com)

  (setq ds (getvar "dimscale"))	     ;Get Dimscale
  (setq dsnm (rtos ds 2 0))	             ;Turns Dimscale into String for MLeaderStyle Name
  (setq tts (getvar "textsize")) 	     ;Retrieve Current Text Height
  (setq ts (/ tts ds))		;Divides the Current Text Height By the Dimscale to get the plotted text height

  (setq mlsn (strcat "CEI - " dsnm " Arrow"))		;Creates MLeaderStyle CEI [dimscale] Arrow

   (setq result "NO")
(if (setq dict (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))	;Checks to see if MLeaderStyle exists
   (foreach x dict (if (and (= (car x) 3) (eq (strcase (cdr x)) (strcase mlsn)))
   (setq result "YES"))))

(if (= result "NO")(progn
   (setq doc (vla-get-activedocument (vlax-get-acad-object)))
   (setq mlsdict (vla-item (vla-get-dictionaries doc) "ACAD_MLEADERSTYLE"))
   (setq mls (vlax-invoke mlsdict 'addobject mlsn "AcDbMLeaderStyle"))
   (setq tc 2) 
   (setq lc 1)
   (setq co (vla-getinterfaceobject (vlax-get-acad-object) "AcadAcCmColor"))

	(vla-put-ColorIndex co tc)
	(vla-put-TextColor mls co)
	(vla-put-ColorIndex co lc)
	(vla-put-LeaderLineColor mls co)
	(vlax-put-property mls 'AlignSpace 0.18)
	(vlax-put-property mls 'Annotative 0)
	(vlax-put-property mls 'ArrowSize 0.125)
	(vlax-put-property mls 'BlockConnectionType 0)
	(vlax-put-property mls 'BlockRotation 0.0)
	(vlax-put-property mls 'BlockScale 1.0)
	(vlax-put-property mls 'BreakSize 0.0625)
	(vlax-put-property mls 'ContentType 2)
	(vlax-put-property mls 'Description mlsn)
	(vlax-put-property mls 'DoglegLength 6.0)
	(vlax-put-property mls 'DrawLeaderOrderType 0)
	(vlax-put-property mls 'DrawMLeaderOrderType 1)
	(vlax-put-property mls 'EnableBlockRotation -1)
	(vlax-put-property mls 'EnableBlockScale -1)
	(vlax-put-property mls 'EnableDogleg -1)
	(vlax-put-property mls 'EnableFrameText 0)
	(vlax-put-property mls 'EnableLanding -1)
	(vlax-put-property mls 'FirstSegmentAngleConstraint 0)
	(vlax-put-property mls 'LandingGap 0.0625)
	(vlax-put-property mls 'LeaderLineType 1)
	(vlax-put-property mls 'LeaderLineTypeId "Continuous")
	(vlax-put-property mls 'LeaderLineWeight -1)
	(vlax-put-property mls 'MaxLeaderSegmentsPoints 9)
	(vlax-put-property mls 'name mlsn)
	(vlax-put-property mls 'ScaleFactor ds)
	(vlax-put-property mls 'SecondSegmentAngleConstraint 0)
	(vlax-put-property mls 'TextAlignmentType 1)
	(vlax-put-property mls 'TextAngleType 1)
	(vlax-put-property mls 'TextHeight ts)
	(vlax-put-property mls 'TextLeftAttachmentType 1)
	(vlax-put-property mls 'TextRightAttachmentType 1)
	(vlax-put-property mls 'TextString "")
	(vlax-put-property mls 'TextStyle "ROMANS")))

(command "._cmleaderstyle" mlsn)
)

 

3 REPLIES 3
Message 2 of 4

So I've managed to find and fix a few of my errors and I'm able to spit out a multileader style finally.

 

Has anyone found if there is an activex property for the "always left justify" or even the new box for "extend leader to text" yet?  Right now thankfully the second is defaulted as checked, but if Autodesk decides to change defaults it would be nice to ensure that works still in the upcoming releases...or until I take the time to learn .net.

 

Thanks in Advance!

Message 3 of 4

Would you care to share your result? I'm working on the same thing!
Thanks in advance

Message 4 of 4
e.lucas8
in reply to: zale-86

I olso would like to see your result!

I'm olso working on the same thing!

 

Thank you.

E.F. Lucas

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost