Does anyone have any small snippets of code they can post as an example of how to use GetLinks or GetLinksBySQLCond? This seems to be a problem with many others too. I referred to the CAOText.dvb example from SDK but I can not get it to work when I write it in C#. Here is what I have and I can not get it to work. I am attempting to get the links from a user selected AutoCAD object, after the user selects the linktemplate from a list box. The problem is at the GetLinks method (last line of code). I have tried passing in different types of objIDs such as array of longs, array of ObjectIDs and still no luck. Ahy help would be appreciated, thanks.
CAO.DbConnect dbConnect = new CAO.DbConnect();
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
//linktemplate object retrieved from user selected menu
CAO.LinkTemplate objLinkTemplate = dbConnect.GetLinkTemplates(doc.AcadDocument).Item(this.lbLinkList.SelectedItem.ToString());
PromptSelectionResult acssPrompt = doc.Editor.GetSelection();
if (acssPrompt.Status == PromptStatus.OK)
{
SelectionSet acSSet = acssPrompt.Value
long[] objIDs = new long[acSSet.Count];
int i = 0;
foreach (SelectedObject acSSobj in acSSet)
{
objIDs[i] = (long)acSSobj.ObjectId.OldIdPtr;
i += 1;
}
int linkTypes = (int)CAO.LinkType.kEntityLinkType;
CAO.Links linkSel = dbConnect.GetLinks(objLinkTemplate, objIDs, linkTypes, doc.AcadDocument);
}