public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uiApp         = commandData.Application;
            var app           = commandData.Application.Application;
            var uiDoc         = commandData.Application.ActiveUIDocument;
            var doc           = commandData.Application.ActiveUIDocument.Document;
            var view          = doc.ActiveView;
            var storageEntity = new TestStorageEntity();
            var d1            = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);

            VLTransactionHelper.DelegateTransaction(doc, "扩展存储", () =>
            {
                ExtensibleStorageHelperV2.SetData(doc, storageEntity, storageEntity.FieldStr, "666");
                var element = doc.Delete(new ElementId(197387));
                return(true);
            });
            var d2 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);

            VLTransactionHelper.DelegateTransaction(doc, "扩展存储", () =>
            {
                ExtensibleStorageHelperV2.SetData(doc, storageEntity, storageEntity.FieldStr, "777");
                return(true);
            });
            var d3 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);

            return(Result.Succeeded);
        }
Exemple #2
0
        public void Execute(UpdaterData updateData)
        {
            var document      = updateData.GetDocument();
            var edits         = updateData.GetModifiedElementIds();
            var storageEntity = new TestStorageEntity();

            ExtensibleStorageHelperV2.SetData(document, storageEntity, storageEntity.FieldStr, "111");
        }
Exemple #3
0
        public void Execute(UpdaterData updateData)
        {
            var document      = updateData.GetDocument();
            var edits         = updateData.GetModifiedElementIds();
            var storageEntity = new TestStorageEntity();
            var lineCollector = new FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Lines).WhereElementIsNotElementType();

            foreach (var line in lineCollector)
            {
                ElementTransformUtils.MoveElement(document, line.Id, new XYZ(10, 20, 0));
            }
        }
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uiApp         = commandData.Application;
            var app           = commandData.Application.Application;
            var uiDoc         = commandData.Application.ActiveUIDocument;
            var doc           = commandData.Application.ActiveUIDocument.Document;
            var view          = doc.ActiveView;
            var storageEntity = new TestStorageEntity();

            //var s = "S1";
            ////事务1+事务2 是整体回退还是回退事务2?
            ////回退是事务型回退,事务2被回退了 Data=S1
            //TransactionHelper.DelegateTransaction(doc, "扩展存储", () =>
            //{
            //    var d1 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);
            //    ExtensibleStorageHelperV2.SetData(doc, storageEntity, storageEntity.FieldStr, s);
            //    return true;
            //});
            VLTransactionHelper.DelegateTransaction(doc, "扩展存储", () =>
            {
                //var d2 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);
                //var d2 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldNames2, storageEntity.FieldStr);
                ExtensibleStorageHelperV2.SetData(doc, storageEntity, storageEntity.FieldStr, "123");



                ////s += "S2";
                ////ExtensibleStorageHelperV2.SetData(doc, storageEntity, storageEntity.FieldStr, s);
                //var schema = ExtensibleStorageHelperV2.GetSchema(storageEntity.SchemaId, storageEntity.SchemaName, storageEntity.FieldNames2);
                //var storage = ExtensibleStorageHelperV2.GetOrCreateStorage(doc, storageEntity.StorageName);
                //Entity entity;
                //if (storage == null)
                //{
                //    storage = ExtensibleStorageHelperV2.CreateStorage(doc, storageEntity.StorageName);
                //    entity = new Entity(schema);
                //    entity.Set<string>(schema.GetField(storageEntity.FieldStr), "");
                //    storage.SetEntity(entity);
                //}
                //entity = storage.GetEntity(schema);
                //if (entity.IsValid())
                //{
                //    var data = entity.Get<string>(schema.GetField(storageEntity.FieldStr));
                //}
                return(true);
            });
            var d3 = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);

            return(Result.Succeeded);
        }
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uiApp = commandData.Application;
            var app   = commandData.Application.Application;
            var uiDoc = commandData.Application.ActiveUIDocument;
            var doc   = commandData.Application.ActiveUIDocument.Document;
            var view  = doc.ActiveView;

            VLTransactionHelper.DelegateTransaction(doc, "扩展存储", () =>
            {
                var storageEntity = new TestStorageEntity();
                var data          = ExtensibleStorageHelperV2.GetData(doc, storageEntity, storageEntity.FieldStr);
                TaskDialogShow(data);
                return(true);
            });
            return(Result.Succeeded);
        }