/// <summary>
        /// Suppresses a pattern by the given name
        /// </summary>
        /// <param name="pattern"></param>
        /// <param name="status"></param>
        /// <exception cref="Exception"></exception>
        public void SuppressPattern(string pattern, bool status)
        {
            OccurrencePattern occPattern = null;

            try
            {
                occPattern = _adoc._adef.OccurrencePatterns[pattern];
            }
            catch
            {
                throw new Exception("Could not find pattern " + pattern);
            }

            int count = occPattern.OccurrencePatternElements.Count;

            for (int i = 1; i <= count; i++)
            {
                OccurrencePatternElement occelement = occPattern.OccurrencePatternElements[i];

                ComponentOccurrencesEnumerator occenum = occelement.Occurrences;

                foreach (ComponentOccurrence occ in occenum)
                {
                    if (status)
                    {
                        occ.BOMStructure = BOMStructureEnum.kReferenceBOMStructure;
                        occ.Suppress();
                    }
                    else
                    {
                        occ.Unsuppress();
                        occ.BOMStructure = BOMStructureEnum.kDefaultBOMStructure;
                    }
                } //next
            }
        }
Ejemplo n.º 2
0
 public InventorPattern(OccurrencePattern pattern)
 {
     _pattern = pattern;
 }
Ejemplo n.º 3
0
		/// <summary>
		///     Gets the <paramref name="occurrencePattern" />'s <see cref="FieldMetadata" /> for the <paramref name="field" />.
		/// </summary>
		/// <param name="occurrencePattern">The occurrence pattern instance the metadata should be returned for.</param>
		/// <param name="field">The field the metadata should be returned for.</param>
		public static FieldMetadata GetFieldMetadata(OccurrencePattern occurrencePattern, FieldInfo field)
		{
			Requires.NotNull(occurrencePattern, () => occurrencePattern);
			Requires.NotNull(field, () => field);

			var fieldMetadata = occurrencePattern.Metadata.Fields.SingleOrDefault(f => f.FieldInfo == field);
			Requires.That(fieldMetadata != null, () => field, "The occurrence pattern does not declare the given field.");

			return fieldMetadata;
		}