Author Topic: Mleader Arrow Size  (Read 7716 times)

0 Members and 1 Guest are viewing this topic.

ChrisCarlson

  • Guest
Mleader Arrow Size
« on: October 01, 2014, 02:46:29 PM »
I'm trying to change the size of a mleader arrow but I'm getting an ActiveX error saying unknown name "ARROWSIZE"?

I have a hunch this ('ArrowSize) is not a valid property like the interwebs would have me believe.


Code: [Select]
(setq a (ssname (ssget "_X" '((0 . "MULTILEADER") (-4 . "<NOT") (290 . 1) (-4 . "NOT>"))) 0))
(setq a (vlax-ename->vla-object a))
(vlax-put-property a 'ArrowSize .125)

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Mleader Arrow Size
« Reply #1 on: October 01, 2014, 02:51:25 PM »
Maybe the arrowsize property is for the mleader style.
Use this to see what properties are available:
Code - Auto/Visual Lisp: [Select]
  1. (vlax-dump-object (vlax-ename->vla-object (car (entsel))) t)
*Edit

Yup..  :)
Code - Auto/Visual Lisp: [Select]
  1.   (vlax-ename->vla-object
  2.     (cdr
  3.       (assoc -1
  4.         (dictsearch (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))) "Standard")
  5.       )
  6.     )
  7.   )
  8. )
Quote
; IAcadMLeaderStyle: AutoCAD MLeaderStyle Interface
; Property values:
;   AlignSpace = 0.18
;   Annotative = 0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff71b4e9110>
;   ArrowSize = 0.18
;   ArrowSymbol = ""
;   BitFlags = 0
;   Block = ""
;   BlockColor = #<VLA-OBJECT IAcadAcCmColor 0000002da20a3650>
;   BlockConnectionType = 0
;   BlockRotation = 0.0
;   BlockScale = 1.0
;   BreakSize = 0.125
;   ContentType = 2
;   Description = "Standard"
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0000002d9266b0c8>
;   DoglegLength = 0.36
;   DrawLeaderOrderType = 0
;   DrawMLeaderOrderType = 1
;   EnableBlockRotation = -1
;   EnableBlockScale = -1
;   EnableDogleg = -1
;   EnableFrameText = 0
;   EnableLanding = -1
;   FirstSegmentAngleConstraint = 0
;   Handle (RO) = "67"
;   HasExtensionDictionary (RO) = 0
;   LandingGap = 0.09
;   LeaderLineColor = #<VLA-OBJECT IAcadAcCmColor 0000002da20a36b0>
;   LeaderLinetype = 1
;   LeaderLineTypeId = "ByBlock"
;   LeaderLineWeight = -2
;   MaxLeaderSegmentsPoints = 2
;   Name = "Standard"
;   ObjectID (RO) = 2483
;   ObjectName (RO) = "AcDbMLeaderStyle"
;   OverwritePropChanged (RO) = 0
;   OwnerID (RO) = 2484
;   ScaleFactor = 1.0
;   SecondSegmentAngleConstraint = 0
;   TextAlignmentType = 0
;   TextAngleType = 1
;   TextAttachmentDirection = 0
;   TextBottomAttachmentType = 0
;   TextColor = #<VLA-OBJECT IAcadAcCmColor 0000002da20a25d0>
;   TextHeight = 0.18
;   TextLeftAttachmentType = 1
;   TextRightAttachmentType = 3
;   TextString = ""
;   TextStyle = "Standard"
;   TextTopAttachmentType = 0

« Last Edit: October 01, 2014, 02:56:24 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ChrisCarlson

  • Guest
Re: Mleader Arrow Size
« Reply #2 on: October 01, 2014, 02:56:41 PM »
doh!

'ArrowheadSize

Forgot about dumping the object, thanks

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Mleader Arrow Size
« Reply #3 on: October 01, 2014, 02:59:38 PM »
Glad to help  :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Mleader Arrow Size
« Reply #4 on: October 06, 2014, 01:15:59 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

tedg

  • Swamp Rat
  • Posts: 811
Mleader Arrow Type
« Reply #5 on: October 07, 2016, 08:51:16 AM »
I have a similar question so I didn't want to start a new thread...


I have a routine I got a LOT of help with many years back called "Flip Arrows" which basically toggles through arrow types on a leader.
It works great, but I've recently been using MLEADERS most of the time, and I would like a routine that toggles through arrow types for MLEADERS.


I couldn't find anything out there that does this, and I don't know anything about the structure of MLEADERS to make it work.


Here is the Flip Arrows for a standard Leader:
Code: [Select]

(defun c:FA ;| FlipArrows |; (/ Ent VlaObj )
  (vl-load-com)
  (while (setq Ent (entsel "Select leader: " ) )
    (progn
      (vl-load-com )
      (setq VlaObj (vlax-ename->vla-object (car Ent )) )
      (if (= (vla-get-objectName VlaObj ) "AcDbLeader")
        (cond
          ((= (vla-get-ArrowheadBlock VlaObj ) "" ) (vla-put-ArrowheadBlock VlaObj "Integral" ) )
          ((= (vla-get-ArrowheadBlock VlaObj ) "Integral" ) (vla-put-ArrowheadBlock VlaObj "DotBlank" ) )
     ((= (vla-get-ArrowheadBlock VlaObj ) "DotBlank" ) (vla-put-ArrowheadBlock VlaObj "Dot" ) )
     ((= (vla-get-ArrowheadBlock VlaObj ) "Dot" ) (vla-put-ArrowheadBlock VlaObj "DotSmall" ) )
          ((= (vla-get-ArrowheadBlock VlaObj ) "DotSmall" ) (vla-put-ArrowheadBlock VlaObj "" ) )
          (t nil)
        )
        (princ "..wrong object type ! " )
      )
      (if (not (vlax-object-released-p VlaObj )) (vlax-release-object VlaObj ) ( ) )
    )
  )
  (princ)
)


And my poor attempt to modify it to work with Mleaders:
Code: [Select]

(defun c:FOO ;| FlipArrows |; (/ Ent VlaObj )
  (vl-load-com)
  (while (setq Ent (entsel "Select mleader: " ) )
    (progn
      (vl-load-com )
      (setq VlaObj (vlax-ename->vla-object (car Ent )) )
      (if (= (vla-get-objectName VlaObj ) "AcDbMLeader")
        (cond
          ((= (vla-get-Block VlaObj ) "" ) (vla-put-Block VlaObj "Integral" ) )
          ((= (vla-get-Block VlaObj ) "Integral" ) (vla-put-Block VlaObj "DotBlank" ) )
     ((= (vla-get-Block VlaObj ) "DotBlank" ) (vla-put-Block VlaObj "Dot" ) )
     ((= (vla-get-Block VlaObj ) "Dot" ) (vla-put-Block VlaObj "DotSmall" ) )
          ((= (vla-get-Block VlaObj ) "DotSmall" ) (vla-put-Block VlaObj "" ) )
          (t nil)
        )
        (princ "..wrong object type ! " )
      )
      (if (not (vlax-object-released-p VlaObj )) (vlax-release-object VlaObj ) ( ) )
    )
  )
  (princ)
)
« Last Edit: October 11, 2016, 11:51:03 AM by tedg »
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023

ribarm

  • Gator
  • Posts: 3304
  • Marko Ribar, architect
Re: Mleader Arrow Size
« Reply #6 on: October 07, 2016, 09:47:55 AM »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Mleader Arrow Size
« Reply #7 on: October 07, 2016, 12:05:11 PM »
Give this a try:
Code - Auto/Visual Lisp: [Select]
  1. ;; RJP 10.7.2016
  2. (defun c:fa ;| FlipArrows |;   (/ a b e l o on)
  3.   (while (setq e (entsel "Select Leader: "))
  4.     (setq o (vlax-ename->vla-object (car e)))
  5.     (if (and (wcmatch (setq on (vla-get-objectname o)) "AcDbLeader,AcDbMLeader")
  6.              (setq b (vla-get-arrowheadblock o))
  7.              (setq a
  8.                     (vl-some (function
  9.                                (lambda (x)
  10.                                  (if (or (wcmatch x (strcat "*" b)) (wcmatch (strcat "_" x) (strcat "*" b)))
  11.                                    (cadr (member x l))
  12.                                  )
  13.                                )
  14.                              )
  15.                              (setq l '("" "Integral" "DotBlank" "Dot" "DotSmall" ""))
  16.                     )
  17.              )
  18.         )
  19.         o
  20.         ;; Mleader does not like it when you set the arrow to "" ... regular leader is fine?
  21.         (cond ((= on "AcDbMLeader")
  22.                (if (= "" a)
  23.                  "_Integral"
  24.                  (strcat "_" a)
  25.                )
  26.               )
  27.               (a)
  28.         )
  29.       )
  30.     )
  31.   )
  32.   (princ)
  33. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tedg

  • Swamp Rat
  • Posts: 811
Re: Mleader Arrow Size
« Reply #8 on: October 07, 2016, 01:28:36 PM »
Give this a try:
.....


Thanks man that's great! Thank you.
Way better than what I was trying to do.


It doesn't seem to go back to the dimblk "ClosedFilled"..
Which is ok because it starts out with that anyway.



I tried playing around with it (tried adding that dimblk option in but it doesn't recognize it)?
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Mleader Arrow Size
« Reply #9 on: October 07, 2016, 01:34:04 PM »
Another attempt:
Code - Auto/Visual Lisp: [Select]
  1. ;; MLeader Arrowhead Toggle  -  Lee Mac
  2.  
  3. (defun c:mlat ( / def lst obj )
  4.     (while (setq def (tblnext "block" (not def)))
  5.         (if (wcmatch (cdr (assoc 2 def)) "_*")
  6.             (setq lst (cons (cdr (assoc 2 def)) lst))
  7.         )
  8.     )
  9.     (cond
  10.         (   (null lst)
  11.             (princ "\nNo arrowhead blocks available.")
  12.         )
  13.         (   (setq obj (LM:selectifobject "\nSelect mleader: " "MULTILEADER"))
  14.             (setq obj (vlax-ename->vla-object obj))
  15.             (princ "\n[TAB] through arrowhead blocks <exit>: ")
  16.             (while (and (= 2 (car (setq grr (grread nil 2)))) (= 9 (cadr grr)))
  17.                 (vla-put-arrowheadblock obj (nth (rem (1+ (vl-position (vla-get-arrowheadblock obj) lst)) (length lst)) lst))
  18.             )
  19.         )
  20.     )
  21.     (princ)
  22. )
  23.  
  24. ;; Select if Object  -  Lee Mac
  25. ;; Continuously prompts the user for a selection of a specific object type
  26.  
  27. (defun LM:selectifobject ( msg typ / ent )
  28.     (while
  29.         (progn (setvar 'errno 0) (setq ent (car (entsel msg)))
  30.             (cond
  31.                 (   (= 7 (getvar 'errno))
  32.                     (princ "\nMissed, try again.")
  33.                 )
  34.                 (   (null ent) nil)
  35.                 (   (not (wcmatch (cdr (assoc 0 (entget ent))) typ))
  36.                     (princ "\nInvalid object selected.")
  37.                 )
  38.             )
  39.         )
  40.     )
  41.     ent
  42. )
  43.  

Though I've found that MLeader Arrowhead blocks are only defined when used in a drawing - does anyone know a method to force the arrowhead block definition to be generated/imported?

tedg

  • Swamp Rat
  • Posts: 811
Re: Mleader Arrow Size
« Reply #10 on: October 07, 2016, 01:42:05 PM »
..

Though I've found that MLeader Arrowhead blocks are only defined when used in a drawing - does anyone know a method to force the arrowhead block definition to be generated/imported?


Thanks Lee, giving this a whirl too, not sure how to [tab] once I select the Mleader.. it sort of cancels it out?
I know what you mean about the arrowhead block... I'm trying this in a drawing that has Mleaders with arrowheads too.
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Mleader Arrow Size
« Reply #11 on: October 07, 2016, 03:08:59 PM »
Give this a try:
.....
...
It doesn't seem to go back to the dimblk "ClosedFilled"..
Which is ok because it starts out with that anyway.

...
Give this version a try:
Code - Auto/Visual Lisp: [Select]
  1. ;; RJP 10.7.2016
  2. (defun c:fa ;| FlipArrows |;   (/ a b e l o on)
  3.   (while (setq e (car (entsel "Select Leader: ")))
  4.     (setq o (vlax-ename->vla-object e))
  5.     (if (and (wcmatch (setq on (vla-get-objectname o)) "AcDbLeader,AcDbMLeader")
  6.              (setq b (vla-get-arrowheadblock o))
  7.              (setq a
  8.                     (vl-some (function
  9.                                (lambda (x)
  10.                                  (if (or (wcmatch x (strcat "*" b)) (wcmatch (strcat "_" x) (strcat "*" b)))
  11.                                    (cadr (member x l))
  12.                                  )
  13.                                )
  14.                              )
  15.                              (setq l '("" "Integral" "DotBlank" "Dot" "DotSmall" ""))
  16.                     )
  17.              )
  18.         )
  19.       (cond ((= on "AcDbMLeader")
  20.              (if (= "" a)
  21.                (entmod (vl-remove-if '(lambda (x) (= (car x) 342)) (entget e)))
  22.                (vla-put-arrowheadblock o (strcat "_" a))
  23.              )
  24.             )
  25.             ((vla-put-arrowheadblock o a))
  26.       )
  27.     )
  28.   )
  29.   (princ)
  30. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tedg

  • Swamp Rat
  • Posts: 811
Re: Mleader Arrow Size
« Reply #12 on: October 07, 2016, 03:44:29 PM »
Give this a try:
.....
...
It doesn't seem to go back to the dimblk "ClosedFilled"..
Which is ok because it starts out with that anyway.

...
Give this version a try:
..


Thanks that works great.
I appreciate the help,


(and thanks to Lee and ribarm for your input too)
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Mleader Arrow Size
« Reply #13 on: October 07, 2016, 03:47:45 PM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tedg

  • Swamp Rat
  • Posts: 811
Re: Mleader Arrow Size
« Reply #14 on: October 11, 2016, 07:00:41 AM »
Glad to help :)
Ron, thanks again for your help.


I did notice that it doesn't recognize the arrowhead blocks in Mleaders unless they've been "toggled through" on a leader first (it creates the blocks in the file).
Like they need to be inserted/created in the file for the routine to acknowledge them in an Mleader?


I think that is what Lee was mentioning:

Though I've found that MLeader Arrowhead blocks are only defined when used in a drawing - does anyone know a method to force the arrowhead block definition to be generated/imported?


Any thoughts on this?


*update: I did notice if I drag the blocks in from another drawing, it works with Mleaders.
« Last Edit: October 11, 2016, 07:10:16 AM by tedg »
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023