<?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: I could not make it with Text count command so can anyone find a solution for this. in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12249860#M23982</link>
    <description>&lt;P&gt;I would look at a custom lisp get a string and change last character, re the 001, you can do this by taking into account the number in a cond and convert to a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this the 12 &amp;amp; 13 were not in correct order if I select all in one go. A pick pick works fine.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:wow ( / )
(setq str (getstring "\nEnter character to look for "))
(setq numasc (ascii str))
(setq num (getint "\nEnter start number "))
(setq ss (ssget '((0 . "*Text"))))
(if (= ss nil)
(alert "No text selected ")
(repeat (setq x (sslength ss))
(setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq x (- x 1)))))
(setq str (vlax-get obj 'textstring))
(setq pos (vl-string-position numasc str))
(setq strst (substr str 1 pos))
(setq strend (substr str (+ pos 2)))
(cond 
((&amp;lt; num 10)(setq str (strcat strst "00" (rtos num 2 0) strend)))
((&amp;lt; num 100)(setq str (strcat strst "0" (rtos num 2 0) strend)))
((&amp;gt; num 99)(setq str (strcat strst (rtos num 2 0) strend)))
)
(vlax-put obj 'textstring str)
(setq num (1+ num))
)
)
(princ)
)
(c:wow)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 04:39:34 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2023-09-19T04:39:34Z</dc:date>
    <item>
      <title>I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12249094#M23981</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Dears,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;I have attached a drawing which is not able to create sequential numbers using tcount command. &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;i need to mention the sequential number in the 3rd draw as "modified". is it possible?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 19:15:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12249094#M23981</guid>
      <dc:creator>s_manoosmanoos</dc:creator>
      <dc:date>2023-09-18T19:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12249860#M23982</link>
      <description>&lt;P&gt;I would look at a custom lisp get a string and change last character, re the 001, you can do this by taking into account the number in a cond and convert to a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this the 12 &amp;amp; 13 were not in correct order if I select all in one go. A pick pick works fine.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:wow ( / )
(setq str (getstring "\nEnter character to look for "))
(setq numasc (ascii str))
(setq num (getint "\nEnter start number "))
(setq ss (ssget '((0 . "*Text"))))
(if (= ss nil)
(alert "No text selected ")
(repeat (setq x (sslength ss))
(setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq x (- x 1)))))
(setq str (vlax-get obj 'textstring))
(setq pos (vl-string-position numasc str))
(setq strst (substr str 1 pos))
(setq strend (substr str (+ pos 2)))
(cond 
((&amp;lt; num 10)(setq str (strcat strst "00" (rtos num 2 0) strend)))
((&amp;lt; num 100)(setq str (strcat strst "0" (rtos num 2 0) strend)))
((&amp;gt; num 99)(setq str (strcat strst (rtos num 2 0) strend)))
)
(vlax-put obj 'textstring str)
(setq num (1+ num))
)
)
(princ)
)
(c:wow)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 04:39:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12249860#M23982</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-09-19T04:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12253907#M23983</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I see what you mean.&amp;nbsp; If the convention should always be from left to right, then rather than pick pick pick how about sorting the objects from left to right before processing?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 14:41:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12253907#M23983</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2023-09-20T14:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12254712#M23984</link>
      <description>&lt;P&gt;The same questions which is raised by Mr&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;,I wanted to ask to Mr&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we sort it out?&lt;span class="lia-unicode-emoji" title=":smiling_face_with_halo:"&gt;😇&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 20:19:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12254712#M23984</guid>
      <dc:creator>s_manoosmanoos</dc:creator>
      <dc:date>2023-09-20T20:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12254915#M23985</link>
      <description>&lt;P&gt;I'm sure&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;knows how to do the sorting...&lt;/P&gt;
&lt;P&gt;Convert the selection set to a list like '((ename x)(ename x) etc.) and sort the list from lowest X to highest X, then process the sorted list.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 22:29:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12254915#M23985</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2023-09-20T22:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12256115#M23986</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;check the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:replace_@_x_lr_number (/ m_text_sset m_text_start_index total_digits step)
	(sssetfirst)
	(if (and 
			(sssetfirst nil (ssget '((0 . "*text"))))
			(setq m_text_sset (ssget "_i" '((1 . "*`@*"))))
			(null (sssetfirst))
		)
		(progn
			(setq m_text_start_index 1
				  total_digits "000"
				  step 1
			)
			(mapcar '(lambda (m_text)
						(progn
							(vla-put-textstring m_text
												(vl-string-subst (strcat (substr total_digits 
																				 1 
																				 (- (strlen total_digits) 
																				 	(strlen (itoa m_text_start_index))
																				 )
																		 ) 
																		 (itoa m_text_start_index)
																 )
																 "@"
																 (vla-get-textstring m_text)
												)
							)
							(setq m_text_start_index (+ step m_text_start_index))
						)
					 )
					 (vl-sort (mapcar 'vlax-ename-&amp;gt;vla-object 
									(vl-remove-if 'listp (mapcar 'cadr (ssnamex m_text_sset)))
							  )
							 '(lambda (m_text_1 m_text_2)
							  	(&amp;lt; (car (vlax-get m_text_1 'insertionpoint)) (car (vlax-get m_text_2 'insertionpoint)))
							  )
					 )
			)

		)
		(sssetfirst)
	)
	(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 12:15:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12256115#M23986</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-09-21T12:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: I could not make it with Text count command so can anyone find a solution for this.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12257861#M23987</link>
      <description>&lt;P&gt;As John suggested there is another way to select and make sure of labelling in a user order, and that is to use SSGET "F" then compare a intersection point distance.&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;; By AlanH Sept 2023
; update a character in a string to an increasing number

(defun c:wow ( / )
(setq str (getstring "\nEnter character to look for "))
(setq numasc (ascii str))

(setq num (getint "\nEnter start number "))

(setq pt1 (getpoint "\nPick 1st drag point ") pt2 (getpoint pt1 "\nPick 2nd point "))
(setq ang (angle pt1 pt2))
(setq pt3 (polar pt2 (+ ang (/ pi 2.)) 1.))
(setq pt4 (polar pt1 (+ ang (/ pi 2.)) 1.))
(setq ss (ssget "CP" (list pt1 pt2 pt3 pt4 pt1) '((0 . "*Text"))))

(if (= ss nil)
 (alert "No text selected ")
  (progn
   (setq lst '())
   (repeat (setq x (sslength ss))
    (setq ent (ssname ss (setq x (- x 1))))
    (setq obj (vlax-ename-&amp;gt;vla-object ent))
    (setq inspt (vlax-get obj 'insertionpoint))
    (setq dist (distance pt1 inspt))
    (setq lst (cons (list dist obj) lst))
   )
   (setq lst (vl-sort lst '(lambda (x y) (&amp;lt; (car x)(car y)))))
   (foreach val lst
    (setq str (vlax-get (cadr val) 'textstring))
    (setq pos (vl-string-position numasc str))
    (setq strst (substr str 1 pos))
    (setq strend (substr str (+ pos 2)))
    (cond 
     ((&amp;lt; num 10)(setq str (strcat strst "00" (rtos num 2 0) strend)))
     ((&amp;lt; num 100)(setq str (strcat strst "0" (rtos num 2 0) strend)))
     ((&amp;gt; num 99)(setq str (strcat strst (rtos num 2 0) strend)))
    )
   (vlax-put (cadr val) 'textstring str)
   (setq num (1+ num))
   )
  )
)
(princ)
)

(c:wow)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used "CP" as found odd occasions missed some text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 02:29:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/i-could-not-make-it-with-text-count-command-so-can-anyone-find-a/m-p/12257861#M23987</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-09-22T02:29:54Z</dc:date>
    </item>
  </channel>
</rss>

