public static bool setTagOnElement <T>(BCOM.Element element, string tagSetName, string tagName, T value, BCOM.MsdTagType type = BCOM.MsdTagType.Character) { BCOM.TagElement tag = null; BCOM.DesignFile dgnFile = element.ModelReference.DesignFile; BCOM.TagSet tagSet = getTagSetOrCreate(dgnFile, tagSetName); try { tag = element.GetTag(tagSet, tagName); } catch (Exception) {} if (tag == null) { BCOM.TagDefinition tagDef = getTagDefOrCreate(tagSet, tagName, type); // TODO tagDef.IsHidden = ... tag = element.AddTag(tagDef); } if (tag != null) { tag.Value = value; tag.Rewrite(); return(true); } return(false); }
public static bool ScanElementHasMappingTags(BCOM.Element comElement, out IEnumerable <TagToDataGroupMapProperty> mapTags) { var listProps = new List <TagToDataGroupMapProperty>(); foreach (TagToDataGroupMapProperty item in TagsToDataGroupMapping.Instance.Items) { BCOM.TagElement tag = comElement.GetTags().FirstOrDefault(x => x.TagSetName.Equals(item.TagSetName) && x.TagDefinitionName.Equals(item.TagName)); if (tag != null) { item.Value = tag.Value; listProps.Add(item); } } mapTags = listProps.Count != 0 ? listProps : null; return(listProps.Count != 0); }