<?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: Mirror a Block around its base point in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242863#M73554</link>
    <description>Where to place this in LSP?</description>
    <pubDate>Fri, 15 Sep 2023 11:10:43 GMT</pubDate>
    <dc:creator>meynvangurp</dc:creator>
    <dc:date>2023-09-15T11:10:43Z</dc:date>
    <item>
      <title>Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9571956#M73544</link>
      <description>&lt;P&gt;I want a Lisp that Mirror a block around its base point:&lt;/P&gt;&lt;P&gt;1. Select the Block.&lt;/P&gt;&lt;P&gt;2. Mirror it around its base point, and delete the original.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 13:38:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9571956#M73544</guid>
      <dc:creator>a.tawkXHKN6</dc:creator>
      <dc:date>2020-06-10T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572023#M73545</link>
      <description>&lt;P&gt;Around the vertical axis, right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:BMirror (/ s)
  (if (setq s (ssget "_:S:E"))
    (command "_.MIRROR" s "" "_non" (trans (cdr (assoc 10 (entget (ssname s 0)))) 0 1) "_non" "@0,1" "_Yes"))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:03:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572023#M73545</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-10T14:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572070#M73546</link>
      <description>&lt;P&gt;thanks for your reply. Can we consider the case when we have a rotated block so that the mirror line should be rotated as well? see attached image.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:23:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572070#M73546</guid>
      <dc:creator>a.tawkXHKN6</dc:creator>
      <dc:date>2020-06-10T14:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572167#M73547</link>
      <description>&lt;P&gt;Sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:BMirror (/ s d)  
  (if (and (setq s (ssget "_:S:E"))
	   (setq d (entget (ssname s 0))))
    (command "_.MIRROR"
	     s ""
	     "_non" (trans (setq p (cdr (assoc 10 d))) 0 1)
	     "_non" (trans (polar p (+ (/ pi 2) (cdr (assoc 50 d))) 1) 0 1)
	     "_Yes"))
  (princ)
  )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:53:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572167#M73547</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-10T14:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572388#M73548</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5466157"&gt;@a.tawkXHKN6&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks for your reply. Can we consider the case when we have a rotated block so that the mirror line should be rotated as well? see attached image.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You don't need a Mirror &lt;EM&gt;command&lt;/EM&gt;&amp;nbsp; for this, nor to extract the insertion point, nor calculate the direction of the appropriate axis, nor translate between coordinate systems, nor account for the possibility of running Object Snap modes, etc.&amp;nbsp; In the case of a Block defined in the way your image shows, you can just &lt;EM&gt;&lt;STRONG&gt;change the X scale factor to the negative of its current value&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; In simplest terms:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:BMIP (/ blk bdata) ; = Block "Mirror" about Insertion Point
  (setq
    blk (car (entsel "\nSelect Block to Mirror: "))
    bdata (entget blk)
  )
  (entmod
    (subst
      (cons 41 (- (cdr (assoc 41 bdata))))
      (assoc 41 bdata)
      bdata
    )
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to flip one about the &lt;EM&gt;horizontal&lt;/EM&gt;&amp;nbsp; axis in relation to your base Block definition, just change the 41's to 42's to use the Y scale factor instead of X.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 16:14:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572388#M73548</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-06-10T16:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572443#M73549</link>
      <description>&lt;P&gt;Can we tweak the lisp such that we can select more than one block at once?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 16:29:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572443#M73549</guid>
      <dc:creator>a.tawkXHKN6</dc:creator>
      <dc:date>2020-06-10T16:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572470#M73550</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5466157"&gt;@a.tawkXHKN6&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can we tweak the lisp such that we can select more than one block at once?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Again, in simplest terms and minimally tested:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:BMIP (/ ss n blk bdata) ; = Block "Mirror" about Insertion Point
  (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (ssname ss (setq n (1- n)))
        bdata (entget blk)
      ); setq
      (entmod
        (subst
          (cons 41 (- (cdr (assoc 41 bdata))))
          (assoc 41 bdata)
          bdata
        ); subst
      ); entmod
    ); repeat
  ); if
  (princ)
); defun&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 16:42:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/9572470#M73550</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-06-10T16:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12182209#M73551</link>
      <description>&lt;P&gt;You are Awesome, i find it for long time&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 09:29:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12182209#M73551</guid>
      <dc:creator>duongauduong07</dc:creator>
      <dc:date>2023-08-19T09:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242678#M73552</link>
      <description>&lt;P&gt;Hi this works fine when you don't have a text (attribute) in a block.&lt;/P&gt;&lt;P&gt;Can someone help me to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I have is when using this LSP on a block with some text written in it, the text will stay in same position, will not mirror&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 09:31:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242678#M73552</guid>
      <dc:creator>meynvangurp</dc:creator>
      <dc:date>2023-09-15T09:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242850#M73553</link>
      <description>&lt;P&gt;setting &lt;STRONG&gt;'mirrtext&lt;/STRONG&gt; variable to 1 will allow to mirror texts and attributes&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 11:00:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242850#M73553</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-09-15T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242863#M73554</link>
      <description>Where to place this in LSP?</description>
      <pubDate>Fri, 15 Sep 2023 11:10:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12242863#M73554</guid>
      <dc:creator>meynvangurp</dc:creator>
      <dc:date>2023-09-15T11:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243003#M73555</link>
      <description>&lt;P&gt;MIRRTEXT won't do it by itself.&amp;nbsp; The problem is that an Attribute has its own entity name and entity data, and changing the entity data of the Block &lt;EM&gt;reference&lt;/EM&gt; to reverse the X scale factor does not affect the Attribute's position.&amp;nbsp; I think it will be necessary to use an actual MIRROR &lt;EM&gt;command&lt;/EM&gt;, under which the object selection of the Block reference will include selection of the Attribute.&amp;nbsp; The Attribute's position will then flip along with the rest of the Block, and the MIRRTEXT setting will then affect the &lt;EM&gt;reading direction&lt;/EM&gt; of the Attribute.&amp;nbsp; One way of doing it:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:BMIP (/ ss n blk bdata) ; = Block "Mirror" about Insertion Point
  (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (ssname ss (setq n (1- n)))
        bdata (entget blk)
      ); setq
      (command "_.mirror" blk "" "_non" (cdr (assoc 10 bdata)) "_non" "@0,1" "_yes")
    ); repeat
  ); if
  (princ)
); defun&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 12:23:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243003#M73555</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-09-15T12:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243153#M73556</link>
      <description>&lt;P&gt;Thanks, looks like this works.&lt;BR /&gt;One more question: This LISP will flip it vertically, what to change if I want to mirror it horizontally?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 13:21:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243153#M73556</guid>
      <dc:creator>meynvangurp</dc:creator>
      <dc:date>2023-09-15T13:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror a Block around its base point</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243179#M73557</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14009387"&gt;@meynvangurp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;...: This script will flip it vertically, what to change if I want to mirror it horizontally?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;[It's not a Script.&amp;nbsp; That word has a specific meaning in AutoCAD, and this isn't it.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change&amp;nbsp;"@&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;0,1&lt;/STRONG&gt;&lt;/FONT&gt;" to&amp;nbsp;"@&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;1,0&lt;/STRONG&gt;&lt;/FONT&gt;".&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 13:18:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/mirror-a-block-around-its-base-point/m-p/12243179#M73557</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-09-15T13:18:13Z</dc:date>
    </item>
  </channel>
</rss>

