<?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: iLogic Code runs only once per drawing file in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932818#M178436</link>
    <description>&lt;P&gt;I changed the declaration for eText to Text rather than FormattedText. The code runs and changes the Font and size reliably but now all the break lines are gone. The multiline text is just one single line.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim eText As String = oPickedDrawingNote.Text
oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Out of curiosity I tried the following as well where the FormattedText was swapped. The result was that the fonts and font size changed every time, but the textbox now contained the xml tags as well and one single line again.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim eText As String = oPickedDrawingNote.FormattedText
oPickedDrawingNote.Text = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;So. my observation is that "FormattedText" cannot come consecutively. I'm curious to know why.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Dec 2025 02:51:35 GMT</pubDate>
    <dc:creator>rnandan</dc:creator>
    <dc:date>2025-12-05T02:51:35Z</dc:date>
    <item>
      <title>iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932379#M178431</link>
      <description>&lt;P&gt;I am attempting to update the font and font size of a general note object in a drawing. The note contains text in different fonts and sizes.&lt;BR /&gt;From the code below I was able to change it once. I retried the code with a different font and size but the text format does not change.&amp;nbsp;&lt;BR /&gt;It works on a different drawing though, but exactly once. I'm new to writing iLogic, so not sure what basic thing I'm missing.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim oPickedDrawingNote As Inventor.DrawingNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select text")
'oPickedDrawingNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter
Dim eText As String = oPickedDrawingNote.FormattedText

oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.12*2.54' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"

oDrawDoc.Update()&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 19:04:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932379#M178431</guid>
      <dc:creator>rnandan</dc:creator>
      <dc:date>2025-12-04T19:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932396#M178432</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16051821"&gt;@rnandan&lt;/a&gt;, I &lt;STRONG&gt;think&lt;/STRONG&gt; you just want to use the Text rather than FormatedText for this line, and everything else can stay the same.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps, Curtis&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;eText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 19:13:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932396#M178432</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2025-12-04T19:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932427#M178433</link>
      <description>&lt;P&gt;If you want to have a toggle, you can use something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;While&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;

	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingNote&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingNoteFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select text (ESC to continue)"&lt;/SPAN&gt;)

	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;IsNothing&lt;/SPAN&gt;(&lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;While&lt;/SPAN&gt;

	&lt;SPAN&gt;'oPickedDrawingNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;eText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt;
	
	&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt;)
	
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt;.&lt;SPAN&gt;Contains&lt;/SPAN&gt;(&lt;SPAN&gt;"Tahoma"&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt; = &lt;SPAN&gt;"&amp;lt;StyleOverride Font='Segoe Print' FontSize='0.12*2.54' Bold='False' Underline='False'&amp;gt;"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;eText&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"&amp;lt;/StyleOverride&amp;gt;"&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt; &lt;SPAN&gt;'if it's anything else, format like this:&lt;/SPAN&gt;
		&lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt; = &lt;SPAN&gt;"&amp;lt;StyleOverride Font='Tahoma' FontSize='0.12*2.54' Bold='False' Underline='False'&amp;gt;"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;eText&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"&amp;lt;/StyleOverride&amp;gt;"&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

	&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;while&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note too the logger line output might be something to be aware of, for seeing the formatting, etc.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_0-1764877510277.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602088i7F33CF83104B6A27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_0-1764877510277.png" alt="Curtis_Waguespack_0-1764877510277.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;See link for info about using the logger if that's new to you:&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=GUID-BE996AA3-DE49-4765-86A7-129DD7B42A4A" target="_blank"&gt;https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=GUID-BE996AA3-DE49-4765-86A7-129DD7B42A4A&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 19:51:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932427#M178433</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2025-12-04T19:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932818#M178436</link>
      <description>&lt;P&gt;I changed the declaration for eText to Text rather than FormattedText. The code runs and changes the Font and size reliably but now all the break lines are gone. The multiline text is just one single line.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim eText As String = oPickedDrawingNote.Text
oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Out of curiosity I tried the following as well where the FormattedText was swapped. The result was that the fonts and font size changed every time, but the textbox now contained the xml tags as well and one single line again.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim eText As String = oPickedDrawingNote.FormattedText
oPickedDrawingNote.Text = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;So. my observation is that "FormattedText" cannot come consecutively. I'm curious to know why.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 02:51:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932818#M178436</guid>
      <dc:creator>rnandan</dc:creator>
      <dc:date>2025-12-05T02:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932960#M178437</link>
      <description>&lt;P&gt;For a single line text (w/o any StyleOverrides), the "oPickedDrawingNote.Text" and "oPickedDrawingNote.FormattedText" is the same&lt;/P&gt;&lt;P&gt;That is the reason why your code initially works the first time. After the code ran, Text and FormattedText won't be the same anymore&lt;BR /&gt;&lt;BR /&gt;For multi-line text (w/o any StyleOverrides), the&amp;nbsp;"oPickedDrawingNote.Text" and "oPickedDrawingNote.FormattedText" is NOT the same .&lt;BR /&gt;FormattedText has additional line breaks "&amp;lt;Br\&amp;gt; inside that isn't shown in Text property.&lt;BR /&gt;&lt;BR /&gt;As for a solution, you can try below code&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
	Dim oPickedDrawingNote As Inventor.DrawingNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select text")
	
	'Logger.Info("Method2")
	Dim eText As String = oPickedDrawingNote.FormattedText
	Logger.Info(eText)
	
	'Remove All the styleoverrides
	Dim sText As String() = eText.Split("&amp;lt;StyleOverride ", StringSplitOptions.RemoveEmptyEntries)
	For Each subText In sText
		Dim sOldStyle As String = Left(subText, InStr(subText, "&amp;gt;") -1)
		eText = eText.Replace("&amp;lt;StyleOverride " &amp;amp; sOldStyle &amp;amp; "&amp;gt;", String.Empty)
		eText = eText.Replace("&amp;lt;/StyleOverride&amp;gt;", String.Empty)
	Next
	
	'Apply New Style Overrides
	oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I'm not too much familiar with the XML formatting, but it seems it is smart enough to apply the styleoverrides after the line breaks.&lt;BR /&gt;as an example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jnowel_0-1764917083322.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602193iD42C73A8F301AD40/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jnowel_0-1764917083322.png" alt="jnowel_0-1764917083322.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the Formatted text of that is&lt;/P&gt;&lt;LI-CODE lang="general"&gt;TEXT&amp;lt;Br/&amp;gt;TEST&lt;/LI-CODE&gt;&lt;P&gt;after the rule, the expected value of the FormattedText is&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;TEXT&amp;lt;Br/&amp;gt;TEST&amp;lt;/StyleOverride&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;but surprising enough, the FormattedText Property is able to "correct" it to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3'&amp;gt;TEXT&amp;lt;/StyleOverride&amp;gt;&amp;lt;Br/&amp;gt;&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3'&amp;gt;TEST&amp;lt;/StyleOverride&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;-----------&lt;BR /&gt;btw, I think it cannot do math expressions for the font size in XML format directly. so have to separate it (or just assign the computed value)&lt;/P&gt;&lt;P&gt;so instead of doing it as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.12*2.54' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;do it as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='" &amp;amp; 0.12*2.54 &amp;amp; "' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 07:04:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932960#M178437</guid>
      <dc:creator>jnowel</dc:creator>
      <dc:date>2025-12-05T07:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932981#M178438</link>
      <description>&lt;P&gt;Hi jnowel,&lt;BR /&gt;The code returned a compile error.&lt;BR /&gt;&lt;BR /&gt;Error on Line 9 : Argument matching parameter 'separator' narrows from 'String' to '1-dimensional array of Char'.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 07:30:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932981#M178438</guid>
      <dc:creator>rnandan</dc:creator>
      <dc:date>2025-12-05T07:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932987#M178440</link>
      <description>&lt;P&gt;weird, it's working on my end w/o issues in Inventor 2026&lt;/P&gt;&lt;P&gt;anyway, try this instead&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim oPickedDrawingNote As Inventor.DrawingNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select text")

'Logger.Info("Method2")
Dim eText As String = oPickedDrawingNote.FormattedText
'Logger.Info(eText)

'Remove All the styleoverrides
'Dim sText As String() = eText.Split("&amp;lt;StyleOverride ", StringSplitOptions.RemoveEmptyEntries)
Dim sText As String() = eText.Split("&amp;lt;StyleOverride ")
For Each subText In sText
	If InStr(subText, "&amp;gt;") &amp;lt; 1 Then Continue For
	Dim sOldStyle As String = Left(subText, InStr(subText, "&amp;gt;") -1)
	eText = eText.Replace("&amp;lt;StyleOverride " &amp;amp; sOldStyle &amp;amp; "&amp;gt;", String.Empty)
	eText = eText.Replace("&amp;lt;/StyleOverride&amp;gt;", String.Empty)
Next

'Apply New Style Overrides
oPickedDrawingNote.FormattedText = "&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;" &amp;amp; eText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16051821"&gt;@rnandan&lt;/a&gt;&amp;nbsp;can you check this new line12&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 11:46:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13932987#M178440</guid>
      <dc:creator>jnowel</dc:creator>
      <dc:date>2025-12-05T11:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933208#M178447</link>
      <description>&lt;P&gt;I'm on Inventor 2024. The new code gave an error on line 13&lt;BR /&gt;&lt;BR /&gt;Argument 'Length' must be greater or equal to zero.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 11:27:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933208#M178447</guid>
      <dc:creator>rnandan</dc:creator>
      <dc:date>2025-12-05T11:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933223#M178448</link>
      <description>&lt;P&gt;weird. i though the current line12 will prevent that issue on line13.&lt;/P&gt;&lt;P&gt;can you send me the idw/dwg just to check what i missed?&lt;/P&gt;&lt;P&gt;anyway, i'll edit line12 to a different one in a minute&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 11:44:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933223#M178448</guid>
      <dc:creator>jnowel</dc:creator>
      <dc:date>2025-12-05T11:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933548#M178453</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5851906"&gt;@jnowel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm not too much familiar with the XML formatting...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5851906"&gt;@jnowel&lt;/a&gt;, in case it's helpful you can find some info for this online here:&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1" target="_blank"&gt;https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or you can find the same reference material, but a bit easier to read in your local API help by searching the API help for "Text Tags" or "XML Tags for FormattedText", etc.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_1-1764949322765.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602310i02E78D4EABE1773E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_1-1764949322765.png" alt="Curtis_Waguespack_1-1764949322765.png" /&gt;&lt;/span&gt;&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="Curtis_Waguespack_0-1764949301994.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602309iE6F1F171B20CF485/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_0-1764949301994.png" alt="Curtis_Waguespack_0-1764949301994.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 15:45:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933548#M178453</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2025-12-05T15:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933554#M178454</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16051821"&gt;@rnandan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm on Inventor 2024. The new code gave an error on line 13&lt;BR /&gt;&lt;BR /&gt;Argument 'Length' must be greater or equal to zero.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16051821"&gt;@rnandan&lt;/a&gt;&amp;nbsp;, here is a version of&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5851906"&gt;@jnowel&lt;/a&gt;'s code with some logger lines, this might help you determine what the issue is with line 13 ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_0-1764949951853.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602311i31189538DCC6A7AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_0-1764949951853.png" alt="Curtis_Waguespack_0-1764949951853.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;iLogic Logger reference:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=GUID-BE996AA3-DE49-4765-86A7-129DD7B42A4A" target="_blank" rel="nofollow noopener noreferrer"&gt;https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=GUID-BE996AA3-DE49-4765-86A7-129DD7B42A4A&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingNote&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingNoteFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select text"&lt;/SPAN&gt;)

&lt;SPAN&gt;'Logger.Info("Method2")&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;eText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt;
&lt;SPAN&gt;'Logger.Info(eText)&lt;/SPAN&gt;

&lt;SPAN&gt;'Remove All the styleoverrides&lt;/SPAN&gt;
&lt;SPAN&gt;'Dim sText As String() = eText.Split("&amp;lt;StyleOverride ", StringSplitOptions.RemoveEmptyEntries)&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;() = &lt;SPAN&gt;eText&lt;/SPAN&gt;.&lt;SPAN&gt;Split&lt;/SPAN&gt;(&lt;SPAN&gt;"&amp;lt;StyleOverride "&lt;/SPAN&gt;)
&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;sText&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" items in the split array:"&lt;/SPAN&gt;)&lt;/FONT&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;subText&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;sText&lt;/SPAN&gt;
	&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;subText&lt;/SPAN&gt;)&lt;/FONT&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;subText&lt;/SPAN&gt;, &lt;SPAN&gt;"&amp;gt;"&lt;/SPAN&gt;) &amp;lt; 1 &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOldStyle&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;subText&lt;/SPAN&gt;, &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;subText&lt;/SPAN&gt;, &lt;SPAN&gt;"&amp;gt;"&lt;/SPAN&gt;) -1)
	&lt;SPAN&gt;eText&lt;/SPAN&gt; = &lt;SPAN&gt;eText&lt;/SPAN&gt;.&lt;SPAN&gt;Replace&lt;/SPAN&gt;(&lt;SPAN&gt;"&amp;lt;StyleOverride "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sOldStyle&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"&amp;gt;"&lt;/SPAN&gt;, &lt;SPAN&gt;String&lt;/SPAN&gt;.&lt;SPAN&gt;Empty&lt;/SPAN&gt;)
	&lt;SPAN&gt;eText&lt;/SPAN&gt; = &lt;SPAN&gt;eText&lt;/SPAN&gt;.&lt;SPAN&gt;Replace&lt;/SPAN&gt;(&lt;SPAN&gt;"&amp;lt;/StyleOverride&amp;gt;"&lt;/SPAN&gt;, &lt;SPAN&gt;String&lt;/SPAN&gt;.&lt;SPAN&gt;Empty&lt;/SPAN&gt;)
&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;'Apply New Style Overrides&lt;/SPAN&gt;
&lt;SPAN&gt;oPickedDrawingNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt; = &lt;SPAN&gt;"&amp;lt;StyleOverride Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'&amp;gt;"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;eText&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"&amp;lt;/StyleOverride&amp;gt;"&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 16:02:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13933554#M178454</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2025-12-05T16:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Code runs only once per drawing file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13934231#M178464</link>
      <description>&lt;P&gt;I think i figured out why my previous line12 introduced some errors.&lt;BR /&gt;i only considered empty strings as the other values of subText which isn't the case&lt;/P&gt;&lt;LI-CODE lang="general"&gt;If Len(subText) &amp;lt; 1 Then Continue For&lt;/LI-CODE&gt;&lt;P&gt;a single line with a combination of no styleoverride and styleoverrides can cause that error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and with the link&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_W&lt;/a&gt;&amp;nbsp;gave about the XML tags,&lt;BR /&gt;it reminded me that certain characters/symbols need their styleoverrides. and removing the styleoverride will cause an issue&lt;BR /&gt;the symbols are mostly these ones.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jnowel_1-1765003073754.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1602470i80EB14B658B7A4CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jnowel_1-1765003073754.png" alt="jnowel_1-1765003073754.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as for the updated code. it will look like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim oPickedDrawingNote As Inventor.DrawingNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select text")

'Logger.Info("Method3")
Dim eText As String = oPickedDrawingNote.FormattedText
'Logger.Info(eText)

'Change All the styleoverrides, add Styleovverride when there is none applied
Dim sText As String() = eText.Split("&amp;lt;StyleOverride ")
Dim sNewStyle As String = "Font='Tahoma' FontSize='0.3' Bold='False' Underline='False'"
Dim sNewStyleSymbols As String = "Font='AIGDT' FontSize='0.3' Bold='False' Underline='False'" 'this is used for the 'special' drafting symbols that needs the AIGDT font to work
Dim eTextNew As String = String.Empty

For Each subText In sText
	'Logger.Info(subText)
	If Not subText.Contains("'&amp;gt;") Then
		'This infers that no style override is found, so apply the styleoverride
		subText = "&amp;lt;StyleOverride " &amp;amp; sNewStyle &amp;amp; "&amp;gt;" &amp;amp; subText &amp;amp; "&amp;lt;/StyleOverride&amp;gt;"
	Else
		'With Styleoverrides
		Dim sOldStyle As String = Left(subText, InStr(subText, "&amp;gt;") -1)
		If sOldStyle.Contains("Font='AIGDT'") Then
			subText = "&amp;lt;StyleOverride " &amp;amp; subText.Replace(sOldStyle, sNewStyleSymbols)
		Else
			subText = "&amp;lt;StyleOverride " &amp;amp; subText.Replace(sOldStyle, sNewStyle)
		End If
		
		'Now we need to check if the subText has some portion w/o any styleoverrides
		Dim sText2 As String() = subText.Split("&amp;lt;/StyleOverride&amp;gt;")
		sText2(0) = sText2(0) &amp;amp; "&amp;lt;/StyleOverride&amp;gt;" 'this is the portion where the current styleoverride applies
		If sText2.Length &amp;gt; 1 Then 'this is just to prevent some error (as i'm not 100% sure the Split will always return 2 items as 2nd item, sText2(1), might be an empty string).
			sText2(1) = "&amp;lt;StyleOverride " &amp;amp; sNewStyle &amp;amp; "&amp;gt;" &amp;amp; sText2(1) &amp;amp; "&amp;lt;/StyleOverride&amp;gt;" 'this portion is something the styleoverride isn't applied yet so add the styleoverride
			subText = sText2(0) &amp;amp; sText2(1)
		Else
			subText = sText2(0)
		End If
		
	End If
	eTextNew &amp;amp;= subText
Next

'Apply New Style Overrides
oPickedDrawingNote.FormattedText = eTextNew&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Dec 2025 06:47:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-code-runs-only-once-per-drawing-file/m-p/13934231#M178464</guid>
      <dc:creator>jnowel</dc:creator>
      <dc:date>2025-12-06T06:47:43Z</dc:date>
    </item>
  </channel>
</rss>

