Need Help Creating MLeader Style Arrowhead Type

Need Help Creating MLeader Style Arrowhead Type

mgorecki
Collaborator Collaborator
58 Views
2 Replies
Message 1 of 3

Need Help Creating MLeader Style Arrowhead Type

mgorecki
Collaborator
Collaborator

Hello,

I have been trying to create 2 MLeader styles.  They're very similar except their arrowheads are different.  The first is the standard "_closed_filled", and the second would use the "_dot".

No matter what I try, it causes an error.

I've tried using vla-put-ArrowheadType, vla-put-ArrowheadBlock, and vla-put-ArrowheadStyle, but none of these will work.

 

(defun CreateMLeaderStyle (dwg_scale / CMS_MLeaderStyles newMleaderStyle CMS_ColorObject)
 (setq mlCounter 0)
 (while (< mlCounter 2)
  (if (= mlCounter 0) (setq newMlStyleName "Test"))
  (if (= mlCounter 1) (setq newMlStyleName "Test_Dot"))
  (if (tblsearch "STYLE" "ROMANS")
   (progn
    (setq CMS_MLeaderStyles (vla-item (vla-get-Dictionaries (vla-get-ActiveDocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list CMS_MLeaderStyles newMlStyleName)))
     (progn
      (setq newMleaderStyle (vla-AddObject CMS_MLeaderStyles newMlStyleName "AcDbMLeaderStyle"))
      (if (= mlCounter 0)
       (progn
	(vla-put-ArrowSymbol newMleaderStyle "_closed_filled")
	;(vla-put-ArrowheadType newMleaderStyle "_closed_filled")
        (vla-put-ArrowSize newMleaderStyle 4.40)
       )
      )
      (if (= mlCounter 1)
       (progn
	(vla-put-ArrowSymbol newMleaderStyle acMLeaderArrowheadDot)
	;(vla-put-ArrowheadBlock newMleaderStyle 3)
        (vla-put-ArrowSize newMleaderStyle 1.5)
       )
      )
      (vla-put-MaxLeaderSegmentsPoints newMleaderStyle 2)
      (vla-put-EnableDogleg newMleaderStyle 1)
      (vla-put-DogLegLength newMleaderStyle 5.0) ;Landing length
      (vla-put-ScaleFactor newMleaderStyle dwg_scale)
      (vla-put-TextStyle newMleaderStyle "ROMANS")
      (vla-put-TextAngleType newMleaderStyle 1)
      (vla-put-TextBottomAttachmentType newMleaderStyle 0) ;Middle
      (vla-put-TextHeight newMleaderStyle 2.20)
      (vla-put-TextLeftAttachmentType newMleaderStyle 1) ;Middle
      (vla-put-TextRightAttachmentType newMleaderStyle 1) ;Middle
      (vla-put-TextTopAttachmentType newMleaderStyle 0) ;Middle
      (vla-put-LandingGap newMleaderStyle 1.0)
     )
     (princ "\n ** Error: MLeader style already exists")
    )
   )
   (princ "\n ** Error: textstyle does not exist")
  )
  (setq mlCounter (+ mlCounter 1))
 ) ;ends while
 (setvar "cmleaderstyle" "Test")
 (princ)
)

 

I get these:

error: ActiveX Server returned an error: Parameter not optional

error: ActiveX Server returned the error: unknown name: ArrowheadType

error: ActiveX Server returned the error: unknown name: ArrowheadBlock

 

Thanks in advance for any help.

 

0 Likes
59 Views
2 Replies
Replies (2)
Message 2 of 3

mgorecki
Collaborator
Collaborator

Also, I'm using AutoCAD Mechanical 2024 (Vanilla)

0 Likes
Message 3 of 3

komondormrex
Mentor
Mentor

hey,

i think you need not to assign arrow block when it is "_closed_filled" as it is a default arrow block for newly created mleader style, while "_Dot" block should be defined at the moment of creating a style with it.

0 Likes