access all cadpicturebox entities
Moderators: SDS, support, admin
access all cadpicturebox entities
Hello
How can I access all cadpicturebox entities?
I want to delete all the text entities created by the cadpicturebox environment
tnx for your help
How can I access all cadpicturebox entities?
I want to delete all the text entities created by the cadpicturebox environment
tnx for your help
Re: access all cadpicturebox entities
Hello,
To delete entities from the current layout (cadImage.CurrentLayout) you should iterate all the entities on the layout, compare their types and delete cadImage.RemoveEntity(ent);
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
if (cadImage == null) return;
var collection = cadImage.CurrentLayout.Entities;
int cnt = cadImage.CurrentLayout.Entities.Count;
while (cnt > 0)
{
CADEntity ent = cadImage.CurrentLayout.Entities[cnt-1];
if (ent is CADText || ent is CADMText)
{
cadImage.RemoveEntity(ent);
}
cnt--;
}
cadPictBox.Invalidate();}
Catherine
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: access all cadpicturebox entities
thank you Catherine
-
- Posts: 1
- Joined: 15 Mar 2023, 08:43
Re: access all cadpicturebox entities
Ok, I will do it as you said and if I face any problem, I will message you.support wrote: ↑06 Mar 2023, 16:41Hello,
To delete entities from the current layout (cadImage.CurrentLayout) you should iterate all the entities on the layout, compare their types and delete cadImage.RemoveEntity(ent);Regards,Code: Select all
private void button1_Click(object sender, EventArgs e) { if (cadImage == null) return; var collection = cadImage.CurrentLayout.Entities; int cnt = cadImage.CurrentLayout.Entities.Count; while (cnt > 0) { CADEntity ent = cadImage.CurrentLayout.Entities[cnt-1]; if (ent is CADText || ent is CADMText) { cadImage.RemoveEntity(ent); } cnt--; } cadPictBox.Invalidate();}
Catherine