Hello! I recently started developing a simple .net plugin for visual components. The plugin gets information from a database, then passes this information to visual components by writing it to the output. This works, but it doesn’t feel like the best solution. Is it possible to somehow call a python function from a .net plugin? If so, how do i do this? Is there some documentation i’m missing?
In a Python script, you can use vcApplication.findCommand(“netCommand”) to get a handle for the netCommand, which can be used to call a .NET command registered with the VC product.
Thanks for the quick reply! But it really doesn’t answer my question. I know that i can use findCommand to get a handle for a command declared in my .Net plugin, but i want to get a handle to a python function declared in one of my models. Is this even possible?
Ah, sorry. I misread. No, you cannot get a handle for a function in a script. You can, however, make the function a Python command can call it in .NET or bind the function to a component property’s OnChanged event, so whenever you change the value of the property you know that function will be called.
One more question! How do you set the value of a string property from the plugin?
I can obtain a reference to the IProperty in my component, but how do you dynamically set a value on said property? I’ve tried createAndSetNewValue, but I get the exception “System.NotSupportedException: ‘Specified method is not supported.’”
If you are working with .NET language and .NET API, an IProperty or IProperty<T> object has a Value property, which is a getter and setter. So use that to set the value of a component property.
createAndSetNewValue… VC .NET API uses Pascal case for its naming convention, so it’s CreateAndSetNewValue.
I do not know what you are doing then. If I want to set the value of the Name property, for example, I could do this using both IProperty and IProperty<T>.
I am a primary user of Visual Components, could you please instruct me how to connect VC with database? If possible, could you help me record a simple teaching video. Thanks a lot!