<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: rectangular frame around a text in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8514382#M94443</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;and thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;it works great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jan 2019 20:22:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-01-10T20:22:06Z</dc:date>
    <item>
      <title>rectangular frame around a text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8512996#M94439</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;Can you help me with a lisp that after selecting some objects it will create a frame around it (like the example).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-01-10_15-25-51.jpg" style="width: 518px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/589356iBD4E443A64F4AC65/image-dimensions/518x206?v=v2" width="518" height="206" role="button" title="2019-01-10_15-25-51.jpg" alt="2019-01-10_15-25-51.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;very similar to the lisp entitled "TEXTBOX" , but I want that after calling the lisp it will allow to select items,&amp;nbsp; and the default&amp;nbsp;offset will be 0.35mm.&lt;/P&gt;
&lt;P&gt;The textbox lisp work like that:&lt;/P&gt;
&lt;P&gt;It will be enabling the user to create a 2D polyline&lt;BR /&gt;rectangular frame around selected Text &amp;amp; MText objects, with a&lt;BR /&gt;user-defined offset. (The default&amp;nbsp;is 0.35mm) .&lt;/P&gt;
&lt;P&gt;And I want it to allow me to select either one single text and some entities.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Eyal&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the textbox lisp for indication:&lt;/P&gt;
&lt;PRE&gt;;;----------------------------=={ Box Text }==--------------------------;;
;;                                                                      ;;
;;  This program performs in much the same way as the Express Tools'    ;;
;;  'TCircle' command: enabling the user to create a 2D polyline        ;;
;;  rectangular frame around selected Text &amp;amp; MText objects, with a      ;;
;;  user-defined offset.                                                ;;
;;                                                                      ;;
;;  Upon issuing the command syntax 'BT' at the AutoCAD command-line,   ;;
;;  the program first prompts the user to specify an offset factor      ;;
;;  for the text frame. This factor is multiplied by the text height    ;;
;;  for every selected text object to determine the offset of the       ;;
;;  rectangular frame from the text. At this prompt, the last used      ;;
;;  value is available as a default option.                             ;;
;;                                                                      ;;
;;  The program then prompts the user to make a selection of text       ;;
;;  and/or mtext objects. Following a valid selection, the program      ;;
;;  iterates over the selection and constructs a rectangular frame      ;;
;;  surrounding each object, offset by a distance determined by the     ;;
;;  given offset factor. The generated text box will inherit the        ;;
;;  basic properties of the enclosed text object (e.g. Layer, Linetype, ;;
;;  Lineweight etc.).                                                   ;;
;;                                                                      ;;
;;  The program will also perform successfully with Text or MText       ;;
;;  defined in any construction plane, and under all UCS &amp;amp; view         ;;
;;  settings.                                                           ;;
;;----------------------------------------------------------------------;;
;;  Author:  Lee Mac, Copyright © 2010  -  www.lee-mac.com              ;;
;;----------------------------------------------------------------------;;
;;  Version 1.2    -    2015-02-22                                      ;;
;;----------------------------------------------------------------------;;

(defun c:bt ( / *error* def enx idx lst off sel )

    (defun *error* ( msg )
        (LM:endundo (LM:acdoc))
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "\nError: " msg))
        )
        (princ)
    )

    (if (or (not (setq def (getenv "LMac\\boxtext-off")))
            (not (setq def (distof def 2)))
        )
        (setenv "LMac\\boxtext-off" (rtos (setq def 0.35) 2 2))
    )
    (initget 4)
    (if (setq off (getreal (strcat "\nSpecify offset factor &amp;lt;" (rtos def 2 2) "&amp;gt;: ")))
        (setenv "LMac\\boxtext-off" (rtos off 2 2))
        (setq off def)
    )
    
    (LM:startundo (LM:acdoc))
    (if (setq sel (LM:ssget "\nSelect text or mtext &amp;lt;exit&amp;gt;: " '(((0 . "TEXT,MTEXT")))))
        (repeat (setq idx (sslength sel))
            (setq enx (entget (ssname sel (setq idx (1- idx))))
                  lst (text-box-off enx (* off (cdr (assoc 40 enx))))
            )
            (entmake
                (append
                   '(
                        (000 . "LWPOLYLINE")
                        (100 . "AcDbEntity")
                        (100 . "AcDbPolyline")
                        (090 . 4)
                        (070 . 1)
                    )
                    (LM:defaultprops enx)
                    (list (cons  038 (caddar lst)))
                    (mapcar '(lambda ( x ) (cons 10 x)) lst)
                    (list (assoc 210 enx))
                )
            )
        )
    )
    (LM:endundo (LM:acdoc))
    (princ)
)

;; ssget  -  Lee Mac
;; A wrapper for the ssget function to permit the use of a custom selection prompt
;; msg - [str] selection prompt
;; arg - [lst] list of ssget arguments

(defun LM:ssget ( msg arg / sel )
    (princ msg)
    (setvar 'nomutt 1)
    (setq sel (vl-catch-all-apply 'ssget arg))
    (setvar 'nomutt 0)
    (if (not (vl-catch-all-error-p sel)) sel)
)

;; Default Properties  -  Lee Mac&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Jan 2019 13:31:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8512996#M94439</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-10T13:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: rectangular frame around a text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513109#M94440</link>
      <description>&lt;P&gt;As I understand you, the only thing you what, is swap&amp;nbsp;the order of selecting and specifying&amp;nbsp;a frame offset...&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 14:04:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513109#M94440</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-01-10T14:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: rectangular frame around a text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513166#M94441</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It gives :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.jpg" style="width: 624px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/589392iB3266D62CFA03201/image-dimensions/624x202?v=v2" width="624" height="202" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like shown in the left , and should be like the picture in the right.&lt;/P&gt;
&lt;P&gt;I want the rectangle to be with offset to the boundary enclosed all the selected entities.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Eyal&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 14:16:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513166#M94441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-10T14:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: rectangular frame around a text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513877#M94442</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... Can you help me with a lisp that after selecting some objects it will create a frame around it (like the example).&amp;nbsp;&amp;nbsp;....&amp;nbsp; with a user-defined offset. (The default&amp;nbsp;is 0.35mm) .&lt;/P&gt;
&lt;P&gt;And I want it to allow me to select either one single text and some entities.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Modifying something I already had to draw the bounding box around multiple objects [of any kind(s), but without the offset], now restricted to Text/Mtext and with offset:&lt;/P&gt;
&lt;PRE&gt;;|
FrameText.lsp [command name: FT]
To draw a Frame around single or multiple Text/Mtext objects. Finds overall
  extentof object(s) selected, draws a Rectangle around that collective box, and
  Offsets it outboard by User-specified distance.
Works in non-World UCS if XYZ axes parallel to WCS [i.e. origin may
  be different but with same orientation].
Kent Cooper, 10 January 2019
|;
(defun C:FT (/ ss minpt maxpt eLL eUR LL UR robj); = Frame Text
  (setq *FTdist* ; global variable
    (cond
      ( (getdist
          (strcat
            "Frame offset &amp;lt;"
            (if *FTdist* (rtos *FTdist*) "0.35"); offer initial default if no prior value
            "&amp;gt;: "
          ); strcat
        ); getdist
      ); User-input condition
      (*FTdist*); prior value default on Enter if present
      (0.35); initial default on Enter if no prior value
    ); cond
  ); setq
  (prompt "\nTo draw a Frame around Text/Mtext object(s),")
  (if (setq ss (ssget '((0 . "*TEXT"))))
    (progn ; then
      (repeat (setq n (sslength ss))
        (vla-getboundingbox (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt)
        (setq
          eLL (vlax-safearray-&amp;gt;list minpt)
          eUR (vlax-safearray-&amp;gt;list maxpt)
          LL (if LL (mapcar 'min eLL LL) eLL)
          UR (if UR (mapcar 'max eUR UR) eUR)
        ); setq
      ); repeat
      (command "_.rectangle" "_none" (trans LL 0 1) "_none" (trans UR 0 1))
      (setq robj (vlax-ename-&amp;gt;vla-object (entlast)))
      (vla-offset robj *FTdist*)
      (vla-delete robj); delete no-offset initial rectangle
    ); progn
    (prompt "\nNothing selected."); else
  ); if
  (princ)
); defun
(vl-load-com)
(prompt "\nType FT to draw a Frame around Text/Mtext object(s).")&lt;/PRE&gt;
&lt;P&gt;It assumes your &lt;EM&gt;drawing unit is a millimeter&lt;/EM&gt;.&amp;nbsp; If it's not, change the initial default value [which is in drawing units] to compensate.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 17:42:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8513877#M94442</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-08-12T17:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: rectangular frame around a text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8514382#M94443</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;and thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;it works great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 20:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-frame-around-a-text/m-p/8514382#M94443</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-10T20:22:06Z</dc:date>
    </item>
  </channel>
</rss>

