Removing All/1 Property from the DatabaseSummaryInfoBuilder CustomPropertyTable

Removing All/1 Property from the DatabaseSummaryInfoBuilder CustomPropertyTable

Anonymous
不适用
1,117 次查看
2 条回复
1 条消息(共 3 条)

Removing All/1 Property from the DatabaseSummaryInfoBuilder CustomPropertyTable

Anonymous
不适用

I'm attempting to remove Custom properties from a drawing like so

 

public static void RemoveCustomProperty(this Database db, string key)
        {
            DatabaseSummaryInfoBuilder infoBuilder = new DatabaseSummaryInfoBuilder(db.SummaryInfo);
            IDictionary custProps = infoBuilder.CustomPropertyTable;
            custProps.Remove(key);
        }

and 

 

public static void RemoveCustomProperties(this Database db)
        {
            DatabaseSummaryInfoBuilder infoBuilder = new DatabaseSummaryInfoBuilder(db.SummaryInfo);
            IDictionary custProps = infoBuilder.CustomPropertyTable;
            custProps.Clear();
        }

However they don't seem to work and I keep running into a deadend.

 

Am i missing something silly?? - Thanks for any help

0 个赞
已接受的解答 (1)
1,118 次查看
2 条回复
回复 (2)
2 条消息(共 3 条)

_gile
Consultant
Consultant
已接受的解答

Hi,

 

You need to overwrite the summary info after editing the dictionary.

 

        public static void RemoveCustomProperty(this Database db, string key)
        {
            DatabaseSummaryInfoBuilder infoBuilder = new DatabaseSummaryInfoBuilder(db.SummaryInfo);
            IDictionary custProps = infoBuilder.CustomPropertyTable;
            custProps.Remove(key);
            db.SummaryInfo = infoBuilder.ToDatabaseSummaryInfo();
        }

 

        public static void RemoveCustomProperties(this Database db)
        {
            DatabaseSummaryInfoBuilder infoBuilder = new DatabaseSummaryInfoBuilder(db.SummaryInfo);
            IDictionary custProps = infoBuilder.CustomPropertyTable;
            custProps.Clear();
            db.SummaryInfo = infoBuilder.ToDatabaseSummaryInfo();
        }

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

3 条消息(共 3 条)

Anonymous
不适用
Thanks, kind of assumed it was something silly - Sorry it took me a while to get around to test this. Thanks!!
0 个赞