You need to log in to create posts and topics.

Feature request : custom draw scripted component

Hello,

Is it possible to create components drawn by a script in a "scripted component" (or other)?
I use the software for teaching in a high school. It would be nice if there was the possibility of animating components to make the simulation more visual for younger students.

I tried to do some things with the components already available. The "displays" are too tedious to animate. The LEDs and the LAMP are too small.
Finally, I make animations with an external Python program after sending data through the serial port. But, the whole thing to set up is always tedious.

 

Thanks

Hi.

It is posible to do animations with scripts, for example in this video a simple bar chart done animating rectangles (at around 04:13)
https://www.youtube.com/watch?v=LBknR6y5Qho

Or in this one an animated "water tank" simulating magnetic sensors:
https://www.youtube.com/watch?v=8LoZilvd1Yo

You can read/write any property of any component in the circuit, including position, size, color, opacity, etc. (if the component have it)
For that the script component must be "linked" to the component you want to control.
And you need to know the internal name of the property.
Then use the function setPropStr( int link_number, string property_name, string property _value )

For example to set the position of a component:

int posY = 100;
valStr = "60,"+posY;
component.setPropStr( 0, "Pos", valStr );

 

If you have some specific idea I could try to help.

 

Thanks for the reply !

I've try a to copy the "display" design. But, I'm unable to make it work. The component appearance is not affected by the script.

Can you upload your "display", "chartscript" with an exemple ?

By the way, how can I attach an upload file to a post in this forum. The "Upload Files" don't seems to work.

Edit : it works now ...

Uploaded files:

Finally get the scripted "display" work with the latest 1.1.0-SR1 Rev 2011.
Previously, I was using R2094.

Another question : How to remove the yellow dot and the name of the component ?

 

OK, find the way to remove "display" : set to name="" in package file.
But, still the yellow dot. The package file is rename "display_LS.package" for logical symbol, but still the yellow dot.

Quote from LWT98709 on November 30, 2024, 4:32 pm

By the way, how can I attach an upload file to a post in this forum. The "Upload Files" don't seems to work.

I usually zip a file or a folder before uploading it as *.zip.

Yesterday, I've tried with no success.
Today, it seems to work.

Uploaded files:

Hi , sorry for the delay, I was "disconnected" this weekend.

About the yellow dot:
This indicates which component is the "active" one.
When you upload from the Editor it will send data to the component with the yellow dot.

If there are more than one MCU or Script component you need to set the one you want before uploading.