TheSwamp

Code Red => .NET => Topic started by: kees987 on March 05, 2015, 06:06:44 AM

Title: c# detecting the newer line
Post by: kees987 on March 05, 2015, 06:06:44 AM
When you have 2 lines, is there a way to find out what is the oldest drawn line, and what is the newer drawn line?
can i assume that the one with the higher ObjectId value is always the newer one ?
Title: Re: c# detecting the newer line
Post by: BillZndl on March 05, 2015, 07:06:17 AM
When you have 2 lines, is there a way to find out what is the oldest drawn line, and what is the newer drawn line?
can i assume that the one with the higher ObjectId value is always the newer one ?

I use the Object.Id.Handle.Value when finding the last group created in the drawing.
That was long time ago so I don't remember all the details.
IIRC: It was something to do with the ObjectId changing each drawing session? IDK.
Title: Re: c# detecting the newer line
Post by: kees987 on March 05, 2015, 07:13:48 AM
Yes it seems that when i close the drawing and reopen it, all the objectID's have changed.

For my situation i want to make sure that i get the new created lines within the same session. So thats why i need to know for sure it is not using any lower numbers.

looking at  Object.Id.Handle.Value, is it so that the higher value is always the newer created one, or does older removed entries get re-used ?
Title: Re: c# detecting the newer line
Post by: huiz on March 05, 2015, 07:22:31 AM
Yes it seems that when i close the drawing and reopen it, all the objectID's have changed.

For my situation i want to make sure that i get the new created lines within the same session. So thats why i need to know for sure it is not using any lower numbers.

looking at  Object.Id.Handle.Value, is it so that the higher value is always the newer created one, or does older removed entries get re-used ?

You can test that by drawing some lines, remove the oldest, reopen the drawing and place a new line.

Handles will remain, ObjectIds don't.
Title: Re: c# detecting the newer line
Post by: kees987 on March 05, 2015, 07:24:00 AM
Yes it seems that when i close the drawing and reopen it, all the objectID's have changed.

For my situation i want to make sure that i get the new created lines within the same session. So thats why i need to know for sure it is not using any lower numbers.

looking at  Object.Id.Handle.Value, is it so that the higher value is always the newer created one, or does older removed entries get re-used ?

You can test that by drawing some lines, remove the oldest, reopen the drawing and place a new line.

Handles will remain, ObjectIds don't.

But how can you tell by just looking at a handle what is the latest created ones. Can i say with 100% certainty that a higher value handle is always newer, or will deleted entries (low numbers) get re-used?

Edit:
mm some tests already show me that just looking at the object ID, new lines can get a lower number than old lines. This doesnt help yet
Title: Re: c# detecting the newer line
Post by: MexicanCustard on March 05, 2015, 12:57:55 PM
Are they in chronological order by their order in the database?  If you retrieve all objects in ModelSpace will you get the objects first added to last added?  I've never tried it but they should be there in the order they were added.
Title: Re: c# detecting the newer line
Post by: huiz on March 05, 2015, 01:42:42 PM
..

But how can you tell by just looking at a handle what is the latest created ones. Can i say with 100% certainty that a higher value handle is always newer, or will deleted entries (low numbers) get re-used?

Edit:
mm some tests already show me that just looking at the object ID, new lines can get a lower number than old lines. This doesnt help yet

No test with ObjectId, but with Handles. ObjectIds are added when the drawing is opened and they disappear when the drawing gets closed. Handles are stored in the drawing database and will remain.
Title: Re: c# detecting the newer line
Post by: BillZndl on March 05, 2015, 03:07:45 PM
Can i say with 100% certainty that a higher value handle is always newer,

I've used the objectId.Handle.Value on groups for years and it's never failed.
We use it all the time.

Title: Re: c# detecting the newer line
Post by: Jeff H on March 05, 2015, 04:23:07 PM
If your needing a starting point for a session then Database.Handseed will give the handle that the database will use for next object.