Example #1
0
        /// <summary>
        /// 生成标注
        /// </summary>
        public AnnotationBuildResult GenerateMultipleTagSymbol(Document document, IEnumerable <ElementId> selectedIds, MultiPipeTagLocation location)
        {
            Document   = document;
            Collection = PipeAnnotationContext.GetCollection(Document);
            PipeAnnotationEntity entity = new PipeAnnotationEntity();

            entity.LocationType = location;
            View view = Document.ActiveView;
            AnnotationBuildResult result = GenerateMultipleTagSymbol(selectedIds, entity, view);

            if (result == AnnotationBuildResult.Success)
            {
                Collection.Add(entity);
                Collection.Save(Document);
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// 取数据Collection
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static PipeAnnotationEntityCollection GetCollection(Document doc)
        {
            if (Collection != null)
            {
                return(Collection);
            }

            var    schema  = GetSchema(SchemaId, SchemaName);
            var    storage = GetStorage(doc);
            Entity entity;

            if (storage == null)
            {
                storage = CreateStorage(doc, StorageName);
                entity  = new Entity(schema);
                entity.Set <string>(schema.GetField(FieldName), "");
                storage.SetEntity(entity);
            }
            entity = storage.GetEntity(schema);
            string data = entity.Get <string>(schema.GetField(FieldName));

            Collection = new PipeAnnotationEntityCollection(data);
            return(Collection);
        }