indexof method

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

indexof method

Post by Khyati » 06 Apr 2011, 11:56

i wrote following code:
<<<<
EntIndx := cadEditorControl1.Image.CurrentLayout.Entities.IndexOf(entPt);
>>>>

it gave true (expected) result for first two execution.
It gave exception, in case of entity is deleted. (i've used try.. catch for that)

But for one entity, though it was deleted, it gave index of that entity.
I think, there is some reload or redraw / refreshing required.
Does it?

what can be possibility for wrong index no?

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: indexof method

Post by support » 06 Apr 2011, 13:09

Hello Khyati.
CADEntityCollection.IndexOf method can be used to check if entity exists in checked collection. However, you need pass an existed entity as method parameter. Otherwise it will result in exception. For example you can store entity on deleting to check its presence on drawing afterwards. I will also add this detail in my original post about CADEntityCollection.IndexOf method using.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

Re: indexof method

Post by Khyati » 07 Apr 2011, 11:01

Well,

then how to decide whether the entity is there or already deleted?
Please dont tell to write own logic (ofcourse we can do it, but then what is advantage of having a good cad soft tool! :lol: )

There must be something like visible / deleted etc. property for an entity.
Is it?

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: indexof method

Post by support » 07 Apr 2011, 17:17

Hello Khyati.
CAD Import .NET is the developer library. It provides access to entities structure and basic methods but not complete solution to each custom task. Storing deleted entities to check if such entity is present somewhere doesn't common task and can be realized in your application easy. So there is no need to implement "deleted" property and methods to handle it. You can change entity visibility instead deleting if prefer.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply