Harness proD API Help
EPLAN.Harness.API.Occurrences.Workdesk Namespace / OccWdRapidCableWire Class / DeactivateCableWire Method
Example
In This Topic
    DeactivateCableWire Method (OccWdRapidCableWire)
    In This Topic
    Set a wire of cable to be inactive. The wire occurrence is changed to the occurrence of latent wire and it is disconnected from pins.
    Syntax
    public IOccRapidLatentWire DeactivateCableWire()

    Return Value

    Occurrence of latent wire
    Example
    // 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 wire.
    IOccCable cable = designer.GetAllOccurrences().OfType<IOccCable>().FirstOrDefault(c => c.Name == "ca_00004");
    IWireCommon wire = cable.CableSubParts.OfType<IWireCommon>().FirstOrDefault(w => w.Name == "Wire:1");
    					
    // Deactivate the wire.
    IOccLatentWire deactivatedWire;
    if (wire is IOccCableWire cableWire)
    {
    	deactivatedWire = cableWire.DeactivateCableWire();
    }
    			
    // Save changes and close documents.
    designer.Save();
    
    designer.Close();
    project.Close();
    See Also