Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceGraphicalAccessory Method
Library part to be placed as a graphical accessory.

A occurrence which the accessory will be attached to. Allowed occurrences:

The occurrence is not allowed to be target occurrence of graphical accessory if it is in pattern.

Position of the accessory part.
Rotation of the accessory part.
Example
In This Topic
    PlaceGraphicalAccessory Method
    In This Topic
    Place a graphical accessory and attach it to a part.
    Syntax

    Parameters

    part
    Library part to be placed as a graphical accessory.
    targetOccurrence

    A occurrence which the accessory will be attached to. Allowed occurrences:

    • Connectable object
    • Special electrical component
    • Leading part
    • Terminal strip
    The occurrence is not allowed to be target occurrence of graphical accessory if it is in pattern.

    position
    Position of the accessory part.
    rotation
    Rotation of the accessory part.

    Return Value

    Created accessory occurrence.
    Exceptions
    ExceptionDescription
    Api is not in an initialized state. You can get current state from EPLAN.Harness.API.HpdApi.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.HpdApi.Init method. If API is in failed state, you can not resurrect it.
    The object is in invalid state. Obtain a new one.
    This file is not opened.
    Example
    This example shows how to place a graphical accessory to a connector in the workspace.
    // Obtain the workspace beforehand.
    Workspace workspace = ...
    
    // Define a position for the graphical accessory.
    TransformProperty<LengthProperty> position = new TransformProperty<LengthProperty>
    (
    	new LengthProperty(0, Unit.Millimeter),
    	new LengthProperty(0, Unit.Millimeter),
    	new LengthProperty(0, Unit.Millimeter)
    );
    
    // Define a rotation for the graphical accessory.
    TransformProperty<AngleProperty> rotation = new TransformProperty<AngleProperty>
    (
    	new AngleProperty(0, Unit.Degree),
    	new AngleProperty(0, Unit.Degree),
    	new AngleProperty(0, Unit.Degree)
    );
    
    // Find connector with name cn_00003.
    BaseOccurrence occurrence = workspace.GetAllOccurrences().FirstOrDefault(occ => occ != null && occ.Name.ToString() == "cn_00003");
    
    // Use accessory from library.
    BaseLibraryPart accessory = ...
    
    // Place accessory to the specified connector.
    BaseOccurrence accessory = workspace.PlaceGraphicalAccessory(accessory, occurrence, position, rotation);
    See Also