Extract Text Objects from Drawing

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
shajinanu
Posts: 2
Joined: 21 Jun 2007, 12:28
Location: United Arab Emirates

Extract Text Objects from Drawing

Post by shajinanu » 21 Jun 2007, 12:31

Hi,

I want a block of code which can read the text objects from drawing
files in VB.Net. I am already been able to open the cad drawing files in a VB.net Window.

Regards,

SHAJI

Try CardImport

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

Post by support » 21 Jun 2007, 17:19

Hello!

The following code is based on <b>Viewer</b> demo from the <b>CAD Import .NET</b> package available at: http://www.cadsofttools.com/download/cadimportnet.zip

Code: Select all

    <font color="blue">Private Sub</font id="blue"> btnGetText_Click(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.EventArgs) <font color="blue">Handles</font id="blue"> btnGetText.Click
        <font color="blue">Dim</font id="blue"> entText <font color="blue">As</font id="blue"> CADText
        <font color="blue">Dim</font id="blue"> sectEnt <font color="blue">As</font id="blue"> CADImport.CADGroup
        <font color="blue">Dim</font id="blue"> I <font color="blue">As</font id="blue"> Integer

        <font color="blue">If</font id="blue"> (<font color="blue">Me</font id="blue">.FCADImage <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then Return</font id="blue">
        sectEnt = <font color="blue">Me</font id="blue">.FCADImage.Converter.GetSection(ConvSection.Entities)
        <font color="blue">For</font id="blue"> I = 0 <font color="blue">To</font id="blue"> sectEnt.Count - 1
            <font color="blue">If</font id="blue"> (<font color="blue">TypeOf</font id="blue"> sectEnt.Entities(I) <font color="blue">Is</font id="blue"> CADText) <font color="blue">Then</font id="blue">
                entText = sectEnt.Entities(I)
                <font color="green">'Do your actions</font id="green">
            <font color="blue">End If
        Next
    End Sub</font id="blue">
Sergey.



Please post questions to the forum or write to support@cadsofttools.com

shajinanu
Posts: 2
Joined: 21 Jun 2007, 12:28
Location: United Arab Emirates

Post by shajinanu » 25 Jun 2007, 09:23

Dear Sergey,

My Objective is to open Several CAD Documents using CADImport View (which I am able to achieve) and read out the text information from
the DWG files and store it in a Table. I use the following statements.

CadImportControl1.ToolsVisible = False
CadImportControl1.FileName() = lngFile
CadImportControl1.Show()
CadImportControl1.PerformAutoScale()
If lngFile <> "" Then
CadImportControl1.LoadFile(False)
Else
CadImportControl1.LoadFile(True)
End If
CadImportControl1.EntitiesTreeVisible() = False
Dim gr As New CADImage
CADImport.CADImage.SelectionMode() = ObjectsSelection.SelectionEntityMode.Enabled
EnableButton(True)
Me.CadImportControl1.SetLNG(Me.lngFile)

Yes, I am able to open the document. But when I click on a button Say BtnGetText, it is not functioning, most of the following code like CADText, CADGroup all
are stating the it is not defined. ConvSection not declared etc.

I want to take decision in buying this tool soon.

Regards,

SHAJI


Try CardImport

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

Post by support » 26 Jun 2007, 14:05

Dear SHAJI,

The following code allows loading CAD file and extracting data from text entities. It is based on <b>ViewerControl</b> demo:

Code: Select all

    <font color="blue">Private Sub</font id="blue"> Button1_Click(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.EventArgs) <font color="blue">Handles</font id="blue"> Button1.Click

        <font color="blue">Dim</font id="blue"> entText <font color="blue">As</font id="blue"> CADText
        <font color="blue">Dim</font id="blue"> sectEnt <font color="blue">As</font id="blue"> CADImport.CADGroup
        <font color="blue">Dim</font id="blue"> I <font color="blue">As Integer</font id="blue">

        CadImportControl1.LoadFile(<font color="blue">True</font id="blue">)
        EnableButton(<font color="blue">True</font id="blue">)

        sectEnt = CadImportControl1.CADImage.Converter.GetSection(ConvSection.Entities)
        <font color="blue">For</font id="blue"> I = 0 <font color="blue">To</font id="blue"> sectEnt.Count - 1
            <font color="blue">If</font id="blue"> (<font color="blue">TypeOf</font id="blue"> sectEnt.Entities(I) <font color="blue">Is</font id="blue"> CADText) <font color="blue">Then</font id="blue">
                entText = sectEnt.Entities(I)
                <font color="green">'Do your actions</font id="green">
            <font color="blue">End If
        Next
    End Sub</font id="blue">
It is necessary to use extended version of <b>CAD Import .NET</b>. Please contact us on info@cadsofttools.com on the question how to get extended version of the library.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Post Reply