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?
Solved! Go to Solution.
Solved by SENL1362. Go to Solution.
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
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);