<?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: Diesel to show nth last letter in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272289#M23615</link>
    <description>Hello sorry for the late reply, been a busy couple days,&lt;BR /&gt;&lt;BR /&gt;What is LData, this is a new term to me and I can't find an explanation of it anywhere.&lt;BR /&gt;&lt;BR /&gt;I am also trying to imbed this within a Block so that no lisps will be required, it would just become an automatic thing which updates on all drawings as not everyone at my workplace understands how to use lisps yet</description>
    <pubDate>Thu, 28 Sep 2023 10:16:31 GMT</pubDate>
    <dc:creator>kieran.leadbetter</dc:creator>
    <dc:date>2023-09-28T10:16:31Z</dc:date>
    <item>
      <title>Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12266550#M23610</link>
      <description>&lt;P&gt;Good Morning, I was wondering if anyone may have a diesel code which will always show the n'th letter of a file name&amp;nbsp;&lt;STRONG&gt;AFTER&amp;nbsp;&lt;/STRONG&gt;a specific part of text&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Drawing_Plan_Rev_&lt;STRONG&gt;A&lt;/STRONG&gt;.dwg&lt;BR /&gt;&lt;BR /&gt;I currently have this diesel code which always shows a specific charater n'th, but it requires me to create a variant for each type of file name length, as well as a code which shows the n'th last character&lt;BR /&gt;&lt;BR /&gt;$(substr,$(getvar,"dwgname"),17,$(-,$(strlen,$(getvar,"dwgname")),20))&lt;BR /&gt;&lt;BR /&gt;$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),4),1)&lt;BR /&gt;&lt;BR /&gt;If possible however, would it be possible for someone to create and explain a diesel code to show the character after the characters "Rev_",&amp;nbsp; where the "_" is indicated with a 'space' within a file name.&lt;BR /&gt;&lt;BR /&gt;If anyone can help with this it would be much appreciated.&lt;BR /&gt;Kind Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 08:59:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12266550#M23610</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-09-26T08:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12267331#M23611</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12891562"&gt;@kieran.leadbetter&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does not seem possible to modify your current diesel expressions to improve them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where is your diesel function currently residing? I.E. Are you showing it in a Text object? MText? Title Block?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Give more context of what/where you're trying to show your current Rev.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 13:56:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12267331#M23611</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2023-09-26T13:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12268308#M23612</link>
      <description>&lt;P&gt;Find your answer using LISP (loop using VL-STRING-SEARCH).&lt;/P&gt;&lt;P&gt;Set the built-in variable USERS1 to the answer.&lt;/P&gt;&lt;P&gt;Use DIESEL to display the answer $(getvar,users1)&lt;/P&gt;&lt;P&gt;Place this LISP inside acaddoc.lsp or S::STARTUP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;users(1-5), userr(1-5), and useri(1-5) are designed for such a purpose.&lt;/P&gt;&lt;P&gt;Custom fields will also work but can be buggy when refreshing/displaying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 20:48:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12268308#M23612</guid>
      <dc:creator>scot-65</dc:creator>
      <dc:date>2023-09-26T20:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12269013#M23613</link>
      <description>&lt;P&gt;Using Ldata can be more reliable than the User function and it is saved in the dwg. Any code can overwrite the User functions. You make the data name up so can be very obscure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (vlax-ldata-list "AlanH")
(princ)
(progn (alert " Something is wrong \n \n the data associated with the rectangs is not available \n \n Will now exit")(exit))
)

(vlax-ldata-put "AlanH" "Ahscale" sc)

(setq ahsc (vlax-ldata-get "AlanH" "Ahscale"))
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Sep 2023 05:25:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12269013#M23613</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-09-27T05:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12269966#M23614</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12891562"&gt;@kieran.leadbetter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... show the n'th letter of a file name&amp;nbsp;&lt;STRONG&gt;AFTER&amp;nbsp;&lt;/STRONG&gt;a specific part of text&lt;/P&gt;
&lt;P&gt;Drawing_Plan_Rev_&lt;STRONG&gt;A&lt;/STRONG&gt;.dwg&lt;BR /&gt;.... would it be possible for someone to create and explain a diesel code to show the character after the characters "Rev_",&amp;nbsp; where the "_" is indicated with a 'space' within a file name.&lt;BR /&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you can use AutoLisp instead of Diesel, the&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (vl-string-position)&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;function can search a string &lt;STRONG&gt;&lt;EM&gt;from the end&lt;/EM&gt;&lt;/STRONG&gt;, and locate the &lt;EM&gt;last&lt;/EM&gt; instance of any specified character [by its ASCII number], whether your &lt;STRONG&gt;_&lt;/STRONG&gt; or a space or anything else, regardless of the overall length of the string.&amp;nbsp; It can then use that position to extract everything after that character.&amp;nbsp; If it needs to be specifically after "Rev_", not merely the last underscore [or space], then&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt; (vl-string-search)&lt;/STRONG&gt; &lt;/FONT&gt;is what you want, as already suggested.&amp;nbsp; It can't search &lt;EM&gt;from the end&lt;/EM&gt;, but unless "Rev_" might occur more than once in the string, that wouldn't matter.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 12:28:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12269966#M23614</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-09-27T12:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272289#M23615</link>
      <description>Hello sorry for the late reply, been a busy couple days,&lt;BR /&gt;&lt;BR /&gt;What is LData, this is a new term to me and I can't find an explanation of it anywhere.&lt;BR /&gt;&lt;BR /&gt;I am also trying to imbed this within a Block so that no lisps will be required, it would just become an automatic thing which updates on all drawings as not everyone at my workplace understands how to use lisps yet</description>
      <pubDate>Thu, 28 Sep 2023 10:16:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272289#M23615</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-09-28T10:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272291#M23616</link>
      <description>My diesel code is just an MText inside a block, I also have a few which are attributes within blocks but they all function identically from what I can see, just regen and its worked so far unless I've just gotten lucky</description>
      <pubDate>Thu, 28 Sep 2023 10:17:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272291#M23616</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-09-28T10:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272298#M23617</link>
      <description>Hello sorry for the late reply, and thank you for a really indepth explanation.&lt;BR /&gt;&lt;BR /&gt;I will try messing around with writing up Lisps a bit more as it is very basic commands I use it for unless I request help from others online.&lt;BR /&gt;&lt;BR /&gt;Do you know of a Diesel method which may achieve the same goal however as I am attempting to imbed this into all my templates and files so that the block will become fully automatic and run in the background as not everyone at my workplace understands lisps aswell, making it difficult to make this a workplace standard if this makes sense</description>
      <pubDate>Thu, 28 Sep 2023 10:20:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272298#M23617</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-09-28T10:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272328#M23618</link>
      <description>&lt;P&gt;The only way I see to improve it is to use &lt;STRONG id="GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72__GUID-1497F2C7-223A-4D43-871A-E385907BB2D6" class="ph b"&gt;&lt;SPAN class="pun"&gt;$(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;eq&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;EM id="GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72__GUID-17A515F8-1284-4473-A2C4-EE0392A581D1" class="ph i"&gt;&lt;SPAN class="pln"&gt;val1&lt;/SPAN&gt;&lt;/EM&gt;&lt;STRONG id="GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72__GUID-3B699BBE-3865-4CE6-BB2D-6C475E07976D" class="ph b"&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;EM id="GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72__GUID-62A75AD0-9E06-4F64-B6DC-308AE3069E83" class="ph i"&gt;&lt;SPAN class="pln"&gt;val2&lt;/SPAN&gt;&lt;/EM&gt;&lt;STRONG id="GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72__GUID-8419886C-D24B-4126-8AAE-AC1786751013" class="ph b"&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if 17-20 = Rev,
&amp;nbsp; then return 22
&amp;nbsp; else if 18-21 = Rev,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;then return 23
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if 19-22 = Rev,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;     then ...
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way, you can create a single formula for a few positions...&lt;/P&gt;
&lt;P&gt;It is very cumbersome... the list of DIESEL functions is very short:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72" target="_blank" rel="noopener"&gt;HERE&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 13:04:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272328#M23618</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-09-28T13:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272383#M23619</link>
      <description>&lt;P&gt;Maybe this in a autoload lisp. Then look at each item.&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;; thanks to Lee-mac for this defun
(defun csv-&amp;gt;lst ( str / pos )
(if (setq pos (vl-string-position 95 str))
    (cons (substr str 1 pos) (csv-&amp;gt;lst (substr str (+ pos 2))))
    (list str)
    )
)

(setq str "Drawing_Plan_Rev_A.dwg")
(setq lst (csv-&amp;gt;lst str))
("Drawing" "Plan" "Rev" "A.dwg")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 11:16:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272383#M23619</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-09-28T11:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Diesel to show nth last letter</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272635#M23620</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;n'th letter of a file name&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;AFTER&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;a specific part of text to show where?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 13:44:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-to-show-nth-last-letter/m-p/12272635#M23620</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-09-28T13:44:20Z</dc:date>
    </item>
  </channel>
</rss>

