Harness proD API Help
EPLAN.Harness.API.DataStructures.DisplayConfigurations Namespace / WireSymbolSetting Class / WireSymbol Property
Example
In This Topic
    WireSymbol Property (WireSymbolSetting)
    In This Topic
    Get or set the current 2D symbol of wire. It is a library part. An active library connection must be available even an exception will be thrown. Pass null value to reset the symbol. Returns a wire symbol as a library part or null if not set. EPLAN.Harness.API.LibraryParts.LibWireSymbol
    Syntax
    public LibWireSymbol WireSymbol {get; set;}
    Exceptions
    ExceptionDescription
    Api is not in an initialized state. You can get current state from Status property. If API is uninitialized, you can initialize it by calling Init(String,String[]) method. If API is in failed state, you can not resurrect it.
    Argument is null.
    The exception that is thrown when the active library is not found or the active library is empty.
    Example
    The example shows how to get the wire symbol.
    // Init API
    HpdApi api = HpdApi.GetInstance();
    
    // Open project.
    Project project = api.OpenProject(@"d:\MyProject.hxproj");
    
    // Get a default nailboard display configuration
    DisplayConfiguration dc = project.NailboardDisplayConfigurations.DefaultDisplayConfiguration;
    
    // Get the wire symbol.
    LibWireSymbol wireSymbol = dc.WireSymbol;
    
    // Close the project.
    project.Close();
    The example shows how to set the wire symbol.
    // Init API
    HpdApi api = HpdApi.GetInstance();
    
    // Open project.
    Project project = api.OpenProject(@"d:\MyProject.hxproj");
    
    // Get a default nailboard display configuration
    DisplayConfiguration dc = project.NailboardDisplayConfigurations.DefaultDisplayConfiguration;
    
    // The wire symbol is the library part. Get the library connection to select the symbol.
    ActiveLibraryConnection lc = project.ActiveConnection;
    LibWireSymbol ws = lc.GetAllLibraryPartsInfo().OfType<LibWireSymbol>().FirstOrDefault(w => w.PartNumber == "Wire symbol (round) + Cross-section");
    
    // Allow placing of the symbol and set it up.
    dc.WireSymbol.Place = true;
    dc.WireSymbol = ws;
    
    // Or reset the symbol
    // dc.WireSymbol.Place = false;
    // dc.WireSymbol = null;
    
    // Save and close the project.
    project.Save();
    project.Close();
    See Also