Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Drawing2D Class / PlaceConnectableObjectSymbol Method
Occurrence of related control point (in nailboard) or end symbol (in cable drawing).
Occurrence of connectable object. (It is not visible in the scene. It is present in the treeview only.)
Position of symbol in drawing.
View which will be used as drawing of this part.
Example
In This Topic
    PlaceConnectableObjectSymbol Method
    In This Topic
    Place a symbol of connectable object symbol into drawing. It is placed on 0, 0 coordinates. See examples how to obtain a control point or an end symbol.
    Syntax

    Parameters

    point
    Occurrence of related control point (in nailboard) or end symbol (in cable drawing).
    connectable
    Occurrence of connectable object. (It is not visible in the scene. It is present in the treeview only.)
    position
    Position of symbol in drawing.
    view
    View which will be used as drawing of this part.

    Return Value

    Placed connectable object symbol.
    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 nailboard and open it.
    Drawing2D drawing = variant.GetNailboards().FirstOrDefault(d => d.Name == "WH_1");
    drawing.Open(false, false);
    
    // Select a connectable object (connector, terminal, signal device etc.) excluding a ribbon connector.
    BaseNbConnectableObject co = drawing.GetAllOccurrences().OfType<BaseNbConnectableObject>().FirstOrDefault(c => c.Name == "cn_00002");
    
    // Select its fan point. It can have more than one.
    IFanPoint cp = co.FanPoints.FirstOrDefault(c => c.Name == "cp_00004");
    
    // Select its 2D view.
    LibPart2DViewInfo libPartView = cp.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.PlaceConnectableObjectSymbol(cp as BaseOccurrence, co, symbolPosition, libPartView);
    
    // Select ribbon or inline ribbon connector.
    BaseNbConnectableObject ribbonCon = drawing.GetAllOccurrences().OfType<BaseNbConnectableObject>().FirstOrDefault(c => c.Name == "cn_00004");
    
    // Get its control point.
    IOccNbRibbonConnectorPoint ribbonCp = ribbonCon.Children.OfType<IOccNbRibbonConnectorPoint>().FirstOrDefault();
    
    // Select ID of 2D symbol or use default if one is present only.
    LibPart2DViewInfo ribbonView = co.LibraryPart.Views.FirstOrDefault();
    
    // Prepare its position.
    symbolPosition = new Transform2DProperty<LengthProperty>("13.2 mm", "-5.6 mm");
    
    // Place the symbol.
    I2DSymbol ribbonSymbol = drawing.PlaceConnectableObjectSymbol(ribbonCon as BaseOccurrence, ribbonCon, symbolPosition, ribbonView);
    
    // Save and close project.
    drawing.Save();
    drawing.Close();
    variant.Close();
    project.Close();
    // 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");
    drawing.Open(false, false);
    			
    // Select a connectable object (connector, terminal, signal device etc.).
    IOcc2DConnectableObject co = drawing.GetAllOccurrences().OfType<IOcc2DConnectableObject>().FirstOrDefault(c => c.Name == "cn_00002");
    
    // Get its end symbol.
    OccCdConnectableObjectEndSymbol cp = co.Children.OfType<OccCdConnectableObjectEndSymbol>().FirstOrDefault();
    
    // Select its 2D view.
    LibPart2DViewInfo libPartView = co.LibraryPart.Views.FirstOrDefault(v => v.Id == "2D1");
    
    // Prepare its position.
    symbolPosition = new Transform2DProperty<LengthProperty>("13.2 mm", "-5.6 mm");
    
    // Place the symbol.
    I2DSymbol symbol = drawing.PlaceConnectableObjectSymbol(cp as BaseOccurrence, co, symbolPosition, libPartView);
    
    // Save and close the project.
    drawing.Save();
    drawing.Close();
    variant.Close();
    project.Close();
    See Also