Eplan Platform API
Eplan.EplApi.HEServices Namespace / DeviceService Class / UpdateDevice Method
Main function of the device or a connection.
Example

In This Topic
    UpdateDevice Method
    In This Topic
    Updates a given device or a connection with data from the referenced article(s). This method can not be used for wire inside cable, but only for whole cable or single connection.
    Syntax
    public bool UpdateDevice( 
       StorableObject oObject
    )
    public:
    bool UpdateDevice( 
       StorableObject^ oObject
    ) 

    Parameters

    oObject
    Main function of the device or a connection.

    Return Value

    FALSE, if the object given as parameter doesn't have any article references.
    Exceptions
    ExceptionDescription
    NULL was passed as a parameter.
    Invalid object passed as a parameter.
    The internal interface could not be created.
    An error occurred while performing the action. Please refer to the exception message.
    Remarks
    Component-specific data will be transfered from article to main-function, function template-data from article will be transfered to all functions of device, modules will be transfered to functions of device, when article is a module and main-function is a blackbox or plcbox, the referenced articles will be stored to project (if they were not before). Please be aware that not all values are overwritten by default with the ones from a part. In case of empty values, they don't overwritte existing ones. This behavior is similar to 'Conflict' dialog from GUI.
    Example
    //create main cable
    Cable oCable = new Cable();
    oCable.Create(page, m_oCableSymbolVariant);
    oCable.Properties.FUNC_CABLETYPE = "Unknown type";
    oCable.Location = new PointD(60.00, 70.00);
    
    //structure part of cable name can't be empty
    oCable.Name = "=EB3+ET1-W1";
    
    //add part to cable
    ArticleReference oArticleReference = oCable.AddArticleReference(strPartName);
    
    //update the cable with properties from new part
    new DeviceService().UpdateDevice(oCable);
    
    //oCable.Properties.FUNC_CABLETYPE == 'ZB3200'
    
    
    
    See Also