dbconnect.GetLinks ignores ObjectIDs parameter

Discussion in 'AutoCAD' started by villaco, Aug 13, 2003.

  1. villaco

    villaco Guest

    Hello everybody
    I'm tryin to get the links in the actual drawing, I think that the getlinks method return me the links collection, based on a specific linktemplate that I specify in the LinkTemplate parameter, and his objectid property be equal to the objectid I specify in the ObjectIDs parameter.
    But i get the only the links based in the LinkTemplate I pass to the method getlinks, it seems ignore the parameter ObjectIDs, this is my code:

    function getkey(strlinktemplate as string, longobjid as long) as string

    Dim dbconnect As CAO.dbconnect
    Dim varobjid As Variant
    Dim lntemplates As CAO.linkTemplates
    Dim lntemplate As CAO.LinkTemplate
    Dim lnlinks As CAO.Links
    varobjid = longobjid
    Set dbconnect = GetInterfaceObject("CAO.DbConnect")
    Set lntemplates = dbconnect.GetLinkTemplates
    Set lntemplate = lntemplates(strlinktemplate)
    Set lnlinks = dbconnect.GetLinks(lntemplate, varobjid, kEntityLinkType)
    ....
    ....
    ....
    end function

    when add a watch expression on lnlinks I get a set of links based only on the link template desired, but the objectid property in every link doesn't correspond with varobjid, any suggestion please.
    Thanx
    Villaco
     
    villaco, Aug 13, 2003
    #1
  2. villaco

    LochDhu Guest

    Are you getting any errors with that code? The object ID's are an array of Longs. I quickly tested the following code at it works fine.



    Function getLinks(strlinktemplate As String, longobjid As Long) As Boolean Dim dbconnect As CAO.dbconnect Dim varobjid(0) As Long Dim lntemplates As CAO.linkTemplates Dim lntemplate As CAO.LinkTemplate Dim lnlinks As CAO.Links     varobjid(0) = longobjid     Set dbconnect = GetInterfaceObject("CAO.DbConnect")     Set lntemplates = dbconnect.GetLinkTemplates     Set lntemplate = lntemplates(strlinktemplate)     Set lnlinks = dbconnect.getLinks(lntemplate, varobjid(), kEntityLinkType)     If lnlinks.Count > 0 Then getLinks = True Else getLinks = False End Function
     
    LochDhu, Aug 13, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.