Harness proD API Help
EPLAN.Harness.API.Occurrences.CableDrawing Namespace / OccCdEllipse Class / UserDefinedProperties Property
Example
In This Topic
    UserDefinedProperties Property (OccCdEllipse)
    In This Topic
    Gets or sets a list of user-defined properties of this occurrence.
    Syntax
    public override IList<UserDefinedProperty> UserDefinedProperties {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.
    The object is in invalid state. Obtain a new one.
    The exception that is thrown when you trying to access to already deleted occurrence.
    Example
    The example shows how to set user defined properties on a fuse.
    // Init API
    HpdApi api = HpdApi.GetInstance();
    
    // Open project and variant and document.
    Project project = api.OpenProject(@"d:\MyProject.hxproj");
    					
    Variant variant = project.GetVariants()[0];
    Designer designer = variant.GetWorkdesks().FirstOrDefault(w => w.Name == "Workdesk_2");
    designer.Open(false, false);
    
    // Select a desired occurrence.
    IOccurrence occ = designer.GetAllOccurrences().FirstOrDefault(o => o.Name == "fuse_00001");
    
    // Create 2 new user defined properties.
    UserDefinedProperty udp1 = new UserDefinedProperty("Fuse response", new TextProperty("Fast"));
    UserDefinedProperty udp2 = new UserDefinedProperty("Voltage", new VoltageProperty(250d, Unit.Volt));
    
    // Add them to the occurrence.
    occ.UserDefinedProperties.Add(udp1);
    occ.UserDefinedProperties.Add(udp2);
    
    // Save changes and close documents.
    designer.Save();
    
    designer.Close();
    project.Close();
    See Also