Taking Dynamo Scripts to Visual Studio is this possible?

This is probably a straight forward no but…

Is there a way to take your dynamo scripts extract its code and use within visual studio. I want to do this so i can add all scripts to a ribbon and learn the coding side of things instead of dragging lines to nodes.

Also scripts do run slow within the dynamo player (still faster than manual user input) but would like to make it even easier for colleagues to just press buttons on a ribbon also so they do not have access to the dynamo scripts to manipulate.

Any info would be create if this is a possible task to accomplish.

Check out Dyno for deploying graphs as ribbon buttons. That’s probably the closest you can get to what you described above :confused:

If you really want to go on a wild goose chase, from what I understand, graphs are internally “compiled” to designScript “bytecode”, or more accurately, during graph execution, each executing node emits the equivalent designScript function calls. Those function calls are written in c# under the hood, so you could maybe make some kind of extension that intercepts that, replaces the function calls with the equivalent c# code and generates a really messy *.cs file for you :slight_smile:

Dynamo is open source and the code is all public:

but that isn’t necessarily very helpful, because it’s usually not fully documented and the only person that can tell you what the code is supposed to do, is the one who wrote it…

1 Like

Thanks for the info Dimitar, i have seen Dyno so this may be my last resort if i fail with the coding haha. thanks for the input i will see if i can get the C# code as you have described :slight_smile: .

It sounds like what you in fact want to make is Add-ins for Revit rather than Dynamo graphs. (Which is coded in e.g. C#)

This points will also be attainable by coding add-ins rather than using Dynamo

1 Like

Hi Jonathan,

exactly what i want to do i was just hoping with my lack of knowledge of coding (trying to with C#) there was a way to convert a dynamo script to C# code so i could see what actually was going on so i was able to study what is needed.

I’ve followed archi-lab’s in depth tutorials which has given me an insight which i understand creating a ribbon now and how to link commands to them. I think the main task for me is learning the code needed for specific commands i would like to create… i was looking at the boost your BIM course on Udemy but bit expensive at the moment. i think its just going to be google and lots of playing around till it clicks but i think its defiantly going to be worth the frustration :slight_smile:

1 Like

I started converting my old package that was depended on Python as custom nodes in December/January (2017/2018) and has converted totally to Csharp. I started out with the ZeroTouch demo.

IT took me a month or so to figure Csharp syntax instead of Python and I will say that it is all the beginner troubles worth to do it.

I am not totally fluent in Csharp yet, but I have reached a level where my code can be compared to most other code I see on the net. I have learnt a lot by reading Jeremy Tammik’s page.

3 Likes

Thanks for the input erfajo i will be sure to take a look at the links you have provided.

I’d recommend Harry’s course, or have a look at the ArchSmarter ones too.

Here’s a collection of links to various learning resources : https://archsmarter.com/revit-macro-resources/
And their course : https://learn.archsmarter.com/courses/mastering-revit-macros-csharp

Macros are easier to get going with than addins and when ready, transitioning to addins will be easy.

In terms of cost, both courses seem very reasonably-priced, but i certainly understand it’s a stretch if it’s for personal use. My recommendation would be to get your employer to sponsor the course if possible - most places have a training budget and even if not, the ROI on one of these is insanely good and will save you countless hours of hair-pulling and being stuck.

1 Like

Thank you for the info. It is for personal growth. I may bring it up to my employer to see if they would but we do have our own department for BIM development team that builds our addins. If not i will eventually pay for the course as it would be a great asset to have personally.

1 Like