Harness proD API Help
EPLAN.Harness.API.DataStructures.LibraryConnections Namespace / ActiveConnection Class / RecategorizePart Method
Part for recategorization. It is strongly recommended to not use this instance of library part after recategorization anymore!
New product category.
Example
In This Topic
    RecategorizePart Method
    In This Topic
    Recategorize part to different category.
    Syntax

    Parameters

    part
    Part for recategorization. It is strongly recommended to not use this instance of library part after recategorization anymore!
    category
    New product category.

    Return Value

    New instance of the recategorized part.
    Exceptions
    ExceptionDescription
    Argument is null.
    Argument is invalid. The exception is thrown when a wrong argument is passed to the method or the setter of property.
    You can not perform this action on a document opened as read only.
    Part mustn't be opened during recategorization.
    This function is supported only on Master data library provider.
    Example
    This example shows how to recategorize terminal to mechanical part.
    LibTerminal terminal = library.GetLibraryPartByPartNumber<LibTerminal>("Terminal");
    
    ProductCategory category = ProductCategory.GetSupportedCategories(ApiPartType.Part).First();
    
    BaseLibraryPart part = library.RecategorizePart(terminal, category);
    
    // Do not use the terminal instance anymore! It is obsolete.
    
    if (part is LibPart)
    {
    	// The new part is typeof LibPart.
    }
    
    // Obtain the part again -> it is typeof LibPart.
    LibPart part2 = library.GetLibraryPartByPartNumber<LibPart>("Terminal");
    See Also