Issue
When defining an automatic property in a property set definitions in AutoCAD Architecture, you are presented with a list of automatic definitions that are applicable to a given object. How can I get the list of those automatic properties using .NET API?
Solution
You can use a method:
PropertyDataServices.FindAutomaticSourceNames(objectName, db)
This returns a list of automatic property names that you see in the "Automatic Property Source" dialog. The following code demonstrates its usage.
' List automatic property source or a set of possible automatic
' properties.
<CommandMethod("ACANetScheduleLabs",
"AcaListAutomaticPropertySource",
CommandFlags.Modal)> _
Public Sub ListAutomaticPropertySource()
' Top most objects
Dim doc As Document =
Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
' Here is the main method. Get the list of possible automatic
' properties, as an example, for a door object
Dim propNames() As String =
PropertyDataServices.FindAutomaticSourceNames("AecDbDoor", db)
' Show the list that we just got
ed.WriteMessage(
" -- automatic property source < AecDbDoor > -- " +
vbCrLf + vbCrLf)
For Each name As String In propNames
ed.WriteMessage(name + vbCrLf)
Next
End Sub