Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:50:15+00:00 2026-06-16T21:50:15+00:00

I have objects in Autocad drawing with property named Base . I am trying

  • 0

I have objects in Autocad drawing with property named Base. I am trying to find all objects in that drawing with Base property has a specific string value such as “Pipe“.

I can iterate objects in the drawing and get all object ids. Then I get all properties of object with that Id and check if property named Base = "Pipe".

Iteration performance is not good enough. Is there any way to directly get object ids that has property named Base = "Pipe"?

Here is how I iterate through all objects:

    List<ObjectId> ObjectIds = new List<ObjectId>();

    foreach (Document Document in Documents)
    {
        Database Database = Document.Database;

        using (Transaction Transaction = Database.TransactionManager.StartTransaction())
        {
            for (long i = Database.BlockTableId.Handle.Value; i < Database.Handseed.Value; i++)
            {
                ObjectId Id;

                if (Database.TryGetObjectId(new Handle(i), out Id))
                {
                        ObjectIds.Add(Id);
                }
            }

            Transaction.Commit();
        }
    }

And here is how I get all properties of the objects in my ObjectIds collection.

public static DataLinksManager DataLinks
{
    get
    {
        if (null == _DataLinks)
        {
            StringCollection Coll = Autodesk.ProcessPower.DataLinks.DataLinksManager.GetLinkManagerNames();

            if (Coll.Count > 0)
            {
                if (Coll[0] != string.Empty)
                {
                    _DataLinks = Autodesk.ProcessPower.DataLinks.DataLinksManager.GetManager(Coll[0]);
                }
            }
        }

        return _DataLinks;
    }
}

private static DataLinksManager _DataLinks;

foreach(var Id in ObjectIds)
{
    List<KeyValuePair<string, string>> Properties = DataLinks.GetAllProperties(Id, true);
    // I check existence of my property and if so its value.
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:50:16+00:00Added an answer on June 16, 2026 at 9:50 pm

    In case anyone needs, here is the code that is solution to my problem. The trick is the Iterate method. This is based on this article by Philippe Leefsma. What I add to this method is a list of ObjectClass properties of found ObjectId instances. My sample dawing has around 8500 ObjectIds. However what I’m interested in is objects with base classes acppasset and acppdynamicasset and count of such objects is 90.

    using Autodesk.AutoCAD.ApplicationServices;
    using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
    
    public static void GetObjects()
    {
        List<KeyValuePair<string, ObjectId>> ObjectIds = new List<KeyValuePair<string, ObjectId>>();
    
        List<string> Filter = new List<string>() { "acppasset", "acppdynamicasset" };
    
        foreach (Document Document in this.Documents)
        {
            ObjectIdCollection Ids = this.Iterate(Document, Filter);
            if (null != Ids) foreach (var Id in Ids.OfType<ObjectId>()) ObjectIds.Add(new KeyValuePair<string, ObjectId>(System.IO.Path.GetFileNameWithoutExtension(Document.Name), Id));
        }
    
        this.Results = new Dictionary<string, List<List<KeyValuePair<string, string>>>>();
    
        foreach (var Id in ObjectIds)
        {
            try
            {
                var Properties = this.GetObject(Id.Value);
                if (null == Properties) continue;
    
                var Base = Properties.Where(x => x.Key == "Base").FirstOrDefault();
    
                if (string.IsNullOrWhiteSpace(Base.Value)) continue;
    
                if (!this.Results.ContainsKey(Base.Value)) this.Results.Add(Base.Value, new List<List<KeyValuePair<string, string>>>());
    
                this.Results[Base.Value].Add(Properties);
            }   catch { }
        }
    }
    
     public ObservableCollection<Document> Documents { get; set; }
    
     public ObjectIdCollection Iterate(Document Document, List<string> Filter = null)
            {
                ads_name Instance = new ads_name();
                Database Database = Document.Database;
    
                ObjectIdCollection ValidIds = new ObjectIdCollection();
    
                // Get the last handle in the Database
                Handle Handseed = Database.Handseed;
    
                // Copy the handseed total into an efficient raw datatype
                long HandseedTotal = Handseed.Value;
    
                for (long i = 1; i < HandseedTotal; ++i)
                {
                    string Handle = Convert.ToString(i, 16);
    
                    int Result = acdbHandEnt(Handle, ref Instance);
                    if (Result != 5100) continue; // RTNORM
    
                    ObjectId Id = new ObjectId(Instance.a);
    
                    if (!Id.IsValid) continue;
    
                    try
                    {
                        if (null != Filter)
                        {
                            if (!Filter.Contains(Id.ObjectClass.Name.ToLower())) continue;
                        }
    
                        using (DBObject DBObject = Id.Open(OpenMode.ForRead, false))
                        {
                            ValidIds.Add(Id);
                            DBObject.Dispose();
                        }
                    }   catch { }
                }
    
                return ValidIds;
        }
    
        public List<KeyValuePair<string, string>> GetObject(ObjectId Id)
        {
            if (Command.DataLinks != null) try { return Command.DataLinks.GetAllProperties(Id, true); } catch { return null; }
            return null;
        }
    
    public static DataLinksManager DataLinks
    {
        get
        {
            if (null == _DataLinks)
            {
                StringCollection Coll = Autodesk.ProcessPower.DataLinks.DataLinksManager.GetLinkManagerNames();
    
                if (Coll.Count > 0)
                {
                    if (Coll[0] != string.Empty)
                    {
                        _DataLinks = Autodesk.ProcessPower.DataLinks.DataLinksManager.GetManager(Coll[0]);
                    }
                }
            }
    
                return _DataLinks;
            }
        }
    
    private static DataLinksManager _DataLinks;
    
    public Dictionary<string, List<List<KeyValuePair<string, string>>>> Results { get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have objects that has a DateTime property, how can i query for the
i have a file in autocad with somthing like 24,000 points of objects that
I have objects that use the keys updated_at and created_at which have string timestamps
We have objects that we want to represent in stacks (think of stacking items
I have objects with many variables that I declare and explain in the comments.
I have objects that extends NSOperation. I also have NSOperationQueue. I have a timer
I have objects that have comments. As part of a periodic email summary, I
If i have objects with properties of type object or objects that are generics,
I need to have objects sorted by price (decimal) value for fast access. I
In my domain I have objects that are constantly being updated by a separate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.