16 Replies Latest reply on Sep 6, 2012 4:16 PM by dhollebeek

    Template based Display Creation

    matthew.rivett

       

       

      I like the element relative displays but have found myself wanting something else lately.  

       

      It would be nice to be able to model a element template visually.  Create something that you could then drop into a display.  You could have multiple model type things for each type of element template and then drag and drop them into a program like process book.

       

      I've been creating a monitoring display for PMUs so it would have been nice to build one template based on my PMU template.  Then I could drag and drop them onto a display instead of manually cutting, pasting, editing tags.

       

      Anything like that exist or in the works?

       

       

       

       

        • Re: Template based Display Creation
          ldieffenbach

          Hi Matt,

           

          We're considering the functionality you describe as an addition to PI ProcessBook. I don't have any details for you yet.

           

          Regards,

           

          Laurie

            • Re: Template based Display Creation

              This was an one of the original motivations for this community project:

               

              vcampus.osisoft.com/.../44.aspx

               

              Never get a second to work on it these days unless we (read community) build an interim solution until Laurie and co. finish development. Maybe at the vCampus Live Hackathon?

                • Re: Template based Display Creation
                  ldieffenbach

                  vCampus Community challenge!!!!

                   

                  Anyone want to take an initial crack at some code to copy a graphic from a ProcessBook display to an AF element template so that it can be reused to draw a graphic when an instance of the template is dropped on a new display?

                   

                  If you get something simple started and send it to me, I'll include it in our hands-on lab for PI ProcessBook at this year's vCampus Live (in November).

                   

                  Instant fame! I'll ask Rhys to add you to his Beer Tracker (I don't have one).

                   

                  Regards,

                   

                  Laurie Dieffenbach

                   

                  PI ProcessBook Product Manager

                    • Re: Template based Display Creation
                      matthew.rivett

                      I guess it would be possible to do but how much work would it be?  I've never written a PB addin or used the AF-SDK before.  Not sure I the time to tackle this.

                        • Re: Template based Display Creation
                          ldieffenbach

                          I appreciate your dilemma, Matt. I'm hoping someone else (e.g., a partner---hint, hint) might have some time to make a simple offering that we could share at our event as well as here.

                            • Re: Template based Display Creation

                              I'm all over it like a rash...

                                • Re: Template based Display Creation
                                  ldieffenbach

                                  Can you add yourself to your own Beer Tracker? Or will you just put it on my account? :-)

                                    • Re: Template based Display Creation
                                      Lonnie Bowling

                                      @Rhys do you ever sleep?

                                       

                                      I wonder how the drag and drop would work.  That seems to be the tricky part. Is there some event to pick that up in VBA?  Also, how to you trap that in the element relative control?

                                        • Re: Template based Display Creation

                                          Sleep is for the weak  Although feeling the effects of last nights Azure session.

                                           

                                          There is a Display OnOLEDrop event that you can piggy back from an add in to know where the drop was made, and providing you store how Symbols are placed relative to each other  in AF you can maintain the group of symbols position from the drop position.

                                            • Re: Template based Display Creation
                                              matthew.rivett

                                              Yeah I was thinking you could store relative x, y coordinates, lengths and widths.  Dropping a rectangle into PB shouldn't be hard.  Getting a more complex object might get more tricky.  I guess you can more or less store all the properties in AF for any shape and use VBA to create whatever you want.

                                               

                                              Ideally you'd have a graphical program (PB) you could use to create the template.

                                                • Re: Template based Display Creation

                                                  We will create Element Templates for the different PBSymbol types and then those are used for the symbols associated with other Element Templates.

                                                   

                                                  Back in 2009 I made some code to create AF Enumeration Sets of the ProcessBook Enums:

                                                   

                                                  vcampus.osisoft.com/.../1562.aspx

                                                   

                                                  This was the basis for this very project, so when I define a symbol in AF as an Element Template then the same options from ProcessBook are accessible in AF.

                                                    • Re: Template based Display Creation

                                                      Oh and this would be a docking window add-in, I had a shell of an add-in for this once upon a time but can I find it now....no.  Bugger.

                                                        • Re: Template based Display Creation

                                                          Just a quick update, v1 isn't far away.  Just figuring out some AF challenges with PB symbol representation, and I want the add-in to detect groups of symbols on a display that match a template's symbols.  Toying with the idea of including both multi-states and VBA code in v1, we'll see how far I get over over next couple of days.

                                                           

                                                          Full source code will be in the AF Symbol Drop community project shortly.  So far I have kept everything as simple as possible, including checking for valid AF structure of PB symbol representation, e.g. (I just love Linq in these situations...)

                                                           

                                                          var validElements = from eachElement in

                                                           

                                                                                                 (

                                                           

                                                                                                     from eachElement in home.Elements

                                                           

                                                                                                     where (eachElement.Attributes.Contains("Element Template GUID") && eachElement.Elements.Count >= 1)

                                                           

                                                                                                     select eachElement

                                                           

                                                                                                 )

                                                           

                                                                                             where eachElement.Elements.Select(e => e.Template.BaseTemplate == _AFDatabase.ElementTemplates["Element Template Graphic Symbol"]).Count() >= 1

                                                           

                                                                                             select eachElement;

                                                           

                                                                         lstElementTemplateGraphics.Items.AddRange(validElements.Select(template => _AFDatabase.ElementTemplates[(Guid)template.Attributes["Element Template GUID"].GetValue().Value].Name).ToArray());

                                                            • Re: Template based Display Creation

                                                              Rhys @ Wipro

                                                              I want the add-in to detect groups of symbols on a display that match a template's symbols
                                                              Why not just leverage a symbol's NamedValues collection to store the AF Template in plain text, as opposed to juggling with trying to match groups of symbols?

                                                               
                                                              ThisDisplay.Symbols("Composite1").NamedValues.Add("AF Template", "Some Template")
                                                              

                                                               

                                                                • Re: Template based Display Creation

                                                                  Thanks Steve. So I had considered Named Values but want to explore performance and map out how symbols would work for the add-in where VBA is concerned. For example, all symbols may not be composite if there is VBA for individual symbol click events. Need to look at performance too, but not so worried about that.

                                                                   

                                                                  Right now I'm sat on a beach (weirdly with my vCampus Live 2011 T-Shirt on the sun lounger) and not supposed to be doing "any work", so I'll take a look in a few days and update.