C# for Zero Touch Tutorials

This is my graph chewing up my computer. I’m using a lot of nodes to push and process a lot of geometry. I understand that creating C#, Zero Touch nodes would speed things up considerably but I’m not sure how to proceed. There’s no easy button! :slight_smile:

How much C# do I need to know to create Zero Touch nodes? Are there resources that might be geared towards the non-programmer for this sort of thing? I’m slowly learning Python and Design Script but mostly getting by with reverse engineering other’s work. I don’t know how to do the same with C#… or if I even can?

Thoughts?

1 Like

Honestly, not a lot for basic stuff, and if your using packages that are written in IronPython, most of it can be ported with practically no effort. However it’s a strong-typed language and requires more configuration and know-how compared to Python (installing Visual Studio, creating the correct project, loading the API dll’s etc) which makes it un-forgiving if you’ve never coded before.

My advice would be to use Python. Its very easy to learn, you can readily examine the code written by others via packages/ custom nodes, and it will still give you a huge performance increase. Plus, there’s a far higher number of people on this forum with Python expertise vs C# expertise, so you’ll receive more help quicker, not to mention the fact its a great entry language before moving onto more complex languages like C#.

2 Likes

Thanks. Good advice. I’ve started down that road so continuing makes a lot of sense.

1 Like

I think you spawned a similar thread here…

You need a fair understanding of C# and the Revit API, not to say you shouldn’t give it a go, but if you are more comfortable in python then perhaps learn in python first as it will still speed computation up more than to string lots of nodes together and will ease you into the Revit API first before learning C#.

Harry Mattison (boost your bim) did a course on udemy which was pretty good (but probably quite outdated now) which was a C# based course for the Revit API targeted at beginners, but having a basic understanding of classes and data types is a prerequisite in my opinion (and it costs money).

Danny Bentley has done some cool videos too on YouTube (and these are free) and there is the ADN page/forum for revit which is a great resource. Check out the building coder blog spot by Jeremy Tammik (most people here who code will consider it their go to blog for all things revit API)

All in all, If you are interested in learning, start off small and build upon it. Like you said, there is no easy button (unless you code one up :stuck_out_tongue_winking_eye:)

2 Likes

I did… for the same graph! I have 32gb of RAM and just crashed my computer trying to run it on a larger project so I’m looking for strategies to reduce the overhead.

Sounds like straight nodes are the slowest graphs to run, followed by DesignScript, Python, and C# at the top of the stack so I’ll continue on that path (although DS may not be strictly necessary since, typically, node to code will handle that).

Thanks again.

1 Like

Wow, what’s your graph doing? Must be a beast! Maybe chuck some taskdialogs in there and see where you are getting hit the worst? I do something similar by placing a node that makes a beep to let me know where I’m at in the script so I can optimise where I can.

Zero Touch is actually not too different from IronPython because you are basically calling the same .NET classes so the methods are pretty much the same. You can get a long way with a few basic C# tutorials if you know the Dynamo and Revit APIs well. It’s a bit more difficult to get started with C#, but @Marcello got you covered:

101:

102:

103:

104:

201:

202:

3 Likes

It’s a egress path checker. I’m checking every corner in the view and looking for the shortest path. I think my biggest bottleneck is in getting all the paths that lie within the room. That’s what this post – SetIntersection for Curves – was getting at.

What taskdialogs? Where? How do you make a beep at various portions?

The taskdialog is a pop up mesaage box you get in revit. You can implement them like below…

Some packages have a node in there already. Just search the packages you have and you probably have it already, just tweak it so your data passes through. The beep node I’ll post in a bit as I’m not at a pc but here is a silly demo…

1 Like

To check on where it bottlenecks I’ve been freezing/unfreezing nodes and running in sequence from start to end.

The biggest slowdown right now seems to be where I intersect a large set of lines (typically over 50,000) to a surface. I’m still looking for the Python approach. Right now I’m using Design Script but it didn’t seem to make a significant difference in speed for this set of actions.

I think I found a faster method than geometry.intersect. Curve.PullOntoSurface seems to be get me the same results in a fraction of the time. Fingers crossed!

1 Like

Greg, I’d be interested to see how you are going about this and help make t more efficient overall (via some coding, altering the process, or reducing datasets/scope). Do you have a thread with the overall graph elsewhere? Been a very busy week so I haven’t been as active.

I don’t, yet. It’s a big sucker. I’ll start another thread.

I agree. C# is kind of a necessity because it helps simplify your understanding of the code.
Although Python is a fairly widely used coding language, C# is no less in terms of usage.