<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Modify List Definition for a Manual Property Definition in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12064314#M8393</link>
    <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;I tested this again and had no issues. I even removed "propDefinition.SubSetDatabaseDefaults(db)" and it also worked correctly. "SubSetDatabaseDefaults" is unnecessary. It is only used when new is created.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Perhaps,&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;looping through all PropertySets that have the ListDefinition attached and then forcing an update. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;I have ACA/MEP installed and not Civil 3D. And since this situation does not occur in my tests, it is difficult to find a solution. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;If you make the project and the dwg file available, maybe someone with Civil 3D can test it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2023 17:05:40 GMT</pubDate>
    <dc:creator>Gepaha</dc:creator>
    <dc:date>2023-06-27T17:05:40Z</dc:date>
    <item>
      <title>Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12055826#M8388</link>
      <description>&lt;P&gt;I would like to&lt;/P&gt;&lt;P&gt;1. Get all ListDefinitions of a document as shown in Style Manager&lt;/P&gt;&lt;P&gt;2. Find a ListDefinition by name&lt;/P&gt;&lt;P&gt;3. Open it to Add and Remove Items from it&lt;BR /&gt;&lt;BR /&gt;How can I do that? What are the .NET methods to do that?&lt;BR /&gt;I managed to locate the class&amp;nbsp;Autodesk.Aec.DatabaseServices.ListDefinitions in code, but nothing more.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Where can I find the .NET API Reference for&amp;nbsp;Autodesk.Aec? I've been searching on&amp;nbsp;&lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-What_s_New" target="_blank"&gt;https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-What_s_New&lt;/A&gt;&amp;nbsp;but I cannot find anything.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 13:06:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12055826#M8388</guid>
      <dc:creator>tipitasa</dc:creator>
      <dc:date>2023-06-23T13:06:39Z</dc:date>
    </item>
    <item>
      <title>回复： Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12056675#M8389</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;I think it's relatively easy as there are similarities with other Aec dictionaries.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Reference to:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;C:\Program Files\Autodesk\AutoCAD xxxx\ACA\AecArchMgd.dll&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;C:\Program Files\Autodesk\AutoCAD xxxx\ACA\AecBaseMgd.dll&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Set copy local to false.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Not tested:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.Aec.Arch.DatabaseServices;
using Autodesk.Aec.DatabaseServices;

using AcDb = Autodesk.AutoCAD.DatabaseServices;
using AecDb = Autodesk.Aec.DatabaseServices;&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt; public static void ListListDefinition()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                AecDb.DictionaryListDefinition ldDict = new DictionaryListDefinition(db);

                AcDb.ObjectIdCollection objectIdCollection = ldDict.Records;
                foreach (AcDb.ObjectId ldId in objectIdCollection)
                {                    
                    ListDefinition ld = (ListDefinition)tr.GetObject(ldId, OpenMode.ForRead);
                    ed.WriteMessage($"\nList defintion name: {ld.Name}");
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public static void CreateOrAddRenameItemToListDefinition()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                AecDb.DictionaryListDefinition ldDict = new DictionaryListDefinition(db);

                try
                {
                    // Find list definition by the name
                    if (ldDict.Has("MyListDefinition", tr))
                    {
                        AcDb.ObjectId ldId = ldDict.GetAt("MyListDefinition");
                        ListDefinition ld = (ListDefinition)tr.GetObject(ldId, OpenMode.ForWrite);
                        // add item to the list definition
                        ld.AddListItem("Name1");
                        ld.AddListItem("Name2");

                        // rename item
                        AcDb.ObjectId itemId = ld.GetListItem("Name3");
                        if (!itemId.IsNull)
                        {
                            ld.RenameList(itemId, "Name3Renamed");
                        }
                        tr.Commit();
                    }
                    else
                    {
                        ListDefinition ld = new ListDefinition();
                        ld.SubSetDatabaseDefaults(db);
                        ld.SetToStandard(db);
                        ldDict.AddNewRecord("MyListDefinition", ld);
                        ld.AddListItem("Name1");
                        ld.AddListItem("Name2");
                        ld.Description = "My list definition test";
                        // Set its AppliesToFilter property
                        System.Collections.Specialized.StringCollection strCol = new System.Collections.Specialized.StringCollection();
                        // You need use internal names
                        strCol.Add("AecListUserManualPropertyDef");
                        // strCol.Add("AecListUserSpaceNames")
                        // strCol.Add("AecListUserZoneNames")
                        ld.AppliesToFilter = strCol;
                        tr.AddNewlyCreatedDBObject(ld, true);
                        tr.Commit();
                    }
                }
                catch (System.Exception ex)
                {
                    Application.ShowAlertDialog(ex.Message);
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 19:43:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12056675#M8389</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2023-06-23T19:43:32Z</dc:date>
    </item>
    <item>
      <title>回复： Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063074#M8390</link>
      <description>&lt;P&gt;Do you maybe know what needs to be done for the changes to ListDefinition to be shown in PROPERTIES &amp;gt; Extended Data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I modify the ListDefinition by adding or removing List Items, the changes are shown correctly in the Style Manager.&lt;BR /&gt;However, on the&amp;nbsp;PROPERTIES &amp;gt; Extended Data &amp;gt; PROPERTY SETS the lists next to particular property definitions either do not change or even show an error message *Error getting value*.&lt;BR /&gt;&lt;BR /&gt;When I close the whole PROPERTIES panel and then reopen it, the lists show the correct items.&lt;BR /&gt;&lt;BR /&gt;This is the code that I use:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.Aec.DatabaseServices;
using Autodesk.Aec.PropertyData.DatabaseServices;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

using System.Collections.Generic;

using ObjectId = Autodesk.AutoCAD.DatabaseServices.ObjectId;&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;        Database _db = Application.DocumentManager.MdiActiveDocument.Database;

        internal void ImportStyleNamesToPropertySetListDefinitions()
        {
            ObjectId propertySetDefinitionId = ObjectId.Null;
            List&amp;lt;string&amp;gt; stylesToAdd = new List&amp;lt;string&amp;gt;();

            using (var tr = _db.TransactionManager.StartTransaction())
            {
                // open property set definition
                var propSetDef = tr.GetObject(propertySetDefinitionId, OpenMode.ForWrite) as PropertySetDefinition;

                // for each of the definitions in it
                foreach (PropertyDefinition propDefinition in propSetDef.Definitions)
                {
                    // go by name
                    if (propDefinition.Name == "SomeName")
                    {
                        if (propDefinition.DataType == Autodesk.Aec.PropertyData.DataType.List)
                        {
                            // get source list definition id
                            var listDefinitionId = propDefinition.ListDefinitionId;

                            // open this list definition
                            var listDefinition = tr.GetObject(listDefinitionId, OpenMode.ForWrite) as ListDefinition;

                            // add style name items to it
                            foreach (string styleName in stylesToAdd)
                                listDefinition.AddListItem(styleName);
                        }
                    }
                    
                }
                tr.Commit();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 09:15:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063074#M8390</guid>
      <dc:creator>tipitasa</dc:creator>
      <dc:date>2023-06-27T09:15:39Z</dc:date>
    </item>
    <item>
      <title>回复： Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063579#M8391</link>
      <description>&lt;P&gt;I tested it here and for me it is working correctly. I just added propDefinition.SubSetDatabaseDefaults(db).&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; // add style name items to it
foreach (string styleName in stylesToAdd)
   listDefinition.AddListItem(styleName);
propDefinition.SubSetDatabaseDefaults(db);&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 Jun 2023 12:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063579#M8391</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2023-06-27T12:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063721#M8392</link>
      <description>&lt;P&gt;Thank you for your help. It's better now, but still does not work as it should.&lt;BR /&gt;&lt;BR /&gt;The first time the command runs, I still get the error message. Then I manually remove and add the property set and after that it works every time. Well, I still need to change to another tab and then back, but that's not too bad.&lt;BR /&gt;&lt;BR /&gt;Do you maybe know of something else I could try or have an idea of what could go wrong in the background?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 13:29:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12063721#M8392</guid>
      <dc:creator>tipitasa</dc:creator>
      <dc:date>2023-06-27T13:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12064314#M8393</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;I tested this again and had no issues. I even removed "propDefinition.SubSetDatabaseDefaults(db)" and it also worked correctly. "SubSetDatabaseDefaults" is unnecessary. It is only used when new is created.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;Perhaps,&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;looping through all PropertySets that have the ListDefinition attached and then forcing an update. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;I have ACA/MEP installed and not Civil 3D. And since this situation does not occur in my tests, it is difficult to find a solution. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT&gt;If you make the project and the dwg file available, maybe someone with Civil 3D can test it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 17:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12064314#M8393</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2023-06-27T17:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Modify List Definition for a Manual Property Definition</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12068653#M8394</link>
      <description>&lt;P&gt;I am just adding the &lt;A href="https://forums.autodesk.com/t5/net/modifying-string-items-in-property-definition-list-does-not-show/td-p/12063581" target="_blank" rel="noopener"&gt;link&lt;/A&gt; to the connected post, where the issue with the error message has been solved in.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 09:15:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-list-definition-for-a-manual-property-definition/m-p/12068653#M8394</guid>
      <dc:creator>tipitasa</dc:creator>
      <dc:date>2023-06-29T09:15:15Z</dc:date>
    </item>
  </channel>
</rss>

