Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Nexeed Station Lamp Addon - Dialog Request Improvement

    Nexeed Station Lamp Addon - Dialog Request Improvement

    WScottHicks
    Established Member

    A new feature was added with version 2.2 of the Nexeed Station Lamp Addon to check all DialogRequest variables at its level and below.  I think this is a good change, and I'm using this addon on a couple stations.  In my experience this feature works well if you don't have SubTrees, and it works well if the StationLamp is part of a SubTree.  I have recently noticed an issue when the Station Lamp isn't part of a SubTree, but has a SubTree referenced at a lower level of the Model tree.  In this situation, the export is unable to collect the Dialog Request Variables that are part of the SubTree.

    The desired behaviour (for me at least) is to  include all the DialogRequest variables at its level and below even if they are part of SubTree.  I'm including a modified version of the UnitFb.otd file with a possible solution.  The export from my modified code looks okay, and it builds in TwinCat, but I haven't had an opportunity to tested it on real hardware yet.

     

    <%List<string> DialogRequestVars = new List<string>();%>
    <%SearchDialogRequestVars(@ownerObject.AddOnHost, ref DialogRequestVars);%>
    <* FunctionBlock name="<%=@this.Name%>" extends="StationLampAddon" path="<%=@this.Path%>" overwrite="false" *>
    <%T= ?system?_Common\CodeEntityDeclaration.otd %>
    <* DeclarationEnd *>
    <% // ---------------------------------------------------------------------------------------------------------%>
    <* method name="CheckAnyDialogIsActive" type="VOID" comment="This function returns true if a dialog request variable is set" overwrite="true" *>
    <* DeclarationEnd *>
    <% // ---------------------------------------------------------------------------------------------------------%>
    <%if ( DialogRequestVars != null ){%>
    <%if ( DialogRequestVars.Count > 0 ){%>
    _dialogActive := 
    <%for(int i = 0; i < DialogRequestVars.Count; i++){%>
    <%if (i != DialogRequestVars.Count-1){%>
        ( <%=DialogRequestVars[i]%> <> '' ) OR
    <%}%>
    <%else{%>
        ( <%=DialogRequestVars[i]%> <> '' );
    <%}%>
    <%}%>
    <%}%>
    <%}%>
    
    <%CodeMemberStart
    public static void SearchDialogRequestVars(Bosch.OpCon.Engineering.ControlSystems.ConfigUnitDrop @object, ref List<string> Vars )
    {
        if (@object.RequestDialogVariable != null)
        {
            Vars.Add(@object.RequestDialogVariable.FullName);
        }
    
        if(@object.ChildUnitsAndSubTreeReferences.Count != 0)
        {
            foreach (var item in @object.ChildUnitsAndSubTreeReferences)
            {
                var configUnit = item as Bosch.OpCon.Engineering.ControlSystems.ConfigUnitDrop;
                if(configUnit != null)
                {
                    SearchDialogRequestVars(configUnit, ref Vars);
                }
                var subTree = item as Bosch.OpCon.Engineering.ControlSystems.SubTreeReferenceDrop;
                if(subTree != null)
                {
                    List<string> SubTreeVars = new List<string>();
                    SearchDialogRequestVars(subTree.SubTreeDefinition, ref SubTreeVars);
                    foreach(var subTreeVar in SubTreeVars)
                    {
                        Vars.Add(subTreeVar.Replace("InstIdx", subTree.SubTreeInstanceIndex.FullName));
                    }
                }
            }
        }
    }
    CodeMemberEnd%>

     

     

    1 REPLY 1

    nexidator
    Community Moderator
    Community Moderator

    Thanks for your input! The origins of this object are probably older than the subtree feature, that may be the reason why this wasn't implemented. We will check this and integrate it in the next version.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist