Jump to content

Swapping arrowhead on multileaders


broncos15

Recommended Posts

I had a quick question on swapping the arrowhead on multileaders. For example, one of the codes just does a swap to an integral sign and another one does it to a dot. One thing that I notice is that it doesn't work unless there is already another multileader in the drawing that has that same arrowhead. I am not sure if this has to do with the block not actually existing in the drawing, or if it is something else. One of my codes is

(defun c:mleaderdot (/ ss cnt obj *error*)
 (defun *error* (msg)
   (if (not
         (member msg '("Function cancelled" "quit / exit abort"))
       )
     (princ (strcat "\nError: " msg))
   )
   (princ)
 )
 (if (setq ss (LM:ssget "\nSelect MLEADERS to put dot"
                        '(((0 . "MULTILEADER")))
              )
     )
   (progn
     (setq cnt 0)
     (repeat (sslength ss)
       (setq obj (vlax-ename->vla-object (ssname ss cnt)))
       (setq cnt (+ cnt 1))
       (vla-put-ArrowheadBlock obj "_dot")
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

I find the same "key not found" error when I attempt to use

 

(vla-put-arrowheadtype ent "_dot")

 

However, I was successful in changing the arrow head to the _dot by using

 

 (vla-put-arrowheadtype xEnt 3)

 

Once I'd used arrow head type I was able to put arrow head block "_dot".

 

Ok, here's a (kind of messy) approach which allows you to select the arrow head based on block name. The method iterates an integer up to 19 which is the number of arrow heads available (or at least vla-put-arrowheadtype 20 gets an error not found). Each arrow head type is applied to the select entity and the block name picked up from vla-get-arrowheadtype. The list of potential arrow heads are printed to the console. Once the loop is complete the selected mleader's arrow head is restored to it's original state. Finally the user is invited to enter the integer that represents the desired arrow head block name.

   (vl-load-com)
   (defun c ()
     (setq ent (car(entsel))
           xEnt (vlax-ename->vla-object ent)
           aht (vla-get-arrowheadtype xEnt)
                 i -1)
     (while (< (setq i (+ i 2)) 18)
           (setq str (strcat
              (rtos i 2)
              ". "
              (vla-get-arrowheadblock xEnt)
              "      "
              (rtos (1+ i))
              ". "))
           (vla-put-arrowheadtype xEnt (1+ i))
           (princ (strcat
                   str
                   (vla-get-arrowheadblock xEnt)
                   "\n")))
       
       
       (princ (strcat
              "19. "
              (vla-get-arrowheadblock xEnt)
            "\n"))
       (vla-put-arrowheadtype xEnt aht)
       (vla-put-arrowheadtype xEnt (getint "Enter the id of the arrow head you're looking for:"))
     )

Link to comment
Share on other sites

I find the same "key not found" error when I attempt to use

 

(vla-put-arrowheadtype ent "_dot")

However, I was successful in changing the arrow head to the _dot by using

 

 (vla-put-arrowheadtype xEnt 3)

Once I'd used arrow head type I was able to put arrow head block "_dot".

 

Ok, here's a (kind of messy) approach which allows you to select the arrow head based on block name. The method iterates an integer up to 19 which is the number of arrow heads available (or at least vla-put-arrowheadtype 20 gets an error not found). Each arrow head type is applied to the select entity and the block name picked up from vla-get-arrowheadtype. The list of potential arrow heads are printed to the console. Once the loop is complete the selected mleader's arrow head is restored to it's original state. Finally the user is invited to enter the integer that represents the desired arrow head block name.

   (vl-load-com)
   (defun c ()
     (setq ent (car(entsel))
           xEnt (vlax-ename->vla-object ent)
           aht (vla-get-arrowheadtype xEnt)
                 i -1)
     (while (< (setq i (+ i 2)) 18)
           (setq str (strcat
              (rtos i 2)
              ". "
              (vla-get-arrowheadblock xEnt)
              "      "
              (rtos (1+ i))
              ". "))
           (vla-put-arrowheadtype xEnt (1+ i))
           (princ (strcat
                   str
                   (vla-get-arrowheadblock xEnt)
                   "\n")))
       
       
       (princ (strcat
              "19. "
              (vla-get-arrowheadblock xEnt)
            "\n"))
       (vla-put-arrowheadtype xEnt aht)
       (vla-put-arrowheadtype xEnt (getint "Enter the id of the arrow head you're looking for:"))
     )

Thanks for the help! It is interesting that it gets that error, but that the integer method works. I will role with this code, thank you for the help! BigAL, I don't ever really have the properties dialogue box up and I don't use it except when I have to because I find it so much slower than using the command line.
Link to comment
Share on other sites

Nice thread! Maybe it will help out on making new mleaderstyle with VLA.

As my attempts on making new mleaderstyles, where everyone should contain every type of the standart arrowhead types blocks failed at this moment.

Link to comment
Share on other sites

  • 7 years later...

How do I set the leader arrowhead type to "Closed Filled". Can't seem to figure a way out since it's technically just a Solid not a named block in the drawing

 

Thanks

 

Edited by EYNLLIB
more clarification
Link to comment
Share on other sites

19 minutes ago, EYNLLIB said:

How do I set the leader arrowhead type to "Closed Filled". Can't seem to figure a way out since it's technically just a Solid not a named block in the drawing

 

Thanks

 

 

Figured it out.

 

I used :

 

 (vla-put-arrowheadtype obj 0)

 

Link to comment
Share on other sites

1 hour ago, EYNLLIB said:

 

Figured it out.

 

I used :

 

 (vla-put-arrowheadtype obj 0)

 

IMO, A better way to manage this is with the MLEADERSTYLE.

image.png.4bfcc4ed5d0604844cb178a67f606ee7.png

Link to comment
Share on other sites

19 minutes ago, ronjonp said:

IMO, A better way to manage this is with the MLEADERSTYLE.

image.png.4bfcc4ed5d0604844cb178a67f606ee7.png

 

 

I'd rather not use a different mleader style for every leader type i use. I basically just toggle between closed filled and dot blank for any of my styles

Link to comment
Share on other sites

OK .. so you'd have two styles then ? Why not use the program as it was designed? If you have a template this is easy peasy.

Edited by ronjonp
Link to comment
Share on other sites

22 minutes ago, ronjonp said:

OK .. so you'd have two styles then ? Why not use the program as it was designed? If you have a template this is easy peasy.

 

 

I have 9 distinct multileader styles that are all used for various reasons. Each of those styles can potentially use 1-3 different leader arrowhead styles. I dont want to muddy up my styles having 27+ styles just so I can have a different style for each arrowhead. 

 

In my opinion, I am using the program as intended. I'm using lisp to create a workflow that fits my specific needs to reduce tedium and time.

Link to comment
Share on other sites

47 minutes ago, EYNLLIB said:

 

 

I have 9 distinct multileader styles that are all used for various reasons. Each of those styles can potentially use 1-3 different leader arrowhead styles. I dont want to muddy up my styles having 27+ styles just so I can have a different style for each arrowhead. 

 

In my opinion, I am using the program as intended. I'm using lisp to create a workflow that fits my specific needs to reduce tedium and time.

Sounds like you have a plan. 👍

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...