1

I am trying to create a PropertySet in currently active design document in AutoCAD, but I am getting an exception eInvalidInput in the following line,

var dictionaryPropertyDataFormat = new DictionaryPropertyDataFormat(database);

The whole method looks like below.

    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);
        }
    }

Any suggestions or ideas on what I am doing wrong here.

Thanks in advance.

Umar
  • 478
  • 3
  • 10

1 Answers1

0

your dictionary is wrong, must be:

DictionaryPropertySetDefinitions dpsd = new DictionaryPropertySetDefinitions(database);

DictionaryPropertyDataFormat(database) is for Property Data Format, not Property Sets.