Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Drawing2D Class / PlaceLabelSymbol Method
Occurrence of label point.
Position of symbol in drawing.
View which will be used as drawing of this part.
Example
In This Topic
    PlaceLabelSymbol Method
    In This Topic
    Place a symbol of label into drawing. It is placed on 0, 0 coordinates.
    Syntax

    Parameters

    labelPoint
    Occurrence of label point.
    position
    Position of symbol in drawing.
    view
    View which will be used as drawing of this part.

    Return Value

    Placed label symbol occurrence.
    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.
    This file is not opened.
    You can not perform this action on a document opened as read only.
    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.
    The operation was not successful.
    Example
    // Open project
    Project project = api.OpenProject(@"d:\MyProject.hxproj");
    			
    // Select and open variant
    Variant variant = project.GetVariants()[0];
    variant.Open(false, false);
    
    // Select cable drawing and open it.
    Drawing2D drawing = variant.GetCableDrawings().FirstOrDefault(d => d.Name == "CU_1");
    //Drawing2D drawing = variant.GetNailboards().FirstOrDefault(d => d.Name == "WH_1");
    drawing.Open(false, false);
    			
    // Select label occurrence.
    IOcc2DLabel label = drawing.GetAllOccurrences().OfType<IOcc2DLabel>().FirstOrDefault(l => l.Name == "lbl_00001");
    
    // Select its 2D view.
    LibPart2DViewInfo libPartView = label.LibraryPart.Views.FirstOrDefault(v => v.Id == "2D1");
    
    // Prepare its position.
    Transform2DProperty<LengthProperty> symbolPosition = new Transform2DProperty<LengthProperty>("13.2 mm", "-5.6 mm");
    
    // Place the symbol.
    I2DSymbol symbol = drawing.PlaceLabelSymbol(label, symbolPosition, libPartView);
    
    // Save and close the project.
    drawing.Save();
    drawing.Close();
    variant.Close();
    project.Close();
    See Also