Create mleader and set arrowhead to Dot blank

Create mleader and set arrowhead to Dot blank

spykat
Advocate Advocate
529 Views
10 Replies
Message 1 of 11

Create mleader and set arrowhead to Dot blank

spykat
Advocate
Advocate

I want to be able to create a multileader style if it doesn't exist in a drawing. I found this;

 

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

and it works, except I want to set the arrow head to Dot blank and I cannot figure out how to do it. Any help would be appreciated.
0 Likes
Accepted solutions (1)
530 Views
10 Replies
Replies (10)
Message 2 of 11

Moshe-A
Mentor
Mentor
Accepted solution

@spykat hi,

 

add this line

 

(vlax-put-property mls 'ArrowSymbol "_DotBlank")

 

Moshe

 

 

0 Likes
Message 3 of 11

spykat
Advocate
Advocate

Thank you very much. I was looking at ArrowHead since that's what it's called in the Properties pallet.

0 Likes
Message 4 of 11

Moshe-A
Mentor
Mentor

@spykat ,

 

i looked in ActiveX Reference Guide 😀

but why use lisp to create a mleader style when MLEADRSTYLE command can do it better?

 

Moshe

 

0 Likes
Message 5 of 11

spykat
Advocate
Advocate

Lisp is what I know best, so that's just my default way of doing things

0 Likes
Message 6 of 11

Moshe-A
Mentor
Mentor

you are going the hard way 😀

0 Likes
Message 7 of 11

spykat
Advocate
Advocate

I've had others in my own office tell me that, but yet I have created programs that can do things that they can not recreate in VBA, or the way they have to do it is more cumbersome and less user friendly. And there are some things they can do easier.

0 Likes
Message 8 of 11

Moshe-A
Mentor
Mentor

@spykat ,

 

let's conclude this with ... the better you'll know AutoCad the better you'll write lisp programs 😀

 

 

0 Likes
Message 9 of 11

spykat
Advocate
Advocate

I can agree with that. It was nice chatting with you and thank you for the help.

0 Likes
Message 10 of 11

chielspaans
Community Visitor
Community Visitor

Why do i get an autmation error from the following line:

(setq co (vla-getinterfaceobject (vlax-get-acad-object) "AcadAcCmColor"))

 Automation Error. Problem in loading application

0 Likes
Message 11 of 11

spykat
Advocate
Advocate

I don't know who, or why they did it but whoever started this post is not spykat! This is and has been my account ever since this forum opened. Whoever is posting from my account, please stop.

0 Likes