AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

trouble with C# and CAO GetLinks

0 REPLIES 0
Reply
Message 1 of 1
masa10789
544 Views, 0 Replies

trouble with C# and CAO GetLinks

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);

}

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report

”Boost