<?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: API call for Set Icon / Icon Path for Button in Fabrication CADmep Forum</title>
    <link>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/11107524#M5012</link>
    <description>&lt;P&gt;Namespaces -&amp;gt; Autodesk Fabrication -&amp;gt; Item Class -&amp;gt; Item Methods -&amp;gt; SetImage Method&lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 03:37:59 GMT</pubDate>
    <dc:creator>dyoung</dc:creator>
    <dc:date>2022-04-15T03:37:59Z</dc:date>
    <item>
      <title>API call for Set Icon / Icon Path for Button</title>
      <link>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/11077179#M5004</link>
      <description>&lt;P&gt;Is there an API call to access/set the button icon? It is available in the GUI in two ways:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Main interface → MAP Buttons → Right-click, Button Report → Icon Path column&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-04-01 10.20.14 acad_5w60Y9zzcQ.png" style="width: 535px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1049352i638EDDFC059B9C28/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022-04-01 10.20.14 acad_5w60Y9zzcQ.png" alt="2022-04-01 10.20.14 acad_5w60Y9zzcQ.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-04-01 10.20.37 acad_hkcnhHrCR4.png" style="width: 880px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1049349i9F9D7596D36BBBBA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022-04-01 10.20.37 acad_hkcnhHrCR4.png" alt="2022-04-01 10.20.37 acad_hkcnhHrCR4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Edit Service Database → Service Information → Edit Service Template → Right-click a button&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-04-01 10.22.49 acad_kiZUsQEQwq.png" style="width: 320px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1049356i500365B27318C623/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022-04-01 10.22.49 acad_kiZUsQEQwq.png" alt="2022-04-01 10.22.49 acad_kiZUsQEQwq.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-04-01 10.23.03 acad_rQqI3jfxsw.png" style="width: 329px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1049357i8C34995F32C85F79/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022-04-01 10.23.03 acad_rQqI3jfxsw.png" alt="2022-04-01 10.23.03 acad_rQqI3jfxsw.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-04-01 10.23.31 acad_vPOpXhgmEz.png" style="width: 281px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1049358i415D9EEBAC276A39/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022-04-01 10.23.31 acad_vPOpXhgmEz.png" alt="2022-04-01 10.23.31 acad_vPOpXhgmEz.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears that the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;GetBase64ButtonImage()&lt;/STRONG&gt;&lt;/FONT&gt; method may return that image, but the documentation is not clear on that, and I have not tried it myself yet. There also appears to be a similar (inaccessible) method&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;internal unsafe string GetImagePath()&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot find any documentation in the API manual (C:\Program Files\Autodesk\Fabrication 2020\SDK\FabricationAPI.chm) that sets the icon path. Does such a property or method exist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edit: This is related to &lt;A href="https://forums.autodesk.com/t5/fabrication-cadmep-forum/assign-an-image-for-button-script/td-p/5747958" target="_blank" rel="noopener"&gt;a question&lt;/A&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/497935"&gt;@ssimleness&lt;/a&gt;&amp;nbsp;asked &lt;A href="https://forums.autodesk.com/t5/fabrication-cadmep-forum/assign-an-image-for-button-script/td-p/5747958" target="_blank" rel="noopener"&gt;several years ago&lt;/A&gt;, but mine is the API version of the question.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:51:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/11077179#M5004</guid>
      <dc:creator>steven.williams.as</dc:creator>
      <dc:date>2022-04-01T19:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: API call for Set Icon / Icon Path for Button</title>
      <link>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/11107524#M5012</link>
      <description>&lt;P&gt;Namespaces -&amp;gt; Autodesk Fabrication -&amp;gt; Item Class -&amp;gt; Item Methods -&amp;gt; SetImage Method&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 03:37:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/11107524#M5012</guid>
      <dc:creator>dyoung</dc:creator>
      <dc:date>2022-04-15T03:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: API call for Set Icon / Icon Path for Button</title>
      <link>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/12377670#M5404</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14397"&gt;@dyoung&lt;/a&gt;'s suggestion works to report the image assigned to the ITM itself and is true when the button only contains a single ITM (or is the first assigned to a button) and the button's Icon has&amp;nbsp;&lt;U&gt;not&lt;/U&gt; been changed with the Set Icon option&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11800801"&gt;@steven.williams.as&lt;/a&gt;&amp;nbsp;showed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for pointing out this internal method because I had the same question today. It does work, returning the button's true icon path! The method "&lt;STRONG&gt;internal unsafe string GetImagePath()&lt;/STRONG&gt;" can be used like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.Fabrication.DB;
using System;
using System.Reflection;

namespace MyNamespace
{
    public static class Methods
    {
        public static void GetIconPaths()
        {
            foreach (ServiceTemplate serviceTemplate in Autodesk.Fabrication.DB.Database.ServiceTemplates)
            {
                foreach (ServiceTab serviceTab in serviceTemplate.ServiceTabs)
                {
                    foreach (ServiceButton serviceButton in serviceTab.ServiceButtons)
                    {
                        Type buttonType = serviceButton.GetType();
                        MethodInfo methodInfo = buttonType.GetMethod("GetImagePath", BindingFlags.NonPublic | BindingFlags.Instance);
                        string iconPath = methodInfo.Invoke(serviceButton, null) as string;
                        //Do stuff here
                    }
                }
            }
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Edit: I forgot to mention that unfortunately I haven't found a way to set this property but maybe you can do it by modifying the items in the button and selecting the one with the image you want first. Or setting all of them to the same image with&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14397"&gt;@dyoung&lt;/a&gt;'s method, if that doesn't affect other buttons.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 23:58:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fabrication-cadmep-forum/api-call-for-set-icon-icon-path-for-button/m-p/12377670#M5404</guid>
      <dc:creator>MartinMagallanes</dc:creator>
      <dc:date>2023-11-14T23:58:55Z</dc:date>
    </item>
  </channel>
</rss>

