Learning the API with Python

Learning the API with Python

ssw9UZNL
Advocate Advocate
598 Views
3 Replies
Message 1 of 4

Learning the API with Python

ssw9UZNL
Advocate
Advocate

Hi All,

 

I want to start learning the API and seen its all written in C# for the examples. What is the best technique to convert this to python and are there any good tutorials or courses for this?

 

How did you learn?

 

Thanks, Sam

0 Likes
599 Views
3 Replies
Replies (3)
Message 2 of 4

aclarke
Advocate
Advocate

If Python is where you want to go, start with Dynamo forums.  they mainly program in python for custom nodes, lots of examples with custom nodes.  Then find the top guys on the forum, down load their packages, and tear them apart.

 

everyone say python is easier, I don't think so, C# and visual studio are way easier.  VS holds your hand thru the development like a word document and spell check.  Since C# is hard typed, you are forced to use the correct syntax and learn the API, In python some errors are harder to find since it can be what ever python thinks you mean vs what you actually mean.

 

I am no programmer but if you are going to spend the time and effort, learn C# and VS, once you get past the learning curve, both in python or C# you can do more with C# at the end of it all.

 

I started with Dynamo, went to python, then switched to C# and glad I did, it is going to be a struggle either way but worth it for sure.

Message 3 of 4

studio-a-int
Advocate
Advocate

You will need to learn and use IronPython, which is the Python port to .NET

 

https://ironpython.net/

 

As the team mention there "IronPython's sweet-spot is being able to use the .NET framework APIs directly from Python."

 

Once you handle that you will have no problem navigating back and forth between IronPython and C#.

 

https://ironpython.net/documentation/

 

"IronPython in Action" is a great book, that will cover all critical areas.

0 Likes
Message 4 of 4

franciscopossetto
Advocate
Advocate

Hey,

 

You can check this link, there are some python code you can read:

https://www.revitapidocs.com/code/

 

I agree with @aclarke, C# is easier to understand and Visual Studio helps a lot.

Also, learn about Object-oriented Programming will give you a better understanding about how to work with the API,  with any language.

 

Kind regards.

Github:
https://github.com/franpossetto
0 Likes