<?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 Remane Text style text to text_ and replace it with Text with ilogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13044224#M172190</link>
    <description>&lt;P&gt;Remane Text style text to text_ and replace it with Text with ilogic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this problem , that some style wouldn´t update.&amp;nbsp; but for some unknow reason if I rename a style call text&amp;nbsp; and then replace this style with Text that seems to create it self. It can now update almost all of the style except this style.. Still have no idear how to fix this one. but I have a other post for that one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="Darkforce_the_ilogic_guy_0-1727270201997.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1413872iE1C1958442C850AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_0-1727270201997.png" alt="Darkforce_the_ilogic_guy_0-1727270201997.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2024 13:18:33 GMT</pubDate>
    <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
    <dc:date>2024-09-25T13:18:33Z</dc:date>
    <item>
      <title>Remane Text style text to text_ and replace it with Text with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13044224#M172190</link>
      <description>&lt;P&gt;Remane Text style text to text_ and replace it with Text with ilogic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this problem , that some style wouldn´t update.&amp;nbsp; but for some unknow reason if I rename a style call text&amp;nbsp; and then replace this style with Text that seems to create it self. It can now update almost all of the style except this style.. Still have no idear how to fix this one. but I have a other post for that one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="Darkforce_the_ilogic_guy_0-1727270201997.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1413872iE1C1958442C850AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Darkforce_the_ilogic_guy_0-1727270201997.png" alt="Darkforce_the_ilogic_guy_0-1727270201997.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 13:18:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13044224#M172190</guid>
      <dc:creator>Darkforce_the_ilogic_guy</dc:creator>
      <dc:date>2024-09-25T13:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Remane Text style text to text_ and replace it with Text with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13113848#M173392</link>
      <description>You will need to change it in the Stylelibrary first, with the stylelibrarymanager found under the Autodesk Programs.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Oct 2024 21:11:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13113848#M173392</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2024-10-28T21:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remane Text style text to text_ and replace it with Text with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13115445#M173414</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5708980"&gt;@Darkforce_the_ilogic_guy&lt;/a&gt;.&amp;nbsp; I tend to agree that there does not appear to be a 'one size fits all' type of Inventor API routine that can magically fix all possible 'style' related issues by code.&amp;nbsp; It seems like we still can not do everything that we can do manually, within that Styles &amp;amp; Standards dialog, by code yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also have a pesky style like that in one of my drawing templates that exists in both places, and seems like it will never fully update properly, so that both are in sync with each other, for some reason.&amp;nbsp; I have read lots of posts about this issue over the years, and have tried lots of things in my attempts to eliminate that message about it, but it just seems like nothing I do works.&amp;nbsp; All sheet formats have been deleted.&amp;nbsp; All sketch symbol definitions have been deleted.&amp;nbsp; All border definitions except the 'main' one have been deleted.&amp;nbsp; All title block definitions have been deleted except the 'main' one.&amp;nbsp; I had those only two remaining border/title block definition sketches open/active while performing the global 'update from style library' actions, and have done those update steps outside of those sketches.&amp;nbsp; When using the main 'Purge' tool in the Manage tab &amp;gt; Styles &amp;amp; Standards panel, there is nothing in the list to purge.&amp;nbsp; Still that one style remains in the list every time when using that main Update tool in that same panel.&amp;nbsp; There are only two 'Standard' styles that are considered 'local' within the Styles &amp;amp; Standards editor dialog, and the one that is not 'active' will not allow me to 'purge' it, even though as far as I can determine, I can not find anything in this entire document that is 'dependent' on it or 'using' it.&amp;nbsp; Even some of the 'local' styles that only exist within that 'non-active' standard style, will not allow me the option to purge them, for some reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I will still share an example code below that sounds like it is at least trying to do the process you described in your original post here.&amp;nbsp; It will only run when a drawing is active.&amp;nbsp; It then attempts to find an existing TextStyle named "text" (to be renamed, and replaced), and one named "Text" (to replace the other one with).&amp;nbsp; If it can not find either one, it will write something to the iLogic Log window about it, then exit the rule.&amp;nbsp; It will then try to rename the TextStyle named "text" to "text_", and if that fails, it will also report it, then exit the rule.&amp;nbsp; It will the try to replace the TextStyle named "text_" with the TextStyle named "Text".&amp;nbsp; If that works, it will then try to update the drawing.&amp;nbsp; I have not tested this rule yet myself, because I do not want to mess with any of my TextStyles.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oDSMgr As DrawingStylesManager = oDDoc.StylesManager
	Dim oTSs As TextStylesEnumerator = oDSMgr.TextStyles
	Dim sOrigTS_Name As String = "text"
	Dim sRenameTo As String = "text_"
	Dim sReplacementTS_Name As String = "Text"
	Dim oOrigTS, oReplacementTS As TextStyle
	Try : oOrigTS = oTSs.Item(sOrigTS_Name) : Catch : End Try
	If oOrigTS Is Nothing Then
		Logger.Debug("Could not find existing TextStye named " &amp;amp; sOrigTS_Name)
		Return
	End If
	Try : oReplacementTS = oTSs.Item(sReplacementTS_Name) : Catch : End Try
	If oReplacementTS Is Nothing Then
		Logger.Debug("Could not find existing TextStye named " &amp;amp; sReplacementTS_Name)
		Return
	End If
	Try
		oOrigTS.Name = sRenameTo
		Logger.Info("Renamed TextStyle '" &amp;amp; sOrigTS_Name &amp;amp; " to '" &amp;amp; sRenameTo &amp;amp; "'.")
	Catch
		Logger.Error("Error renaming TextStyle '" &amp;amp; sOrigTS_Name &amp;amp; " to '" &amp;amp; sRenameTo &amp;amp; "'!")
		Return
	End Try
	Dim oToBeReplaced As ObjectCollection = oInvApp.TransientObjects.CreateObjectCollection
	oToBeReplaced.Add(oOrigTS)
	Try
		oDSMgr.ReplaceStyles(oToBeReplaced, oReplacementTS, PurgeReplacedStyles = True)
	Catch
		Logger.Error("Error replacing TextStyle '" &amp;amp; sRenameTo &amp;amp; " with '" &amp;amp; sReplacementTS_Name &amp;amp; "'!")
		Return
	End Try
	oDDoc.Update2(True)
	'oDDoc.Save()
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 14:23:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remane-text-style-text-to-text-and-replace-it-with-text-with/m-p/13115445#M173414</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-10-29T14:23:11Z</dc:date>
    </item>
  </channel>
</rss>

