Author Topic: Probably problem with internal.Utils.Ent....() ?  (Read 1360 times)

0 Members and 1 Guest are viewing this topic.

autocart

  • Guest
Probably problem with internal.Utils.Ent....() ?
« on: August 11, 2011, 05:13:46 AM »
Hi,

I created this method but it seems that it is not working. I want to get all ids of the entities that reside in the DB after a given id (until the last one).
Sorry if any dumb errors, I am still somewhat a beginner in C#. And thanks for all the help on this forum so far.

How could I make it work? Thx for any answers.

Code: [Select]
using Autodesk.AutoCAD.Internal;

public static ObjectIdCollection getLastIdsAfterId(ObjectId startFetchingAfterId)
        {
            if (startFetchingAfterId == null)
                return null;

            ObjectIdCollection objIdColl = new ObjectIdCollection();
            ObjectId tempId = Utils.EntNext(startFetchingAfterId, true);

            while (tempId != null)
            {
                objIdColl.Add(tempId);
                tempId = Utils.EntNext(tempId, true);
            }

            return objIdColl;
        }

Regards, Stephan

kaefer

  • Guest
Re: Probably problem with internal.Utils.Ent....() ?
« Reply #1 on: August 11, 2011, 08:50:19 AM »
I created this method but it seems that it is not working.

Since ObjectId. is a value type, you're guaranteed to receive a struct. Therefore, you need to test for ObjectId.Null, not for the null literal. See also the property ObjectId.IsNull.

autocart

  • Guest
Re: Probably problem with internal.Utils.Ent....() ?
« Reply #2 on: August 11, 2011, 10:25:38 AM »
Thank you kaefer,

That seemed to help.  :-)