.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using C# to determine if there is a table drawn in .dwg file

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
804 Views, 2 Replies

Using C# to determine if there is a table drawn in .dwg file

I'm trying to write a program that behaves differently depending on if a drawing that is opened has a table in it already or not. How do I programatically determine if a table exists in an AutoCAD .dwg file? More specifically, how do I assign said table to a variable I can pull the table's information from?

2 REPLIES 2
Message 2 of 3
hgasty1001
in reply to: Anonymous

Hi,

 

The ARX SDK has a sample with selection sets, in this case take a look at the SSGetFilter sub in the sample and you will have the idea.

 

Gaston Nunez

Message 3 of 3
SENL1362
in reply to: Anonymous

TypedValue[] tableItem = new TypedValue[] { new TypedValue(0, "ACAD_TABLE") };
SelectionFilter tableSelecFilter = new SelectionFilter(tableItem);
PromptSelectionResult selectResult = ed.SelectAll(tableSelecFilter);

if (selectResult.Status == PromptStatus.OK)
{
SelectionSet tableSelSet = selectResult.Value;
ed.WriteMessage("\n Number of tables: {0}", tableSelSet.Count);

for (int i = 0; i < tableSelSet.Count; i++)
Table table = (Table)tr.GetObject(tableSelSet[i].ObjectId, OpenMode.ForRead);

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost