{"id":5806,"date":"2019-11-09T20:55:29","date_gmt":"2019-11-09T20:55:29","guid":{"rendered":"https:\/\/max-drake.cc\/?p=5806"},"modified":"2022-03-28T04:57:18","modified_gmt":"2022-03-28T04:57:18","slug":"revit-add-ins-with-c-visual-studio-part-1","status":"publish","type":"post","link":"https:\/\/max-drake.cc\/?p=5806","title":{"rendered":"Revit Add in&#8217;s with C# &#038; Visual Studio Part 1"},"content":{"rendered":"\n<p>I haven&#8217;t  played much with C# and revit add-ins for a while and I thought it would be good to re-explore the process. The last time I was trying to do so was about 3 years ago so I thought I&#8217;d look on Mr YouTube to see what has appeared since my last effort. It seems there are a few more video&#8217;s up to help you start.<\/p>\n\n\n\n<p>When I was last doing it I worked through the Microsoft visual Studio c# beginners course to get the feel of the programme and also for some OOP (Object Oriented Programming) concepts and uses. The course was good but not in my area of interest, but it gave me the basics. As time has passed I&#8217;m feeling a little more confident with programming, so feel its worth trying to do some more Revit Plug-ins. In my earlier attepts I only got one programme\/function actually working, so not very successful.<\/p>\n\n\n\n\n  <!DOCTYPE html><html> <head><meta http-equiv=\"content-type\" content=\"text\/html; charset=\"> \n    <\/head> <body> <div class=\"su-box su-box-style-glass\" id=\"\" style=\"border-color:#0f5897;border-radius:5px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#428bca;color:#FFFFFF;border-top-left-radius:3px;border-top-right-radius:3px\">PowerKey4Revit                               Free 30 day Trial<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:3px;border-bottom-right-radius:3px\">\n\t<div class=\"su-list\" style=\"margin-left:0px\">\n<ul>\n<li><i class=\"sui sui-star\" style=\"color:#428bca\"><\/i> Speed up the tedious stuff and enjoy designing and documentation more<\/li>\n \t<li><i class=\"sui sui-star\" style=\"color:#428bca\"><\/i> Works in all versions of Revit<\/li>\n<li><i class=\"sui sui-star\" style=\"color:#428bca\"><\/i> Information to PROVE your increased speed<\/li>\n<\/ul>\n<\/div>\n\t\n\t<a href=\"https:\/\/datacapture.tk\" class=\"su-button su-button-style-glass\" style=\"color:#FFFFFF;background-color:#428bca;border-color:#3570a2;border-radius:6px\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"color:#FFFFFF;padding:0px 18px;font-size:14px;line-height:28px;border-color:#7baeda;border-radius:6px;text-shadow:none\"> PowerKey4Revit Free 30 day Trial<\/span><\/a>\n<div class=\"su-spacer\" style=\"height:20px\"><\/div> \n\t\n<div class=\"su-spoiler su-spoiler-style-modern-light su-spoiler-icon-plus-circle my-custom-spoiler su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span>PowerKey4Revit VIDEO <\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\"><div class=\"su-youtube su-u-responsive-media-yes\"><iframe width=\"600\" height=\"400\" data-src=\"https:\/\/www.youtube.com\/embed\/1eFJAzWhOLU?\" frameborder=\"0\" allowfullscreen allow=\"autoplay; encrypted-media; picture-in-picture\" title=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe><\/div><\/div><\/div>\n\t\t<\/div><\/div><\/body> <\/html>\n\n\n\n<p>I&#8217;m currently doing a couple of projects with Revit and want to Automate a few things to speed up the proces, so I thought I&#8217;d dive back into Visual Studio, C# and Revit API&#8217;s.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Articles that re-awakened my interest on the subject<\/h3>\n\n\n\n<p>I get the weekly BimSider Roundup on Revit and this week he highlighted a couple of articles on Revit programming.<\/p>\n\n\n\n<p>The first I thought was a very good basic intro from BIM Squared. <strong><a href=\"https:\/\/bimsquared.com\/customize-revit-intro\/\">Customize Revit with C# [The Basics] by James Simpson .<\/a><\/strong><\/p>\n\n\n\n<p>The 2nd was <strong>st<a rel=\"noreferrer noopener\" aria-label=\"eps to learn to code [for architects &amp; designers] part 1 (opens in a new tab)\" href=\"https:\/\/lm2.me\/post\/2019\/08\/19\/learntocode-1\" target=\"_blank\">eps to learn to code [for architects &amp; designers] part 1<\/a><\/strong> by lisa-marie mueller. I went back to her first article and need to read the later ones.<\/p>\n\n\n\n<p>So I decided,. as I have a new computer that I&#8217;d load up Visdual Studio.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Video&#8217;s on C# and Visual Studio.<\/h3>\n\n\n\n<p>I thought this setup (vid 2 in series) was useful. He covers concepts but does not run the programmes which I thought was a bit irritating, but overall a good overview for C# &amp; Visual Studio IDE.<\/p>\n\n\n\n<p>Some references to fast keys are <strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/productivity-shortcuts?view=vs-2019\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here. (opens in a new tab)\">here<\/a><\/strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/productivity-shortcuts?view=vs-2019\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here. (opens in a new tab)\">.<\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed alignfull is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"1: Introduction To C# | What Is C# | C# Tutorial For Beginners | C Sharp Tutorial | Learn C# Easily\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/HB1aPYPPJ24?list=PL0eyrZgxdwhxD9HhtpuZV22KxEJAZ55X-\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Videos on Revit API C# Beginners Guide to Getting Started with<\/h3>\n\n\n\n<p>This looks good, I only watched the first one and the size of font on screen was quite small, so a bit of a pain, and he went a bit fast too. I may have to revisit and watch the later ones.<\/p>\n\n\n\n<figure class=\"wp-block-embed alignfull is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Revit API C# Beginners Guide to Getting Started with\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/C0mNU2bEUSs?list=PLlyMZ5IcKcci1TvB4qM9S8J-RKp0DhVWO\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Bim Girl&#8217;s setup<\/h3>\n\n\n\n<p>This lady has such a bubbly personality and is a pleasure to watch. She also starts off simple and I&#8217;ll be following her Revit API setup from the video below, then adding later bits (building the plugins directly to Revit add-in directory) from the video series above.<\/p>\n\n\n\n<figure class=\"wp-block-embed alignfull is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to write a plugin for Revit - Coding for AEC Lesson 2\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/ulvaJP4kjKE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>In the video she referes to <a rel=\"noreferrer noopener\" aria-label=\"AutoDesk Lesson 1: The Basic Plug-in (opens in a new tab)\" href=\"https:\/\/knowledge.autodesk.com\/support\/revit-products\/learn-explore\/caas\/simplecontent\/content\/lesson-1-the-basic-plug.html\" target=\"_blank\"><strong>AutoDesk Lesson 1: The Basic Plug-in<\/strong><\/a>.<\/p>\n\n\n\n<p>She also starts a <strong>C# ClassLibrary (.NET  Framework) project<\/strong>, not a  ClassLibrary (.NET  Standard) which I did the first time. <\/p>\n\n\n\n<p>In her video rather than copying the .dll and .addin files to the <strong>C:\\ProgramData\\Autodesk\\Revit\\Addins\\201?<\/strong> folder she leaves the path to the .dll where it is generated and only moves the .addin file to the abovce path. I suppose it works either way. I think the chap above does it better by generating the .dll file into the  <strong>C:\\ProgramData\\Autodesk\\Revit\\Addins\\201?<\/strong> folder  so its ready to go, also he triggers the debug to start revit straight away to test to see if it works. A better workflow. But I appreciate that Bim Girl is at the simple end of the process. <\/p>\n\n\n\n<p>Alos , after following her video I got the copy Group addin working pretty quickly. Well done that girl.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Joshua- pretty good dude<\/h3>\n\n\n\n<p>I watched his first video in End comment and added setup versionm here.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Revit API 01 - Setting Up A Project From Scratch\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/la8DBrKVCxc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">End comment<\/h3>\n\n\n\n<p>This is just documenting my process. So its really just the setup of the process for future reference. <\/p>\n\n\n\n<p>I did have a few add-ins I wanted to explore for Revit, one of them had to do with selection and colour but I cannot recall it at this point. <\/p>\n\n\n\n<p>Another was switching Room infill &amp; reference lines on\/off which I seem to do a lot. I would like something like AutoCad layer control with fast keys and need to experiment to see how I can do that. <\/p>\n\n\n\n<p>Now that I have the very basics up and running I can begin to explore the Revit API and look to make some simple productivity apps. <\/p>\n\n\n\n<p>The video below looks veery good, secret number 2 is invoke that allows you to do multiple builds but not restart revit to test. Brilliant. I remember the frustration of shutdown\/restart that took ages for testing.  <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"5 Secrets of Revit API C# Coding Ribbon Button Macro External Events Modeless dockable addin\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/KHMwd4U_Lrs?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I haven&#8217;t played much with C# and revit add-ins for a while and I thought it would be good to re-explore the process. The last time I was trying to do so was about 3 years ago so I thought I&#8217;d look on Mr YouTube to see what has appeared since my last effort. It [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5814,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,31,42],"tags":[],"class_list":["post-5806","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api_json","category-bim","category-productivity"],"featured_image_src":"https:\/\/max-drake.cc\/wp-content\/uploads\/2019\/11\/test-1.jpg","featured_image_src_square":"https:\/\/max-drake.cc\/wp-content\/uploads\/2019\/11\/test-1.jpg","author_info":{"display_name":"Max Drake","author_link":"https:\/\/max-drake.cc\/?author=1"},"_links":{"self":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/5806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5806"}],"version-history":[{"count":0,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/5806\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/media\/5814"}],"wp:attachment":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}