<?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: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10808215#M51655</link>
    <description>&lt;P&gt;Hello John and Sea-Haven&lt;BR /&gt;&lt;BR /&gt;Unfortunately not all blocks in my industry (HVAC) have the same shapes. Of course, the sizes of these blocks also differ. This is very clearly visible in my added image. There you can see air ducts, fans, duct dampers, reheaters and central heating pipes. In the pictureyou see a fairly empty representation of a floor plan with these blocks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/998658i349DC6424E43FAA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What I forgot to mention in my 1st post is that I can't edit the blocks. I have to place the blocks via another software/ add-in called StabiCad. The names of all these blocks placed via StabiCad also start with a "*".&lt;BR /&gt;I can change the color of a block or his attributes, but if I place a new block, the colors change back into their original colors.&lt;BR /&gt;Each of these blocks contains at least 3 attributes. The blocks on my 1st image, round air vents, contain 8 which I could fill in. However, the first 2 or 3 are important here.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I use "Attsync", then the attributes jump back in the same corner as the block. For example, if a block is rotated 180 degrees, and the text is horizontally readable, in fact rotated 0 degrees, the text jumps back to rotated 180 degrees. So upside down.&lt;BR /&gt;Because my scale is now 1:50, the text height also jumps back to 1.8. This while this should remain 90.&lt;BR /&gt;&lt;BR /&gt;Use ATTSYNC or BEDIT can't solve the problem.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Dec 2021 07:29:01 GMT</pubDate>
    <dc:creator>sander.van.pelt</dc:creator>
    <dc:date>2021-12-08T07:29:01Z</dc:date>
    <item>
      <title>Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10795582#M51649</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the lisp below to rotate the attributes of a block automatically to horizontal in the current view (WCS or UCS) if I rotate a block.&amp;nbsp; But now I have to rotate the attributes of multiple blocks to horizontal only.&lt;BR /&gt;&lt;BR /&gt;We have received many drawings from third parties. In these drawings, one block and his attributes are rotated 45 degrees, the other 63 degrees etc. The blocks and attributes do have a lot of different angles. The position/ rotation of these blocks are oke.&lt;BR /&gt;I can use my own lisp by selecting all these blocks, select a basepoint, rotate them for example 90 degrees, and after that, rotate them 270 degrees. All the attributes are placed horizontal now.&lt;BR /&gt;&lt;BR /&gt;But is there somebody who can help me with a lisp which only rotates the attributes of the selected blocks to horizontal or (for maybe in the future) to another angle/ let me choose from 2 options, horizontal or angle.&lt;BR /&gt;A lisp that ensures that I don't have to rotate everything twice.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:RB ( / ss i vla-blockent)
  (if (setq ss (ssget "_:L"))
    (progn
      (command "_.ROTATE" ss "")
      (while (&amp;gt; (getvar 'CMDACTIVE) 0)
        (command PAUSE))
      (repeat (setq i (sslength ss))
        (setq vla-blockent (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i)))))
        (if (eq (vla-get-hasattributes vla-blockent) :vlax-true)
          (foreach att (vlax-invoke vla-blockent 'getattributes)
            (vla-put-rotation att 0)))))
    (princ "\nNothing selected."))
  (princ)
)
(vl-load-com)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 08:27:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10795582#M51649</guid>
      <dc:creator>sander.van.pelt</dc:creator>
      <dc:date>2021-12-02T08:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10797025#M51650</link>
      <description>&lt;P&gt;We civils Dview;Twist a lot, so years ago I wrote HTEXT (horizontal) and ATEXT (align) for Text, Mtext, and Dimensions.&lt;/P&gt;
&lt;P&gt;Never thought about doing it for attributes.&amp;nbsp; Maybe I'll give it a shot.&amp;nbsp; Yes, I think it would be easy.&lt;/P&gt;
&lt;P&gt;To confirm... I think you wanted to rotate all the attributes in a block reference.&amp;nbsp; Is that correct, or just individually selected attributes?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 18:36:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10797025#M51650</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-12-02T18:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10798406#M51651</link>
      <description>&lt;P&gt;Hi John,&lt;BR /&gt;It is indeed about rotating all the attributes of a block.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;What will remain a problem (I think), is that I will have to check all attributes of the selected blocks for readability because their justification will remain in the same place relative to the insert point of the block.&lt;BR /&gt;For example, the image shows what happens when I use my own lisp. The attributes (left justification) are partly overlap eachother or overlap the block partly.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/996750iC01EDB0FA5F9B61E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 09:41:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10798406#M51651</guid>
      <dc:creator>sander.van.pelt</dc:creator>
      <dc:date>2021-12-03T09:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10799188#M51652</link>
      <description>&lt;P&gt;Another thought...&lt;/P&gt;
&lt;P&gt;If your blocks are rather circular like the one in your image, with its insertion point at the center, then we could reposition the attributes to have the same dx,dy as if the block were not rotated (wrt the view).&lt;/P&gt;
&lt;P&gt;Have you checked to see what ATTSYNC does?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 15:58:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10799188#M51652</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-12-03T15:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10799774#M51653</link>
      <description>&lt;P&gt;Another nother thought...&lt;/P&gt;
&lt;P&gt;If your blocks are really that uniform and circular. then why not just (command "_.rotate") the block insertion?&lt;/P&gt;
&lt;P&gt;Or you can use (vlax-put block 'rotation ang).&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 19:49:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10799774#M51653</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-12-03T19:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10800295#M51654</link>
      <description>&lt;P&gt;I think like John you need to look at a dx dy for the attributes so as you rotate the block&amp;nbsp; you also maintain a distance between them and a rotation. You can run lisp in BEDIT sometimes a bit easier than entmoding the block definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_1-1638585521895.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/997148iDE64E6F2E1751DF9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_1-1638585521895.png" alt="SeaHaven_1-1638585521895.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 02:39:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10800295#M51654</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2021-12-04T02:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10808215#M51655</link>
      <description>&lt;P&gt;Hello John and Sea-Haven&lt;BR /&gt;&lt;BR /&gt;Unfortunately not all blocks in my industry (HVAC) have the same shapes. Of course, the sizes of these blocks also differ. This is very clearly visible in my added image. There you can see air ducts, fans, duct dampers, reheaters and central heating pipes. In the pictureyou see a fairly empty representation of a floor plan with these blocks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/998658i349DC6424E43FAA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What I forgot to mention in my 1st post is that I can't edit the blocks. I have to place the blocks via another software/ add-in called StabiCad. The names of all these blocks placed via StabiCad also start with a "*".&lt;BR /&gt;I can change the color of a block or his attributes, but if I place a new block, the colors change back into their original colors.&lt;BR /&gt;Each of these blocks contains at least 3 attributes. The blocks on my 1st image, round air vents, contain 8 which I could fill in. However, the first 2 or 3 are important here.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I use "Attsync", then the attributes jump back in the same corner as the block. For example, if a block is rotated 180 degrees, and the text is horizontally readable, in fact rotated 0 degrees, the text jumps back to rotated 180 degrees. So upside down.&lt;BR /&gt;Because my scale is now 1:50, the text height also jumps back to 1.8. This while this should remain 90.&lt;BR /&gt;&lt;BR /&gt;Use ATTSYNC or BEDIT can't solve the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 07:29:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10808215#M51655</guid>
      <dc:creator>sander.van.pelt</dc:creator>
      <dc:date>2021-12-08T07:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate attributes selected blocks to horizontal equal to WCS/ UCS view</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10809764#M51656</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11491375"&gt;@sander.van.pelt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears from your image that there's no simple solution as to where to always place the horizontal attributes, but these two commands may reduce your fatigue.&lt;/P&gt;
&lt;P&gt;The first (c:HAT) makes all attributes within selected inserts horizontal on the screen.&lt;/P&gt;
&lt;P&gt;The second (c:ATTMOVE or c:AM) is an oldie that makes it easier to move attributes.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:HAT ( / *error* vars vals ss i obj)
  (gc)
  (vl-load-com)
  (prompt "\nHAT v1.0 (c)2021, John F. Uhden")
  (defun *error* (|err)
    (mapcar 'setvar vars vals)
    (vla-endundomark *doc*)
    (cond
      ((not err))
      ((wcmatch (strcase |err) "*CANCEL*,*QUIT*")
        (vl-exit-with-error "\r                                              ")
      )
      (1 (vl-exit-with-error (strcat "\r*ERROR*: " |err)))
    )
    (princ)
  )
  ;;-------------------------------------------
  ;; Initialize drawing and program variables:
  ;;
  (setq *acad* (vlax-get-acad-object))
  (setq *doc* (vlax-get *acad* 'ActiveDocument))
  (vla-endundomark *doc*)
  (vla-startundomark *doc*)
  (setq vars '("cmdecho"))
  (setq vals (mapcar 'getvar vars))
  (setvar "cmdecho" 0)
  (command "_.expert" (getvar "expert")) ;; dummy command
  ;;------------------
  ;; Begin the action
  (and
    (setq ss (ssget '((0 . "INSERT")(66 . 1))))
    (repeat (setq i (sslength ss))
      (setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i)))))
      (foreach att (vlax-invoke obj 'getattributes)
        (vlax-put att 'rotation (- (* 2 pi)(getvar "viewtwist")))
      )
    )
  )
  (*error* nil)
)

(defun C:ATTMOVE ( / *error* |e |etyp |pick)
   ;; Program allows user to repeatedly pick an attribute and change its position.
   (gc)
   (vl-load-com)
   (prompt "\nATTMOVE v15.00 (c)1994-2000, John F. Uhden")
  (defun *error* (|err)
    (mapcar 'setvar vars vals)
    (vla-endundomark *doc*)
    (cond
      ((not err))
      ((wcmatch (strcase |err) "*CANCEL*,*QUIT*")
        (vl-exit-with-error "\r                                              ")
      )
      (1 (vl-exit-with-error (strcat "\r*ERROR*: " |err)))
    )
    (princ)
  )
  ;;-------------------------------------------
  ;; Initialize drawing and program variables:
  ;;
  (setq *acad* (vlax-get-acad-object))
  (setq *doc* (vlax-get *acad* 'ActiveDocument))
  (vla-endundomark *doc*)
  (vla-startundomark *doc*)
  (setq vars '("cmdecho"))
  (setq vals (mapcar 'getvar vars))
  (setvar "cmdecho" 0)
  (command "_.expert" (getvar "expert")) ;; dummy command
   (setvar "errno" 0)
   ;;-------------------------------------------------------
   ;; Begin user action by picking attributes one at a time:
   ;;
   (while (/= (getvar "errno") 52)
      (setq |etyp nil)
      (if (setq |pick (nentsel "\nSelect attribute: "))
         (setq |e (car |pick)
            |etyp (cdr (assoc 0 (entget |e)))
         )
      )
      (if (= |etyp "ATTRIB")
         (if (&amp;gt; (length |pick) 2)
            (prompt " Attribute belongs to a nested block.")
            (progn
              (command "_.attedit" "_Y" "" "" "" |e)
              (prompt "\nText insertion point: ")
              (command "_P" pause "")
              (entupd |e)
            )
         )
         (if |etyp (prompt (strcat "Entity is a(n) " |etyp)))
      )
   )
   (*error* nil)
)
(defun c:AM ()(c:ATTMOVE))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 18:40:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-attributes-selected-blocks-to-horizontal-equal-to-wcs-ucs/m-p/10809764#M51656</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-12-08T18:40:29Z</dc:date>
    </item>
  </channel>
</rss>

