.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Next object in scan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Is there a way to get the next object in the dwg file when I know the object id of an object?
foreach(ObjectId oid in blockTableRecord)
{
// Check next object(using next oid)
// Do something using oid
}
Solved! Go to Solution.
Re: Next object in scan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
why not modifying your loop in that way:
declare previousObj
declare currentObj
foreach(ObjectId oid in blockTableRecord)
{
// if previousObj defined (so to step over if it's the first object in queue and continue with loop2/object2)
// {
// get currentObj
// check currentObj
// do something with previousObj
// save currentObj as previouObj for the next loop
// }
}
Another option might be to first scan through the BlockTableRecord and gather the ObjectIDs into a collection (or any type of list/array that can be accessed by an index).
- alfred -
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Re: Next object in scan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yeah, i figured I posted a bad example. Your solution is ok when it comes to going through all objects.
But what I actually wanted was to know if it was possible to find the next element just from an object id without scanning the entire file or storing all the ids?
Re: Next object in scan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Fredrik.Larsen wrote:
But what I actually wanted was to know if it was possible to find the next element just from an object id without scanning the entire file or storing all the ids?
What do you mean by the next object?
1. This could be the next ObjectId of entities within BlockTableRecord
2. This can be ObjectId with Handle more by one than the Handle of current ObjectId for any object/entity in Database.
In "pure" ObjectARX there is a function acdbEntNext - it can be used in .NET with help of P/Invoke but it return id only for entities (Entity) not for objects (DBObject)
Re: Next object in scan
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I think this could get too ugly too fast so I am stepping away from this approach. If someone deletes an object in the dwg you loose all control of what the next object is supposed to be and that is no good. Thanks anyways.



