<?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 Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9704335#M32342</link>
    <description>&lt;P&gt;Is it possible to activate the operation of an External Command file for drawing Duct with the button clicked after filtering a form?&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="issue.jpg" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/809797i9C0AEA93813A45D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="issue.jpg" alt="issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Fri, 21 Aug 2020 11:04:20 GMT</pubDate>
    <dc:creator>aliriza.yilmaz</dc:creator>
    <dc:date>2020-08-21T11:04:20Z</dc:date>
    <item>
      <title>Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9704335#M32342</link>
      <description>&lt;P&gt;Is it possible to activate the operation of an External Command file for drawing Duct with the button clicked after filtering a form?&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="issue.jpg" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/809797i9C0AEA93813A45D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="issue.jpg" alt="issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 11:04:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9704335#M32342</guid>
      <dc:creator>aliriza.yilmaz</dc:creator>
      <dc:date>2020-08-21T11:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9704777#M32343</link>
      <description>&lt;P&gt;I think the most likely answer you're going to get is to trigger an external event from the form. In the Revit SDK examples, there is an example titled "ModelessForm_ExternalEvent" that shows the components necessary for handling the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, that example uses an enum to determine which action happens after the External Event is recognized and executed by the application, and I've had success instead using the Interlocked object to pass references to the classes that actually hold the method to be executed. This allows you to simplify the Execute function in the request handler significantly, and removes the need to maintain an exhaustive list of operations in an enum.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:02:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9704777#M32343</guid>
      <dc:creator>bhprest</dc:creator>
      <dc:date>2020-08-21T15:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9705592#M32344</link>
      <description>&lt;P&gt;You would have to use&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/dynamic-source-code-generation-and-compilation#:~:text=The%20.NET%20Framework%20includes%20a%20mechanism%20called%20the,single%20model%20that%20represents%20the%20code%20to%20render." target="_blank" rel="noopener"&gt;CodeDOM&lt;/A&gt;&amp;nbsp;to compile the code into an assembly, load it with reflection and then execute it from an ExternalEvent by passing the objects you get from that context through to your loaded assembly function. That's the workflow I have successfully followed. My main experience is of using it to compile VB code but there is a C# compiler I've not used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The most tricky part of CodeDOM is adding all the references that get done automatically with VS. Things that you take for granted for features such as Linq etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 00:11:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9705592#M32344</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-08-22T00:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9705749#M32345</link>
      <description>&lt;P&gt;Check out the link, I have a modeless form&amp;nbsp; demo project with 19 buttons, 18 of them run external events&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=j-Fv086zLnk" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=j-Fv086zLnk&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 05:33:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9705749#M32345</guid>
      <dc:creator>joshua.lumley</dc:creator>
      <dc:date>2020-08-22T05:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9732819#M32346</link>
      <description>&lt;P&gt;I examined the video and plugin you have published, but I could not fully understand how you can run the codes you wrote from another window. Can you send a small sample of this?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 08:02:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9732819#M32346</guid>
      <dc:creator>aliriza.yilmaz</dc:creator>
      <dc:date>2020-09-07T08:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9733739#M32347</link>
      <description>&lt;P&gt;The code is available here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/joshnewzealand/Revit-API-Playpen-CSharp" target="_blank"&gt;https://github.com/joshnewzealand/Revit-API-Playpen-CSharp&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 19:55:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9733739#M32347</guid>
      <dc:creator>joshua.lumley</dc:creator>
      <dc:date>2020-09-07T19:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run the .cs files I have created in my Revit API project by clicking the buttons in a form?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9736366#M32348</link>
      <description>&lt;P&gt;It looks like the form and the command you want to run are part of the same project. You can simply move the code that executes your command to a static method, make your command call that static method, and then call that static method in your form (if it is modal) or in an external event (if the form is modeless).&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class MyCommand : IExternalCommand
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
    UIApplication uiApplication = commandData.Application;
    View view = commandData.View;
    Document document = view.Document;
    DoStuff(uiApplication, view, document);
}

public static Result DoStuff(UIApplication uiApplication, View view, Document document)
{
    // Do Stuff
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you &lt;A title="Sanitize Your SQL!!!" href="https://bobby-tables.com/" target="_blank" rel="noopener"&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;should sanitize your SQL!!!&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 22:56:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-possible-to-run-the-cs-files-i-have-created-in-my-revit/m-p/9736366#M32348</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-09-08T22:56:40Z</dc:date>
    </item>
  </channel>
</rss>

