Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
dcampbellhutchinson
Posts: 56
Registered: ‎04-03-2008
Message 1 of 4 (1,321 Views)

Creating Multileader Styles in 2012 using Visual Lisp

1321 Views, 3 Replies
11-19-2011 08:23 PM

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)
)

 

Valued Contributor
dcampbellhutchinson
Posts: 56
Registered: ‎04-03-2008
Message 2 of 4 (1,186 Views)

Re: Creating Multileader Styles in 2012 using Visual Lisp

02-22-2012 07:49 PM in reply to: dcampbellhutchinson

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!

Active Member
zale-86
Posts: 8
Registered: ‎03-21-2012
Message 3 of 4 (1,126 Views)

Re: Creating Multileader Styles in 2012 using Visual Lisp

03-21-2012 11:33 AM in reply to: dcampbellhutchinson

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

Contributor
e.lucas8
Posts: 12
Registered: ‎11-21-2012
Message 4 of 4 (751 Views)

Re: Creating Multileader Styles in 2012 using Visual Lisp

02-25-2013 11:27 PM 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.