I use the following function to get all objectIDs with an appname, the problem is, it's returning objects that are on frozen layers, which is not desireable.
Do I need to iterate through all the entities and check if the entities layer is frozen? Maybe there's a better way to do this with selection filters or another method than .SelectAll?
/// <summary>
/// Gets all objectIDs in the drawing with the specified appname written to it's xData.
/// </summary>
/// <param name="appName">Name of the appName to filter for</param>
/// <param name="modelspaceOnly">Only select objects in modelspace</param>
/// <returns></returns>
public static ObjectIdCollection GetAllObjectIDs(string appName, bool modelspaceOnly = true)
{
ObjectIdCollection result
= new ObjectIdCollection
(); TypedValueList filterArray
= new TypedValueList
() {
new TypedValue
((int)DxfCode
.ExtendedDataRegAppName, appName
) };
if (modelspaceOnly
) filterArray
.Add(new TypedValue
(67,
0)); SelectionFilter appNameFilter
= new SelectionFilter
(filterArray
); PromptSelectionResult psr =
Active.Editor.SelectAll(appNameFilter);
if (psr.Status == PromptStatus.OK)
{
return new ObjectIdCollection
(psr
.Value.GetObjectIds()); }
return result;
}