guimond777 Posted June 15, 2022 Posted June 15, 2022 Hi All, I've been asked to put a hexagonal frame around the text in some leaders (see image), but I have no idea how to achieve this. I noticed there's an option in the properties to add a frame, but it makes it just square. Any help on how to achieve this hexagon look on the text frame would be greatly appreciated! Quote
CyberAngel Posted June 15, 2022 Posted June 15, 2022 It's possible to use a block as the content of your multileader. You could add an attribute to the block to represent the text. It would help if the text has the same length in each label, but maybe there's some magic way to adjust the block size dynamically based on text length. It's a clunky workaround, but if you have to use a custom solution, it's going to add a certain amount of overhead. Quote
BIGAL Posted June 15, 2022 Posted June 15, 2022 (edited) Like CyberAngel not sure if you could make a dynamic block that detects string length any one ? You could do a combo of leader, text and draw a hexagon using a lisp. Would that be acceptable ? Having a quick goggle maybe make a block l8 for 8 characters, L6, L12 and so on. Edited June 15, 2022 by BIGAL Quote
Calteq Posted July 2, 2022 Posted July 2, 2022 Hi G A simple solution is to use a dynamic block as attached Adjust to suit text sizes and your preferences. HexLeader.dwg 1 Quote
BIGAL Posted July 3, 2022 Posted July 3, 2022 Calteq you can get strlen which is number of characters in a string so could do a fuzz * strlen to work out "distance2" then use lee-mac dynamic properties .lsp to set value. 1 Quote
CAD_Noob Posted July 3, 2022 Posted July 3, 2022 6 hours ago, BIGAL said: Calteq you can get strlen which is number of characters in a string so could do a fuzz * strlen to work out "distance2" then use lee-mac dynamic properties .lsp to set value. strlen incorporated in lisp or in the dynamic block itself? Quote
BIGAL Posted July 4, 2022 Posted July 4, 2022 3 steps 1 enter string & get the (strlen "abc") = 3 2 insert block with string, hex shape default value 3 use lee-mac (LM:setdynpropvalue blk prp val ) to set property "distance2" The val would be like strlen * Text height. You will need to play a bit with this may need a extra * fuzz. Dynamic Block Functions | Lee Mac Programming (lee-mac.com) 1 Quote
Calteq Posted July 20, 2022 Posted July 20, 2022 Thx for the replys It seems a lot of 'faffing' around when multiLeader does the job, changing the surrounding shape size to suit the text height and string length, however, it's a bit restricted as far as the surrounding shape is concerned. A similar action might have been incorporated within the dynamic block routines or having a custom shape in the multiLeader command. Seems autocad has been around long enough to have thought of this before!!! Quote
BIGAL Posted July 21, 2022 Posted July 21, 2022 I had another look taking your dynamic block as is no scaling etc that may be needed also down the track. The Distance 2 would be 3.5 * number of characters in text. The sequence is ask for text, insert dynamic block, then up date distance 2. (defun c:wow ( / str len obj) (if (not LM:setdynpropvalue) (load "Dynamic block get-put")) (setq str (getstring "\nEnter attribute string ")) (setq len (* (+ (strlen str) 2) 3.5)) (command "-insert" "LdrHexFrame" (getpoint "\nPick point ") 1 1 0 str) (setq obj (vlax-ename->vla-object (entlast))) (LM:setdynpropvalue obj "distance2" len) (princ) ) I have saved the lee-mac Dynamic functions as "Dynamic block get-put.lsp" and saved in a support path. Great programs. "It seems a lot of 'faffing' around " To hard 9 lines of code ??? no difference in questions asked. Quote
BIGAL Posted July 22, 2022 Posted July 22, 2022 I like the idea of this so looking at this again part 2 is change text and the box changes size. The other enhancement is leader left or right at moment just right and pick points and last is various shapes say arc on ends. These would be visibility states. Happy to do more but need dynamic block changed, something I am still learning. Need 1 attribute in all visibility states not sure how to do that. Quote
TBEng Posted December 20, 2023 Posted December 20, 2023 BIGAL, I am not coding savvy at all. Is there any way to get the .lsp or block or file so that I can get leaders with hex borders that look like your post? It is perfect for what I am trying to do. Quote
BIGAL Posted December 21, 2023 Posted December 21, 2023 Start with the Calteq sample dwg, pretty sure that was what I used. You will need Lee-mac Dynamic block properties. You will need this also. ;; Set Dynamic Block Property Value - Lee Mac ;; Modifies the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; val - [any] New value for property ;; Returns: [any] New value if successful, else nil (defun LM:setdynpropvalue ( blk prp val ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) (cond (val) (t)) ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) 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.