Difference between the APIs

Hello Everybody,
I´ve got an conceptual question. I am trying to get a basic understanding of Add-On Programming and what you are capable of doing with that in VC. I am using VC Premium.

What is the general difference If I choose to built an Add-On with Python or .net besides the obvious (different code language). Can I achieve the same results or are their certain types of problems where one language is better suited to be used? I got curious after scanning through the given tutorials in the academy.

An Example for an Add-On:

  1. Built a Layout based on a .csv sheet on your local drive.
  2. Change the existing layout based on external input (find and replace components)

Every help is appreciated, thanks a lot

1 Like

The main differences are:

  • With .NET you can extend the user interface and thus create rich UIs, with Python you can only make “UI” using properties.
  • With Python you can program simulation logic that runs as part of the simulation, with .NET implementing such logic is limited.
  • Python scripts within components are saved with the simulation model, .NET add-ons you always need to distribute and install separately. Python code is also easily editable for customization, while .NET add-ons will need to be recompiled using Visual Studio or the command line toolset.
  • With .NET you can use any .NET Framework 4 compatible libraries, background threads etc. With Python you are limited to pure Python 2 libraries and the few others that come with VC. In Python threading is not supported which makes certain things like socket communication very inefficient and difficult.
  • All of VC’s UI is implemented on top of the public .NET API, so anything that can be done through the UI is also possible to do from your own code with the .NET API. With Python limitations may apply.
  • Development of .NET add-ons greatly benefits from the debugging capabilities of Visual Studio, including hot reload. With Python you can’t attach a debugger. The .NET API also being strongly typed, Intellisense works nicely and you don’t need to constantly read the API documentation for each detail like with Python.

Your example seems to be just design-time layout configuration, so it could be done with a .NET add-on. I would do it as such unless the things like easy customization of the Python code is important for you.

4 Likes

Thanks a lot for the quick reply!

Personally I would prefer to sue python because I am getting real Time Data into my Model with python and I am thinking about using external optimizers/logic (and i think in that regard python would be more suited) as well. Then I could develop all parts of the project in the same language.

Is it possible to do everything with VC in Python as with .NET or what are the limitations you are refering to? I´ll try it out myself and come back to this threat if I encounter any problems.

The Intilisense functions you are talking about indeed are a treat.