Harness proD API Help
EPLAN.Harness.API.Occurrences.Workspace Namespace / OccWsRapidRibbonCable Class / RapidPartAddWire Method
Example
In This Topic
    RapidPartAddWire Method (OccWsRapidRibbonCable)
    In This Topic
    Add a wire to the rapid cable.
    Syntax
    public IWireCommon RapidPartAddWire()

    Return Value

    An occurrence of the virtual or latent wire.
    Exceptions
    ExceptionDescription
    This method is available only for rapid parts.
    Example
    The example shows hot to add a wire to the cable which is a rapid prototype.
    // Initialize API
    HpdApi api = HpdApi.GetInstance();
    api.Init();
    
    // Open project and workdesk or workspace.
    Project project = api.OpenProject(@"c:\Projects\MyProject.hxproj");
    					
    Variant variant = project.GetVariants().FirstOrDefault();
    Designer designer = variant.GetWorkdesks().FirstOrDefault(d => d.Name == "Workdesk_1");
    designer.Open(false, false);
    
    // Select cable occurrence and add a wire.
    IOccCable cable = designer.GetAllOccurrences().OfType<IOccCable>().FirstOrDefault(c => c.Name == "ca_00004");
    IWireCommon addedWire = cable.RapidPartAddWire();
    
    // Save changes and close documents.
    designer.Save();
    
    designer.Close();
    project.Close();
    See Also