<?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 Replace a style in the Part Document using API in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9820304#M117221</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;is there a way to perform this action (replace Style) in the part document, but by code?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick1323_0-1603453447704.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/835399i1CF351E74D3873AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick1323_0-1603453447704.png" alt="Patrick1323_0-1603453447704.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Oct 2020 11:46:00 GMT</pubDate>
    <dc:creator>Patrick1323</dc:creator>
    <dc:date>2020-10-23T11:46:00Z</dc:date>
    <item>
      <title>Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9820304#M117221</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;is there a way to perform this action (replace Style) in the part document, but by code?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick1323_0-1603453447704.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/835399i1CF351E74D3873AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick1323_0-1603453447704.png" alt="Patrick1323_0-1603453447704.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 11:46:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9820304#M117221</guid>
      <dc:creator>Patrick1323</dc:creator>
      <dc:date>2020-10-23T11:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9825894#M117309</link>
      <description>&lt;P&gt;i could not find a command for Replacing a text style. But i found a way to delete the style and copy the other. it works like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;originalStyleName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"ReplaceMe"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;replaceBy&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"replaceWithMe"&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Document&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;def&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;PartComponentDefinition&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;style&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;TextStyles&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;originalStyleName&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;replaceBy&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;

&lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Delete&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Copy&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;originalStyleName&lt;/SPAN&gt;)&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 21:52:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9825894#M117309</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2020-10-26T21:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9826386#M117312</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN class=""&gt;JelteDeJong,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;thanks for your response, unfortunately I can't delete styles which are in use.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;This will throw an exception:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;textStyleOrg.Delete()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know there's no way to create a "Standard" like for the drawing styles, and set that new standard as the active one. Then I would be able to delete the old style...&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 06:56:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9826386#M117312</guid>
      <dc:creator>Patrick1323</dc:creator>
      <dc:date>2020-10-27T06:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9829098#M117363</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Patrick1323,&lt;/P&gt;&lt;P&gt;I don't know what you want exatly, but could it be a solution to redefine the Style in Style library as you want and then Update the Stile from Style library?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;extStyleOrg.UpdateFromGlobal()&lt;/LI-CODE&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Wolfgang&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 07:47:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9829098#M117363</guid>
      <dc:creator>wolfgang_nickl</dc:creator>
      <dc:date>2020-10-28T07:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9831628#M117415</link>
      <description>Hello Wolfgang,&lt;BR /&gt;thats not want to do, I want to delete a style in use.&lt;BR /&gt;&lt;BR /&gt;best regards&lt;BR /&gt;Patrick</description>
      <pubDate>Thu, 29 Oct 2020 06:27:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9831628#M117415</guid>
      <dc:creator>Patrick1323</dc:creator>
      <dc:date>2020-10-29T06:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a style in the Part Document using API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9832225#M117434</link>
      <description>&lt;P&gt;does this work for you:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;originalStyleName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Note Text (ANSI) - 3DA"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;replaceBy&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Sketch Text (ANSI) - 3DA"&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Document&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;def&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;PartComponentDefinition&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;style&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;TextStyles&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;originalStyleName&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;replaceBy&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Style&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;

&lt;SPAN style="color: #808080;"&gt;' in this part all properties from textStyleNew are copyed to textStyleOrg&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;type&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;Type&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;GetType&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;TextStyle&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;Reflection&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;PropertyInfo&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;type&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetProperties&lt;/SPAN&gt;()
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;CanWrite&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Name"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Or&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Name&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"_Name"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
            &lt;SPAN style="color: #ff0000;"&gt;Continue&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt;
        &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;

        &lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;obj&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetValue&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;textStyleNew&lt;/SPAN&gt;)
        &lt;SPAN style="color: #800000;"&gt;prop&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SetValue&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;textStyleOrg&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;obj&lt;/SPAN&gt;)

    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
&lt;SPAN style="color: #808080;"&gt;' both styles are now the same.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 12:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-a-style-in-the-part-document-using-api/m-p/9832225#M117434</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2020-10-29T12:45:26Z</dc:date>
    </item>
  </channel>
</rss>

