Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceLabel Method
Library part of the label.
A part on which the label is to be placed.
First edge point among which the label is to be placed.
Second edge point among which the label is to be placed.
Position of the label.
Determines if part's accessories will be placed with part. Mandatory, Optional, both types or None accessories can be placed. This enum has the Flags attribute.
Example
In This Topic
    PlaceLabel Method
    In This Topic
    Place a label between two control points on a bundle, wire, shield, etc..
    Syntax

    Parameters

    part
    Library part of the label.
    parentOcc
    A part on which the label is to be placed.
    firstPoint
    First edge point among which the label is to be placed.
    secondPoint
    Second edge point among which the label is to be placed.
    position
    Position of the label.
    linkType
    Determines if part's accessories will be placed with part. Mandatory, Optional, both types or None accessories can be placed. This enum has the Flags attribute.

    Return Value

    Placed cable tie.
    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.
    Thrown when the type of part can not be placed by the method.
    Thrown when both edge points do not lie on one part of path.
    Thrown when edge points do not lie next to each other.
    Remarks

    Controls points have to be neighboring.

    Example
    This example shows how to place a label on a bundle.
    /// Obtain project and workspace beforehand and open for writing.
    Project proj = ...
    Workspace workspace = ...
    workspace.Open(false, false);
    
    // label library part. (assume the library connected to project contains the library part)
    var labelPart = proj.ActiveConnection.GetLibraryPartsByPartNumber("label lib part").FirstOrDefault();
    
    // Obtain wire from workspace
    IOccBundle bundle = workspace.GetAllOccurrences<IOccBundle>().FirstOrDefault(occ => occ.Name.ToString() == "myBundle");
    
    // Obtain controls points from bundle.
    List<IControlPoint> controlPoints = bundle.GetAllControlPoints().ToList();
    IControlPoint firstPoint = controlPoints.FirstOrDefault(c => c.Name.ToString() == "occ_1");
    IControlPoint secondPoint = controlPoints.FirstOrDefault(c => c.Name.ToString() == "occ_2");
    
    // Position of the cable tie.
    TransformProperty<LengthProperty> position = new TransformProperty<LengthProperty>
    (
    	new LengthProperty(-50, Unit.Millimeter),
    	new LengthProperty(120, Unit.Millimeter),
    	new LengthProperty(70, Unit.Millimeter)
    );
    
    // Place attached part to occurrence.
    workspace.PlaceLabel(labelPart, bundle, firstPoint, secondPoint, position);
    See Also