/// <summary> /// Returns Project property value with the given name /// </summary> /// <param name="project">EPLAN project</param> /// <param name="identName">Identifing name</param> /// <returns>PropertyValue</returns> public static PropertyValue GetProjectPropertyValue(Project project, string identName) { UserDefinedPropertyDefinition userDefProp = project.UserDefinedPropertyDefinitions .FirstOrDefault(u => u.IdentifyingName.Equals(identName)); if (userDefProp != null) { AnyPropertyId anyPropertyId = userDefProp.Id; PropertyValue propertyValue = project.Properties[anyPropertyId]; return(propertyValue); } return(null); }
/// <summary> /// Returns the PropertyValue /// </summary> /// <param name="function">Function</param> /// <param name="identName">Identifing name</param> /// <returns>PropertyValue</returns> public static PropertyValue GetFunctionPropertyValue(Function function, string identName) { UserDefinedPropertyDefinition userDefProp = function.Properties.ExistingIds .Select(anyPropertyId => anyPropertyId.Definition) .OfType <UserDefinedPropertyDefinition>() .FirstOrDefault(obj => obj.IdentifyingName.Equals(identName)); if (userDefProp != null) { AnyPropertyId anyPropertyId = userDefProp.Id; PropertyValue propertyValue = function.Properties[anyPropertyId]; return(propertyValue); } return(null); }