<?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: Text to multiple Mline's in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435447#M40865</link>
    <description>&lt;P&gt;Hey, I tried code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118654iBAE3FB899C3D5C9F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;it recognize Mlines beautifully and add text to all of it. But is it possible to add text&amp;nbsp;&lt;SPAN&gt;height to 1.25m and distance 1m from Mlines?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 08:58:02 GMT</pubDate>
    <dc:creator>g.dauksaite8AZKZ</dc:creator>
    <dc:date>2022-09-21T08:58:02Z</dc:date>
    <item>
      <title>AutoCAD - Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433166#M40856</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have to add MText "HDPE32" as in expalmpe to other multiple green Mlines and to align that text. I could copy/paste and align one by one but there are more then 300 of them. Is there an easier way to add the same text to all of them?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 833px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118207i3076EA08E810D23D/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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FFCC00"&gt;[ The subject line of this post has been edited to include the product name by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12851358"&gt;@handjonathan&lt;/a&gt; ]&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 14:05:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433166#M40856</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-20T14:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433225#M40857</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You need here an outsource help .. I suggest to check the following link that may help . &amp;gt;&amp;gt; &lt;A href="https://www.cadforum.cz/en/qaID.asp?tip=6561" target="_blank" rel="noopener"&gt;Click1&lt;/A&gt; &amp;lt;&amp;lt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 11:41:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433225#M40857</guid>
      <dc:creator>imadHabash</dc:creator>
      <dc:date>2022-09-20T11:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433252#M40858</link>
      <description>&lt;P&gt;Thank you for your fast answer, but first two options its still manually rotate every single object from 300 of them. Third opsion roatate all of them but to one direction, so not exacly what im looking for. Fourth is a blocks that atoumaticly aligns but still every single peace separately. 6th one is for Civil 3D. Last one, im not sure how to writte a LISP:/&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 11:53:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433252#M40858</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-20T11:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433286#M40859</link>
      <description>&lt;P&gt;Are they always and only &lt;EM&gt;two-point&lt;/EM&gt;&amp;nbsp;MLINE objects -- nothing "fancier"?&amp;nbsp; Are they always all of the same Style and Scale and Justification [thinking about placement of the Text part -- length variations shouldn't matter]?&amp;nbsp; Are they always on the same Layer, with no other Mlines on that Layer that you don't want Text added to?&amp;nbsp; In that case the routine could find them all, or would the User select?&amp;nbsp; Would the User specify [type in] the Text content, or select an already-existing Text object, or would it be determined from some characteristic of each Mline, or ...?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 12:07:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433286#M40859</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-20T12:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433325#M40860</link>
      <description>&lt;P&gt;They are "street crossings", so lenght and rotations are different on eacht one, but all are in the same layer als o with text. At first they are just a polylines with labels:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118224iC566938CC29B7E13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So covert them to polylines. And then i add text, so at the end they look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118231i7CA23E94DF065E4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Text is always the same, just rotation is different. Also the same Layer. Yes, green ones are always two point Mlines in the same style but different lenght and rotation. I can easy put text and Mline to separated layers if needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 12:22:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11433325#M40860</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-20T12:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11434061#M40861</link>
      <description>&lt;P&gt;Not all my questions have been answered yet, but as a quick starting approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:TAML ; = Text At MultiLines
  (/ ss txt n ends end1 end2 midpt ang)
  (if (setq ss (ssget "_X" '((0 . "MLINE") (8 . "YourMlineLayer"))))
    (progn
      (setq txt (getstring "\nText content: "))
      (repeat (setq n (sslength ss))
        (setq
          ends (vlax-get (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n)))) 'Coordinates)
          end1 (list (car ends) (cadr ends) (caddr ends))
          end2 (cdddr ends)
          midpt (mapcar '/ (mapcar '+ end1 end2) '(2 2 2))
          ang (angle end1 end2)
        )
        (if (and (&amp;gt; ang (/ pi 2)) (&amp;lt;= ang (* pi 1.5))) (setq ang (+ ang pi))); plan-readable direction
        (command "_.text" "_c" ; ["_cen" or "_center" taken as Osnap call]
          (polar midpt (+ ang (/ pi 2)) (getvar 'textsize))
          "" (cvunit ang "radian" "degree") txt
        )
      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It does the Text in the current Style, which it assumes is defined &lt;EM&gt;without&lt;/EM&gt; a fixed height, and at the current Text Height, assuming that is an appropriate size, and on the current Layer.&amp;nbsp; Differences from those can be built in, as answers are provided.&amp;nbsp; Edit the Layer name to suit.&amp;nbsp; How well it places Text [center-justified, off the definition-point path of the Mline by the Text height] depends on the style and scale and justification of the Mlines -- if those are always the same, something can be built in.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 17:14:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11434061#M40861</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-20T17:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435043#M40862</link>
      <description>&lt;P&gt;I remembered that getting info on the mline widths was not straight forward, and basically you have to open the mline dictionary and look at the properties there, so can get the offset values and Top Zero Bottom setting. If the mline is set to Zero ie centre then can just get total width from entget looking at the&amp;nbsp; dxf 49, (49 . 3.0) (49 . -3.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of labelling the width of a mline close to what is being asked for.&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;&lt;LI-CODE lang="general"&gt;; dimension mline width 
; By Alanh Oct 2021

(defun c:mldima ( / olsnap dic obj xyz mlsty mlsc pt1 pt2 ang mp mp2 ent dic dict tot n)

(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)

(setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))

(setq dpss (ssget  '((0 . "MLINE"))))

(if (= dpss nil)
(alert "There are no mlines" )
(progn
(setvar 'blipmode 0)
(repeat (setq n (sslength dpss)) ; step through selection set
(setq obj (vlax-ename-&amp;gt;vla-object (ssname dpss (setq n (1- n)))))
(setq xyz (vlax-get obj 'Coordinates))
(setq mlsty (vlax-get obj 'StyleName))
(setq mlsc (vlax-get obj 'MLineScale))

(setq pt1 (list (nth 0 xyz)(nth 1 xyz)))
(setq pt2 (list (nth 3 xyz)(nth 4 xyz)))
(setq ang (- (angle pt1 pt2)(/ pi 2.0)))
(setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5)))

(setq dict (dictsearch (cdr (assoc -1 dic)) mlsty ))
(setq tot 0.0)
(foreach ent dict 
(if (= (car ent) 49)
(setq tot (+ tot (abs (cdr ent))))
)
)
(setq tot (* mlsc tot))

(setq mp2 (polar mp ang tot))

(command "dimaligned" mp mp2 mp)
)
)
)

(setvar 'osmode oldsnap)

(princ)
)
(c:mldima)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 03:24:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435043#M40862</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-09-21T03:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435409#M40863</link>
      <description>&lt;P&gt;Im sorry Im not very advanced in it. I try to answer rest of questions:&lt;/P&gt;&lt;P&gt;This is text Information:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118629i8BDA5386AD5FC25B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mlines are always the same width just length may vary. But length variations doesn''t matter for the text. Text stay always the same size as shown above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 07:47:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435409#M40863</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-21T07:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435419#M40864</link>
      <description>&lt;P&gt;And this is the information about Mlines. They are 1m width.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118632iAE65518811124C0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 07:55:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435419#M40864</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-21T07:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435447#M40865</link>
      <description>&lt;P&gt;Hey, I tried code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118654iBAE3FB899C3D5C9F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;it recognize Mlines beautifully and add text to all of it. But is it possible to add text&amp;nbsp;&lt;SPAN&gt;height to 1.25m and distance 1m from Mlines?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 08:58:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435447#M40865</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-21T08:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435860#M40866</link>
      <description>&lt;P&gt;And is your DRILLING MultiLine Style defined something like this in the MLSTYLE dialog box?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1663760174812.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118730i684E88BD116FE0C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1663760174812.png" alt="Kent1Cooper_0-1663760174812.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Specifically, are the Offsets plus &amp;amp; minus &lt;STRONG&gt;0.5&lt;/STRONG&gt;, so that we can count on the scale assigned to a give Mline to be the actual spacing between its edges, and the edges centered around the virtual line between defined endpoints?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:38:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435860#M40866</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-21T11:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435877#M40867</link>
      <description>&lt;P&gt;If the answer to my previous question is yes, and if the current Text Style will always be without a fixed height, and if a meter is your drawing unit, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:TAML ; = Text At MultiLines
  (/ ss txt n ends end1 end2 midpt ang)
  (if (setq ss (ssget "_X" '((0 . "MLINE") (8 . "YourMlineLayer"))))
    (progn
      (setq txt (getstring "\nText content: "))
      (repeat (setq n (sslength ss))
        (setq
          mlobj (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n))))
          ends (vlax-get mlobj 'Coordinates)
          end1 (list (car ends) (cadr ends) (caddr ends))
          end2 (cdddr ends)
          midpt (mapcar '/ (mapcar '+ end1 end2) '(2 2 2))
          ang (angle end1 end2)
        )
        (if (and (&amp;gt; ang (/ pi 2)) (&amp;lt;= ang (* pi 1.5))) (setq ang (+ ang pi))); plan-readable direction
        (command "_.text" "_c" ; ["_cen" or "_center" taken as Osnap call]
          (polar midpt (+ ang (/ pi 2)) (1+ (/ (vlax-get mlobj 'MlineScale) 2)))
          1.25 (cvunit ang "radian" "degree") txt
        )
      )
    )
  )
  (princ)
)
&lt;/LI-CODE&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="Kent1Cooper_0-1663760647310.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1118732iBE3BA8E74AFFCF4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1663760647310.png" alt="Kent1Cooper_0-1663760647310.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:46:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11435877#M40867</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-21T11:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Text to multiple Mline's</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11436045#M40868</link>
      <description>&lt;P&gt;Stunning! You are&amp;nbsp;magician! Thank you very much&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 12:50:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-text-to-multiple-mline-s/m-p/11436045#M40868</guid>
      <dc:creator>g.dauksaite8AZKZ</dc:creator>
      <dc:date>2022-09-21T12:50:01Z</dc:date>
    </item>
  </channel>
</rss>

