.NET

Reply
Active Contributor
laurie.comerford
Posts: 48
Registered: ‎09-08-2006
Message 1 of 2 (210 Views)
Accepted Solution

Selecting tables in a drawing

210 Views, 1 Replies
10-29-2011 01:41 PM

Hi,

 

I have a need to delete all the tables in my drawing.

I started with the SS14 code from Jerry Winters VB.NET progamming and modified it to select tables.  Unfortunately, when trying to select a table, the code does not work.   I tried it with Polylines, block references, Mtext and it worked OK with all of them.  See the code below:

    <CommandMethod("SS14")> _
    Public Sub SS14()
        Dim myDB As DatabaseServices.Database
        Dim myDWG As ApplicationServices.Document
        Dim myEd As EditorInput.Editor
        Dim myPSR As EditorInput.PromptSelectionResult
        Dim mySS As EditorInput.SelectionSet
        Dim myFilter(0) As DatabaseServices.TypedValue
        myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "INSERT")
         myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "TABLE")
       ' myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "POLYLINE")
       ' myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "MTEXT")
'''' Chenge items commented out above for testing.
 Dim mySF As New EditorInput.SelectionFilter(myFilter) myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument myDB = myDWG.Database myEd = myDWG.Editor myPSR = myEd.SelectAll(mySF) Try mySS = myPSR.Value If Not IsNothing(mySS) Then MsgBox(mySS.Count) End If Catch ex As SystemException MsgBox(Err.Description) End Try End Sub

 What am I doing wrong?  Or is there a bug when selecting "Tables" as distinct from other entities?

 

Regards

Laurie Comerford

Hi Laurie,

 

when you create a table in your drawing and do then

(entget (car (entsel))) <ENTER> ==> then select a table

you will see in the list of the object-properties this sequence:

(0 . "ACAD_TABLE")

 

That answers imho the reason why "TABLE" is not working in your example, you should give "ACAD_TABLE" as parameter for the filter:

myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "ACAD_TABLE")

 

HTH, - alfred -

*Expert Elite*
Alfred.NESWADBA
Posts: 9,420
Registered: ‎06-29-2007
Message 2 of 2 (208 Views)

Re: Selecting tables in a drawing

10-29-2011 01:49 PM in reply to: laurie.comerford

Hi Laurie,

 

when you create a table in your drawing and do then

(entget (car (entsel))) <ENTER> ==> then select a table

you will see in the list of the object-properties this sequence:

(0 . "ACAD_TABLE")

 

That answers imho the reason why "TABLE" is not working in your example, you should give "ACAD_TABLE" as parameter for the filter:

myFilter(0) = New DatabaseServices.TypedValue(DatabaseServices.DxfCode.Start, "ACAD_TABLE")

 

HTH, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!