Drawing directly on a faceplate using VBA script

Dear all i am making an application where i have to draw directly (plot an x y graph) on the faceplate USING VBA SCRIPT. I request any experts or experienced people out there to suggest an approach for achieving this.

Any help wud be appreciated ! Thanks

Bhargav

  • You can do this, but the only way I know how is by using an ActiveX object.   There are several out there (or you could create your own) that will plot a bitmap based on the parameters you give it (and then invoking a method).  How you do it specifically depends on what functionality that you're looking for.  In the past I have done this to plot data values from an application that I couldn't interface with DeltaV in any other way.  It was kind of ugly but worked.

  • In reply to Aaron Crews:

    Thanks Aaron !!

    I think i will try this out (ActiveX) control -- Another way i was thinking about was maybe to make a bitmap of the plot that i need and then display it on the screen directly (Faceplate -> Insert -> Bitmap). After which I can dynamically change the bitmap with the change in the plot after a certain refresh time. (Hope there is no over load) :)

    But yeah the ActiveX approach sounds great. Thanks again. Let me get back to you after anyone of the approaches have worked :)

    Have a great day !! :)

    Bhargav

  • Bhargav,

    If you can get away with bitmaps, then I would use a layered bitmap. When you do that, you are adding multiple bitmap layers into the same object. (this is how the alarm icons in DeltaV are built). Then, you can add an animation to the bitmap layer property and the picture will change dynamically.

    Aaron

    On Aug 2, 2012, at 7:30 PM, "Bhargav Ramachandra" wrote:

    > Bhargav
  • In reply to Aaron Crews:

    Dear Aaron,

    I just got another idea.

    The thing is that i need to plot xy data dynamically on the "Bitmap Graph" The following is the procedure i was thinking about:

    1) make a bitmap of all the static values and add it on to the faceplate.

    2) create a small circle object which will represent the dynamic (x,y) point

    3) after every refresh rate delete the small circle object and create an new one with the new (x,y) coordinates leaving the static bitmap (the coordinate system) as it is.

    This way the user can get the dynamic (x,y) data on the static xy coordinate system !!

    How does this sound ?

  • You can definitely do that - instead of deleting/redrawing an object, just animate the x-position and y-position. 

    Aaron

    On Aug 2, 2012, at 7:48 PM, "Bhargav Ramachandra" <bounce-BRamachandra@community.emerson.com> wrote:

    Dear Aaron,

    I just got another idea.

    The thing is that i need to plot xy data dynamically on the "Bitmap Graph" The following is the procedure i was thinking about:

    1) make a bitmap of all the static values and add it on to the faceplate.

    2) create a small circle object which will represent the dynamic (x,y) point

    3) after every refresh rate delete the small circle object and create an new one with the new (x,y) coordinates leaving the static bitmap (the coordinate system) as it is.

    This way the user can get the dynamic (x,y) data on the static xy coordinate system !!

    How does this sound ?

  • In reply to Aaron Crews:

    Thanks a lot Aaron,

    Have a good evening ahead of you !!

    Ill get back to you with my result and how it worked :)

    Cheers !!

    Bhargav

  • In reply to Bhargav Ramachandra:

    Dear Aaron,

    Ive been trying to load bitmaps on the faceplate using VBA script, but im having little luck doing so.

    Im using the function bitmapObj.LoadImage "C:/MyFolder/MyFile.bmp" in the VBA Script

    All im getting is an object (bitmap obj) created on the faceplate which is blank (grey in color).

    Am I doing somehing wrong ??

    Any help wud be greately appreciated.

    Thanks again,

    Bhargav

  • In reply to Bhargav Ramachandra:

    Bhargav,

    I assume that in your example the bitmapObj is the real name of the object in your picture. If it isn't the real object name you will need to use the real object name

    Parameters of the bitmap object:

    Transparency - Enables the TransparentColor to be invisible and not shown if True.

    TransparetColor - The color that won't be displayed when Transparency is True.

    CurrentImage - Which bitmap to be shown. You can manually configure this to see what it does in Edit mode to check if it will look correct.

    I like to use magenta (16711935 - 255, 0, 255) in my bitmaps to be the invisible color so the picture or object backgroud can be viewed. I think it's a good one because it typically isn't a color being used.

    I always like to remove all the images and then add them back similar to logic below:

       bitmapObj.DeleteImage 1

       bitmapObj.DeleteImage 2

       bitmapObj.DeleteImage 3

       bitmapObj.AddImage "C:/MyFolder/MyFile1.bmp"

       bitmapObj.AddImage "C:/MyFolder/MyFile2.bmp"

       bitmapObj.AddImage "C:/MyFolder/MyFile3.bmp"

    Regards,

    Matt

  • In reply to Matt Stoner:

    Dear Matt Stoner,

    It worked out perfect. !!!!  Thank a lot for your help ! :)

    This is what i did !! I also checked out the current image property (Set to 1 by default

    ) !!~~ but since i need just one image to be displayed its perfect ..

       bmpRealName.DeleteImage 1

       bmpRealName.AddImage "C:/MyFolder/MyFile"

       bmpRealName.HorizontalPosition = 30

       bmpRealName.VerticalPosition = 6

       bmpRealName.Height = 46.1

       bmpRealName.Width = 57.6

       bmpRealName.Transparency = True

       bmpRealName.TransparentColor = vbMagenta

    But one thing is i didnt quiet understand transparency and transparent color properties ~~ is there any reference where i can read about these things in more detail !??

    Thanks Matt !!

    Bhargav

  • In reply to Bhargav Ramachandra:

    I haven't seen any reference for this and I did a quick search but came up empty for iFix.

    I just played with my bitmap in MS Paint and configured the places that I wanted the picture background to be shown in a color that wasn't to be used which as stated is usually magenta.

    Hope this helps.

    Regards,

    Matt

  • In reply to Matt Stoner:

    Dear Matt,

    Okay thanks anyways ~~ Ill do some more playing around with the bitmap :)

    Thank for the help ~~

    Have a good day !!

    Bhargav