broncos15 Posted June 1, 2016 Posted June 1, 2016 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) ) Quote
SOliver Posted June 1, 2016 Posted June 1, 2016 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:")) ) Quote
BIGAL Posted June 2, 2016 Posted June 2, 2016 Using Properties allows you to pick multiple leaders and set the "dot" etc not sure why the need for a lisp ? Quote
broncos15 Posted June 2, 2016 Author Posted June 2, 2016 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. Quote
Grrr Posted June 3, 2016 Posted June 3, 2016 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. Quote
EYNLLIB Posted January 24 Posted January 24 (edited) 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 January 24 by EYNLLIB more clarification Quote
EYNLLIB Posted January 24 Posted January 24 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) Quote
ronjonp Posted January 24 Posted January 24 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. Quote
EYNLLIB Posted January 24 Posted January 24 19 minutes ago, ronjonp said: IMO, A better way to manage this is with the MLEADERSTYLE. 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 Quote
ronjonp Posted January 24 Posted January 24 (edited) 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 January 24 by ronjonp Quote
EYNLLIB Posted January 24 Posted January 24 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. Quote
ronjonp Posted January 24 Posted January 24 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. 1 Quote
Recommended Posts
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.