indexof method
Moderators: SDS, support, admin
indexof method
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?
<<<<
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?
Re: indexof method
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.
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
Chat support on Skype: cadsofttools.support
Re: indexof method
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!
)
There must be something like visible / deleted etc. property for an entity.
Is it?
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!

There must be something like visible / deleted etc. property for an entity.
Is it?
Re: indexof method
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.
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
Chat support on Skype: cadsofttools.support