Jump to content

Leader Hexagonal Frame?


Recommended Posts

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!

 

image.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

  • 3 weeks later...

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.

  • Like 1
Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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)

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

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!!!

 

 

 

Link to comment
Share on other sites

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.

 

image.thumb.png.e3826220f293dc42a4ff8f208e7a4e10.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

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)
    )
)

 

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...