<?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: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210751#M24801</link>
    <description>&lt;P&gt;I should've uploaded a .dwg to begin with -- here you go. As I mentioned, the updated code loads and runs without error, but doesn't do anything...&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 23:37:45 GMT</pubDate>
    <dc:creator>RandyBenson</dc:creator>
    <dc:date>2023-08-31T23:37:45Z</dc:date>
    <item>
      <title>Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205515#M24793</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Hi all,&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I was looking for a way either to set the line spacing in a multiline attribute definition or&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;define a text style with an exact line spacing. When I list the attribute definition, one of the lines I can see reads: "Line spacing: Multiple (1x = 0.133)", and I can manually change the spacing in individual block inserts with the mtext editor, but there are too many instances for that to be a solution. &lt;STRONG&gt;Anyone have a way to modify the line spacing of selection sets of block inserts programmatically?&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I spotted this post about the same issue with multiline text from 2001 that got zero replies, so it looks like it's still not possible to define at the style or attdef level with a setting...&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;lt;quote&amp;gt;:&lt;/DIV&gt;&lt;DIV class=""&gt;Line Spacing in Multi-line text editor&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Is it possible to change the default line spacing for the multiline text&lt;BR /&gt;editor?&lt;BR /&gt;&lt;BR /&gt;The current default of 1x is 1.66 times the height of the text characters&lt;BR /&gt;which is, in my opinion, too much space between lines in a paragraph.&lt;BR /&gt;&lt;BR /&gt;Every time I place text using the multiline text editor I have to change the&lt;BR /&gt;spacing to .8x to get it to look good for me. It seems that there should be&lt;BR /&gt;a way to change the default so that I don't have to do this every time.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;lt;end quote&amp;gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Aug 2023 23:42:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205515#M24793</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-08-29T23:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205536#M24794</link>
      <description>&lt;P&gt;Have you tried [I haven't] BEDITing a Block definition, giving the Attribute the line spacing you want there, and [after Saving changes] ATTSYNCing to apply that to all Insertions of that Block?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 23:57:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205536#M24794</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-08-29T23:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205745#M24795</link>
      <description>&lt;P&gt;Hi Kent,&lt;/P&gt;&lt;P&gt;Yep, that's the first thing I tried, but I don't see Line Spacing when I look at the attribute's properties dialog. What am I missing?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 03:08:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12205745#M24795</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-08-30T03:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12206193#M24796</link>
      <description>&lt;P&gt;Did a little bit of digging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line spacing is a property that belongs only to MTEXT. There are two ways to apply them. Either by setting the text property (there are even two properties LS Factor and LS Distance, somehow bounded), or by using formatting characters inserted directly in the text content. Both ways only afterward, after it was created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line spacing is not supported by a text style.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather out of curiosity, formatting characters can be programmatically inserted into a text of &lt;STRONG&gt;multi-line attributes&lt;/STRONG&gt;. They will be applied (and printed), but will be deleted by any later manual content editing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:MtextLineSpacing ( / s i)&lt;BR /&gt;
  (if (setq s (ssget "_:L" '((0 . "MTEXT"))))
    (repeat (setq i (sslength s))
      (setpropertyvalue (ssname s (setq i (1- i))) "LineSpacingFactor" 0.8)))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 09:08:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12206193#M24796</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-08-30T09:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12207783#M24797</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Line spacing is a property that belongs only to MTEXT.&amp;nbsp;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It also belongs to multiline text in block attributes, and can be individually modified one-at-a-time with the mtext editor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Rather out of curiosity, formatting characters can be programmatically inserted into a text of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;multi-line attributes&lt;/STRONG&gt;. They will be applied (and printed), but will be deleted by any later manual content editing."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That would be acceptable -- how can I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 19:10:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12207783#M24797</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-08-30T19:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12209253#M24798</link>
      <description>&lt;P&gt;Ok, try this one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:BALineSpacing ( / ls s i o c n be ed)

  (setq ls "0.8")
  
  (if (setq s (ssget "_:L" '((0 . "INSERT") (66 . 1))))
    (repeat (setq i (sslength s))
      (foreach o (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname s (setq i (1- i)))) 'getattributes)
	(and (= :vlax-true (vla-get-MTextAttribute o))
	     (setq c (vla-get-TextString o))
	     (setq n (if (and (setq be (vl-string-search "pxsm" c))
			      (setq ed (vl-string-search ";" c be))
			      )
		       (strcat (substr c 1 (1- be)) "\\pxsm" ls ";" (substr c (+ 2 ed)))
		       (strcat "\\pxsm" ls ";" c)))
	     (vla-put-TextString o n)))))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/242848"&gt;@RandyBenson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;&lt;SPAN&gt;It also belongs to multiline text in block attributes, and can be individually modified one-at-a-time with the mtext editor.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Honestly, I have no idea how to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 20:30:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12209253#M24798</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-08-31T20:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210454#M24799</link>
      <description>&lt;P&gt;Thanks! We're definitely on a track now, but I fear it may not be the right one.&lt;/P&gt;&lt;P&gt;That code sprung a 'Malformed list' error, so I started fooling around with it, but in the multiple-line attributes I'm applying the spacing to (vl-string-search "pxsm" c) returns "GR W 571.9\\PGR E 570.7", so this test always fails:&amp;nbsp;(setq be (vl-string-search "pxsm" c)). So, it runs fine but doesn't change anything yet. I'm worried that the line spacing is not exposed for attributes, and that a reg hack is needed, but I hope you can prove me wrong:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(vl-load-com)

(defun c:BALineSpacing ( / ls s i o c n be ed)

  (setq ls "0.6")

  (if (setq s (ssget "x" '((0 . "INSERT")(8 . "*PTS*") (66 . 1))))
      (repeat (setq i (sslength s))
        (foreach o (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname s (setq i (1- i)))) 'getattributes)
          (and (= :vlax-true (vla-get-MTextAttribute o))
          (setq c (vla-get-TextString o))
          (setq n
            (if
              (and
                (setq be (vl-string-search "pxsm" c))
                (setq ed (vl-string-search ";" c be))
              )
              (strcat (substr c 1 (1- be)) "\\pxsm" ls ";" (substr c (+ 2 ed))
                (strcat "\\pxsm" ls ";") c
              )
            )
          )
          (vla-put-TextString o n)
         )
       )
     )
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;"GR W&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 20:08:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210454#M24799</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-08-31T20:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210489#M24800</link>
      <description>&lt;P&gt;Use updated code. It seems that there was one parent misplaced but can't test it right now.&lt;/P&gt;
&lt;P&gt;If still not working, you need to post some dwg samples.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 20:32:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210489#M24800</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-08-31T20:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210751#M24801</link>
      <description>&lt;P&gt;I should've uploaded a .dwg to begin with -- here you go. As I mentioned, the updated code loads and runs without error, but doesn't do anything...&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 23:37:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12210751#M24801</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-08-31T23:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12211242#M24802</link>
      <description>&lt;P&gt;Well, just tried your drawing and it seems that it dose its job as is just fain.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 07:04:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12211242#M24802</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-09-01T07:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214156#M24803</link>
      <description>&lt;P&gt;I'm confused. The attributes in the inserts in the drawing I attached have no formatting string "pxsm" in the multiline text, so when I run your code (vl-string-search "pxsm" c) returns nil and nothing gets done. How did the formatting code get into the drawing you attached?&lt;/P&gt;&lt;P&gt;So I changed the "if" statement to a "cond" statement and tested for "\\P" in the string instead, and it works, BUT both procedures append the new string to the attribute instead of replacing the old string. &lt;EM&gt;&lt;STRONG&gt;What am I doing wrong?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(vl-load-com)
; BlockAttributeLineSpacing
(defun c:BALS () ; ( / ls s i o c n be ed)

  (setq ls "0.80")

  (if (setq s (ssget "x" '((0 . "INSERT")(8 . "*PTS*") (66 . 1))))
      (repeat (setq i (sslength s))
        (foreach o (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname s (setq i (1- i)))) 'getattributes)
          (and (= :vlax-true (vla-get-MTextAttribute o))
          (setq c (vla-get-TextString o))
          (setq n
            (cond
              ( (and
                  (setq be (vl-string-search "pxsm" c))
                  (setq ed (vl-string-search ";" c be))
                )
                (strcat
                  (substr c 1 (1- be))
                  "\\pxsm" ls ";"
                  (substr c (+ 2 ed))
                  (strcat "\\pxsm" ls ";") c
                )
              )
              ( (and (setq ed (vl-string-search "\P" c 0)))
                (strcat
                  (substr c 1 (1- ed))
                  "\\pxsm" ls ";"
                  (substr c (+ 2 ed))
                  (strcat "\\pxsm" ls ";") c
                )
              )
            )
          )
          (vla-put-TextString o n)
         )
       )
     )
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 19:27:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214156#M24803</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-09-02T19:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214312#M24804</link>
      <description>&lt;P&gt;Randy,&lt;/P&gt;
&lt;P&gt;Get back to my reply and copy-paste my code again. You are still using the unfixed version.&lt;/P&gt;
&lt;P&gt;When you dig into the logic remember that IF also can have ELSE condition, not just THEN.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 22:42:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214312#M24804</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-09-02T22:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set Line Spacing in Multi-line text, text styles, or attribute definitions OR modify dozens of inserts w/vlisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214515#M24805</link>
      <description>&lt;P&gt;You are CORRECT, sir! Thank you! Works really well. I owe you a frosty adult beverage!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2023 03:12:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-line-spacing-in-multi-line-text-text-styles-or-attribute/m-p/12214515#M24805</guid>
      <dc:creator>RandyBenson</dc:creator>
      <dc:date>2023-09-03T03:12:49Z</dc:date>
    </item>
  </channel>
</rss>

