<?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: Relative path for folder in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351627#M46854</link>
    <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your great help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also found another solution for this by using:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;&amp;nbsp;
var iconPath40 = Path.Combine(outPutDirectory, "Icons\\Select2SectionBox.png");
Uri uriImage40 = new Uri(@iconPath40);&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Oct 2018 22:51:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-22T22:51:32Z</dc:date>
    <item>
      <title>Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349026#M46849</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am starting with some first Revit add in and one thing I am concerned is how to create the relative path for my icon url for my add in as following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; // Determine the data for a push button, include the name of the command to execute
                        PushButtonData pushButtonData51 = new PushButtonData("DetachModels", "DetachModels", thisAssemblyPath, "CherryBIMservices.BatchDetachedModel");

                        //Add push button to the ribbon panel
                        PushButton pushButton51 = ManagePanel.AddItem(pushButtonData51) as PushButton;

                        // Add a tool tip for a button
                        pushButton51.ToolTip = "Batch detach models";

                        // Add URL of image, set as Bitmap and set the image as the icon for the pushbutton
                        Uri uriImage51 = new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2017\CherryBIMservices\51.png");
                        BitmapImage bitmapImage51 = new BitmapImage(uriImage51);
                        pushButton51.LargeImage = bitmapImage51;&lt;/PRE&gt;&lt;P&gt;My question is how to replace the path : "&lt;/P&gt;&lt;PRE&gt;C:\ProgramData\Autodesk\Revit\Addins\2017\CherryBIMservices\51.png&lt;/PRE&gt;&lt;P&gt;by relative path.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cherry Truong&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 01:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349026#M46849</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-22T01:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349198#M46850</link>
      <description>&lt;P&gt;Dear Cherry,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend embedding your icon as an embedded resource:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/06/retrieve-embedded-resource-image.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2012/06/retrieve-embedded-resource-image.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2018/05/scaling-a-bitmap-for-the-large-and-small-image-icons.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2018/05/scaling-a-bitmap-for-the-large-and-small-image-icons.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you will have no need for any file path at all, and life will be easy and sweet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 05:40:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349198#M46850</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-10-22T05:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349743#M46851</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;replace&lt;/P&gt;&lt;PRE&gt;C:\ProgramData&lt;/PRE&gt;&lt;P&gt;With&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="typ"&gt;Environment&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;GetFolderPath&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Environment&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;SpecialFolder&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;CommonApplicationData&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Sanjay Pandey&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 10:09:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349743#M46851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-22T10:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349804#M46852</link>
      <description>&lt;P&gt;One more suggestion for you. I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.Reflection.Assembly.GetExecutingAssembly().Location&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This line of code gives you the path where your DLL is located.&amp;nbsp;Make sure your PNGs are in the same folder and then it is easy to find them.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 10:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8349804#M46852</guid>
      <dc:creator>David_Robison</dc:creator>
      <dc:date>2018-10-22T10:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351480#M46853</link>
      <description>&lt;P&gt;I use David's method for my relative paths for my ribbon icons as well.&amp;nbsp; Use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Path.Combine()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to concatenate the path to the image name and extension.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 21:19:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351480#M46853</guid>
      <dc:creator>0001des</dc:creator>
      <dc:date>2018-10-22T21:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351627#M46854</link>
      <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your great help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also found another solution for this by using:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;&amp;nbsp;
var iconPath40 = Path.Combine(outPutDirectory, "Icons\\Select2SectionBox.png");
Uri uriImage40 = new Uri(@iconPath40);&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Oct 2018 22:51:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351627#M46854</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-22T22:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Relative path for folder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351629#M46855</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your suggestion. I just using exactly the same method with you :).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 22:53:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/relative-path-for-folder/m-p/8351629#M46855</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-22T22:53:27Z</dc:date>
    </item>
  </channel>
</rss>

