Harness proD API Help
EPLAN.Harness.API.Occurrences.Interfaces Namespace / IOccNbConnectorPoint Interface / OriginalOccId Property
Example
In This Topic
    OriginalOccId Property (IOccNbConnectorPoint)
    In This Topic
    ID of the original 3D occurrence from which this occurrence is derived.
    Syntax
    string OriginalOccId {get;}
    Remarks
    Returns null for not derived occurrences.
    Example
    This example shows how to find the original occurrence from which the 2D occurrence is derived.
    Project project = HpdApi.GetInstance().OpenProject("project path");
    Variant variant = project.GetVariants().First();
    
    // Open drawing (Nailboard in this example).
    Drawing2D drawing = variant.GetNailboards().FirstOrDefault(n => n.Name == "nailboard name");
    drawing.Open(false, false);
    
    // Find the desired 2D occurrence.
    Base2DOccurrence nailboardOcc = drawing.GetAllOccurrences<Base2DOccurrence>().FirstOrDefault(o => o.Name == "nailboard occurrence");
    
    // ID of the original occurrence.
    string origId = nailboardOcc.OriginalOccId;
    
    // Get the ID of the source document from which the occurrence comes.
    string docId = drawing.GetSources().FirstOrDefault(s => s.Id == nailboardOcc.ParentWireHarness.Id)?.DocumentId;
    
    // Open the source document.
    Designer designer = variant.GetWorkspaces().Union<Designer>(variant.GetWorkdesks()).FirstOrDefault(d => d.ID == docId);
    designer.Open(false, false);
    
    // Find the original occurrence.
    Base3DOccurrence occ = designer.GetAllOccurrences<Base3DOccurrence>().FirstOrDefault(o => o.ID == origId);
    See Also