Creating interactive animated library blocks

Instead of using statically displayed blocks, library blocks can bbe enhanced with animations and can respond to user clicks. The block OBJECT is used for displaying animations such as rotating machines, switches, analog meters and mechanical loads.
If the OBJECT block is used inside a library block, the animation is shown on the library block.

<br>Click to close the image

The position that is specified at the OBJECT block is relative to the upper-left corner ofthe library block. Moving the library block will thus also move the animation.
If a KEY or ONOFFSW block is placed inside the library block, it can be pressed/toggled during simulation by clicking hte library block that contains that block. In this way you can customize the look and feel of library blocks and create your own interactive animated blocks.

<br>Click to close the image

In the figure above, you see that the block ONOFFSW controls the switch. The status of the switch is displayed on the library block using the OBJECT block. The position of the animated switch is relative (xm=0, ym=20) pixels from the upper-left corner of the library block. The width and height of the animated switch (W=20, H=20) pixels defines the size of the animated symbol. Insidethe OBJECT block you have to set parameter p1 to indicate that the animated symbol should be on/off switch. See the block OBJECT in the reference guide for the various switch symbols and the correct parameter p1. This library block is saved as a switch.lib library block and used in the following animation.

If the switch is used in a circuit and it is turned on, the current will flow through the switch and load: <br>Click to close the image

Click the switch library block to toggle its status: <br>Click to close the image

The switch is toggled and the current throught the load is freewheeling through the diode: <br>Click to close the image

© 2024 CASPOC, All rights reserved. Home   |   Terms and Conditions   |   Legal   |   Export Compliance   |   Privacy Policy   |   Site Map