首页 > 解决方案 > 使用 C# SDK 在 AutoCAD 的活动设计文档中创建 PropertySet

问题描述

我正在尝试在 AutoCAD 中当前活动的设计文档中创建 PropertySet,但在以下行中出现异常 eInvalidInput,

var dictionaryPropertyDataFormat = new DictionaryPropertyDataFormat(database);

整个方法如下所示。

    internal static void CreatePropertySet()
    {
        var database = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
        try
        {
            var dictionaryPropertyDataFormat = new DictionaryPropertyDataFormat(database);
            var propertySetDefinition = new PropertySetDefinition();

            using (Transaction transaction1 = database.TransactionManager.StartTransaction())
            {
                //Code to create PropertySet.
            }

        }
        catch(System.Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

关于我在这里做错的任何建议或想法。

提前致谢。

标签: c#autocadautocad-plugin

解决方案


推荐阅读