Page 1 of 1

How to select and edit group of entities using C#.Net

Posted: 14 Jul 2018, 08:48
by onbabu
Hi,
I am new to Auto CAD, and I am a C#.Net developer, one of my project requirement is
1. Need to Open a .dwg or .dxf file and show the drawing in windows form or asp form with properties like Pan, Zoom In, Zoom Out, Single Entity Selection or Multiple Entities Selection( Window Selection with Mouse Drag).
2.If User Selects a group of entities by mouse drag (window selection), i need the text available in that selected window in a table format, which i can save or manipulate

Was this achievable by using CAD.Net tool, if possible please provide a sample code for testing.

Thanks & Regards,
Narendra

Re: How to select and edit group of entities using C#.Net

Posted: 16 Jul 2018, 22:40
by support
Hello Narendra,

CAD .NET library fulfils your requirements, it provides a ready-to-use CADEditorControl which supports the following features:
  • Opening a .dwg or .dxf file and displaying the drawing in Windows Forms application.
  • Panning (by holding the right mouse button), zooming in/out (by the mouse wheel or toolbar buttons).
  • Single entity selection (by clicking the left mouse button), multiple entities selection (window selection).
  • Storing the currently selected entities in a CADEntityCollection which can be accessed through a CADEditorControl.Image.SelectedEntities property.
When you need to filter out a group of entities of a certain type from the current entity selection, it can be done with a one line of code. The example below shows how to filter out the TEXT entities.

Code: Select all

using System;
using System.Collections.Generic;
using CADImport;

...

List<CADEntity> cadTexts = cadEditorControl1.Image.SelectedEntities.FindAll(ent => ent.EntType == EntityType.Text);
Mikhail