Data Extraction Using .Net

Data Extraction Using .Net

Anonymous
Not applicable
12,742 Views
21 Replies
Message 1 of 22

Data Extraction Using .Net

Anonymous
Not applicable

Hi Guys,

 

I need to extract data from AutoCad Drawing using C# or VB.Net.

 

I have a Title Block which is not inserted using attributes. It has some horizontal & vertical lines drawn  to look like a table and text added between them. See the attchment.

 

I need to extract data from that and display in Ms-Excel or in a datagridview.

 

Does anybody know how to do it ?????

It would be very helpful.

 

Thank You

0 Likes
Accepted solutions (1)
12,743 Views
21 Replies
Replies (21)
Message 21 of 22

Anonymous
Not applicable

Hi Santosh,

 

I have same requirement , can you please help me here.

If any sample code available for read text value from dwg file will be more appreciable.

if you have any sample code you can share with me on jatin.vyas@rigelnetworks.com

 

When i tried below code it gives me below error ,

 

Code :::

string fileName = @"C:\Users\rigel.DESKTOP-5OT3V45\Downloads\Sample.dwg";
Document acDoc = AcApplication.DocumentManager.Open(fileName);
//acDoc =
var ed = acDoc.Editor;
var selMText = new TypedValue[1];
selMText.SetValue(new TypedValue(0, "MTEXT"), 0);
var MTextObjs = ed.SelectAll(new SelectionFilter(selMText));

using (var Transaction = acDoc.Database.TransactionManager.StartTransaction())
{
        foreach (ObjectId MTextObjId in MTextObjs.Value.GetObjectIds())
       {
             var current_MTextObj = Transaction.GetObject(MTextObjId, OpenMode.ForWrite) as MText;
            string temp = current_MTextObj.Text;
           //if (current_MTextObj.Text.Equals(TextYouNeed))
          // return current_MTextObj;
         // or
        // do somehting else
     }
}

Error::

System.IO.FileNotFoundException: 'Could not load file or assembly 'Acdbmgd, Version=23.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'

Thanks,

Jatin Vyas.

0 Likes
Message 22 of 22

Anonymous
Not applicable

Hello,

 

When i tried below code it gives me below error ,

 

Code :::

string fileName = @"C:\Users\rigel.DESKTOP-5OT3V45\Downloads\Sample.dwg";
Document acDoc = AcApplication.DocumentManager.Open(fileName);
//acDoc =
var ed = acDoc.Editor;
var selMText = new TypedValue[1];
selMText.SetValue(new TypedValue(0, "MTEXT"), 0);
var MTextObjs = ed.SelectAll(new SelectionFilter(selMText));

using (var Transaction = acDoc.Database.TransactionManager.StartTransaction())
{
foreach (ObjectId MTextObjId in MTextObjs.Value.GetObjectIds())
{
var current_MTextObj = Transaction.GetObject(MTextObjId, OpenMode.ForWrite) as MText;
string temp = current_MTextObj.Text;
//if (current_MTextObj.Text.Equals(TextYouNeed))
// return current_MTextObj;
// or
// do somehting else
}
}

Error::

System.IO.FileNotFoundException: 'Could not load file or assembly 'Acdbmgd, Version=23.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'

 

Any help will be appreciable.

 

Thanks,

Jatin Vyas

0 Likes