<?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: Erase all property sets apart from named in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13121851#M1121</link>
    <description>&lt;P&gt;I have reviewed my code and I actually already had the answer elsewhere but it just needed a tweak.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Private Function GetPropertySetDefinitionIdAll(ByVal PSDObColl As ObjectIdCollection)
        Dim psdId As ObjectId = ObjectId.Null
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
        Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager

        Using trans As Transaction = tm.StartTransaction()
            Try
                Dim psdDict As AecPropDb.DictionaryPropertySetDefinitions = New AecPropDb.DictionaryPropertySetDefinitions(db)

                For Each psdId In psdDict.Records
                    If Not PSDObColl.Contains(psdId) Then
                        PSDObColl.Add(psdId)
                    End If
                Next
            Catch ex As CivilException
            End Try

            trans.Commit()
        End Using
    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Above code gets the objectid's for all PropertySetDefinitions in the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so you can set and test each one.&lt;/P&gt;&lt;LI-CODE lang="general"&gt; For Each PsId As ObjectId In PSDObColl
                        Dim def As PropertySetDefinition = CType(tr.GetObject(PsId, OpenMode.ForWrite), PropertySetDefinition)
'Some Actions Here
next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this I've now deleted all duplicate PSets, just not sure why they appear to make duplications in the first instance. It must be a bug, becoming duplicated by Dreffing the network in but interesting that the description which includes the path also becomes duplicated as Path Path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Smells a bit like the _Xref_Scales issue we had and still have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 11:11:32 GMT</pubDate>
    <dc:creator>MikeEvansUK</dc:creator>
    <dc:date>2024-10-31T11:11:32Z</dc:date>
    <item>
      <title>Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118222#M1116</link>
      <description>&lt;P&gt;Hi, I'm being plagued by duplicate property sets and its driving me mad.&lt;/P&gt;&lt;P&gt;The problem (i think) seems to be linked somehow to Drefed pipe networks and Reference templates being used for the PSet information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I went down the .net route to delete these duplicates but now even though the duplicate sets are not actually tagged to a structure I cannot seem to remove/purge them unless I change the def applies to filter to None, the file becomes slower as a result and I've 300 + duplicates (one for each manhole) to remove.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to scan through the entire PS tables and look for anything I don't want and erase it but I cannot seem to find a way without using an object or known objectid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone give me a pointer as to how to find all PS definitions, check if their Applies to filter is AeccDbStructure or not then erase if the name doesn't match the master one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-10-30 13_33_39-Style Manager.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1427661i181AD27C7CBF82B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-10-30 13_33_39-Style Manager.png" alt="2024-10-30 13_33_39-Style Manager.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 14:46:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118222#M1116</guid>
      <dc:creator>michael</dc:creator>
      <dc:date>2024-10-30T14:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118463#M1117</link>
      <description>&lt;P&gt;I posted this thread a while back for examples of working-with and creating property sets. You might find it helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/civil-3d-customization/property-sets-a-quick-how-to/m-p/12502844" target="_blank"&gt;Property Sets - A Quick How To - Autodesk Community - Civil 3D&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 16:49:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118463#M1117</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2024-10-30T16:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118527#M1118</link>
      <description>&lt;P&gt;Thanks Hippe, I have read that and used the functions before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That deals with a known name and looks it up but I need it to return all other objectid's for anything which doesn't match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't seem to figure out where the container is located so I can iterate these and find the duplicates to erase.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike (Using AlterEgo) &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 17:15:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118527#M1118</guid>
      <dc:creator>MikeEvansUK</dc:creator>
      <dc:date>2024-10-30T17:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118703#M1119</link>
      <description>&lt;P&gt;Do you already know the objects that might have a propertyset attached to it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim dbObject As DBObject = tr.GetObject(selRes.ObjectId, OpenMode.ForRead)
Dim ids As ObjectIdCollection = PropertyDataServices.GetPropertySetDefinitionsUsed(dbObject)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hippe013_0-1730312555190.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1427740i16D2B8B4C5AC93EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hippe013_0-1730312555190.png" alt="hippe013_0-1730312555190.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 18:25:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13118703#M1119</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2024-10-30T18:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13121448#M1120</link>
      <description>&lt;P&gt;I have structures with the master def attached but all the duplicates have been detached/not attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it’s the duplicates which I want to delete, they won’t purge otb unless I set the applied to as none.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;given there’s 300+ of them I don’t really want to do that manually (one by one).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I need to get the defs in the main styles? Or wherever then clean from there as I cannot use an object I’d.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 07:58:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13121448#M1120</guid>
      <dc:creator>MikeEvansUK</dc:creator>
      <dc:date>2024-10-31T07:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Erase all property sets apart from named</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13121851#M1121</link>
      <description>&lt;P&gt;I have reviewed my code and I actually already had the answer elsewhere but it just needed a tweak.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Private Function GetPropertySetDefinitionIdAll(ByVal PSDObColl As ObjectIdCollection)
        Dim psdId As ObjectId = ObjectId.Null
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
        Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager

        Using trans As Transaction = tm.StartTransaction()
            Try
                Dim psdDict As AecPropDb.DictionaryPropertySetDefinitions = New AecPropDb.DictionaryPropertySetDefinitions(db)

                For Each psdId In psdDict.Records
                    If Not PSDObColl.Contains(psdId) Then
                        PSDObColl.Add(psdId)
                    End If
                Next
            Catch ex As CivilException
            End Try

            trans.Commit()
        End Using
    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Above code gets the objectid's for all PropertySetDefinitions in the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so you can set and test each one.&lt;/P&gt;&lt;LI-CODE lang="general"&gt; For Each PsId As ObjectId In PSDObColl
                        Dim def As PropertySetDefinition = CType(tr.GetObject(PsId, OpenMode.ForWrite), PropertySetDefinition)
'Some Actions Here
next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this I've now deleted all duplicate PSets, just not sure why they appear to make duplications in the first instance. It must be a bug, becoming duplicated by Dreffing the network in but interesting that the description which includes the path also becomes duplicated as Path Path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Smells a bit like the _Xref_Scales issue we had and still have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 11:11:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/erase-all-property-sets-apart-from-named/m-p/13121851#M1121</guid>
      <dc:creator>MikeEvansUK</dc:creator>
      <dc:date>2024-10-31T11:11:32Z</dc:date>
    </item>
  </channel>
</rss>

