AnsweredAssumed Answered

API MoveOrCopy() General Table

Question asked by Dennis Finn on Oct 25, 2018
Latest reply on Oct 26, 2018 by Fifi Riri

Hello all!


I am exploring the ability to copy and paste tables on drawings.


I am able to write a c# program that uses the MoveOrCopy function with the following:


swModel = (ModelDoc2)swApp.ActiveDoc;

boolstatus = swModel.Extension.SelectByID2("DetailItem40@Sheet1", "ANNOTATIONTABLES", 7.8e-03, 2.2e-02, 0, false, 0, null, 0); //x and y values don't seem to matter until you've pasted the table, then the values matter.

swModel.Extension.MoveOrCopy(true, 1, false, 0, 0, 0, 0, -.0508, 0);


Now this works great but the name "DetailItem40@Sheet1" will be different for each drawing I will be working with.  Also I don't see anyway to find the DetailItem# without manually creating a macro to find the number...?!??  Instead, I'd like to reference the table by name.


What I've come up with is:


boolstatus = swModel.Extension.SelectByID2("General Table1", "GENERALTABLEFEAT", 0, 0, 0, false, 0, null, 0);


This will select the table in the drawing, however, the MoveOrCopy command does nothing.  It seems that switching the type of entity from "ANNOTATIONTABLES" to "GENERALTABLEFEAT" somehow makes MoveOrCopy() not work but I am struggling to see why this is the case.


I'm hoping someone here can point me in the right direction.