Path of external Reference

Discussion in 'AutoCAD' started by jolish, Jul 18, 2004.

  1. jolish

    jolish Guest

    I would like to get the vba source to find the path of all attached external references in the current drawing, I could not find a externalreference collection.

    plz help.
    Jols.
     
    jolish, Jul 18, 2004
    #1
  2. Make a selection set of all blocks.
    Loop through and check them with the IsXref property.
    If true you can use the Path property on the block.

    --
    Best Regards, Jimmy Bergmark
    CAD and Database Developer Manager at www.pharmadule-emtunga.com
    Take a look at
    JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport
    SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm
    or download some freeware at www.jtbworld.com
    More on AutoCAD 2005;
    www.jtbworld.com/autocad2005.htm


    external references in the current drawing, I could not find a
    externalreference collection.
     
    Jimmy Bergmark, Jul 18, 2004
    #2
  3. jolish

    jolish Guest

    thatkz for the reply

    you r right, i tried that, but still that selection set is of blocks not external references. there is no property called path for the block object. if u don't mind can u send me the code.

    regards. jols.
     
    jolish, Jul 19, 2004
    #3
  4. jolish

    Michel Guest

    Hi Jols,

    Here's a function I use to get an external reference, see code below.

    What I do is loop through the Blocks-collection and check the IsXref property. If it's true I add the name to my own collection. I then loop though that collection and use the function to get the Xref-object, which has the Path-property.

    regards,
    Michel

    *******
    Function GetXR(strXR As String) As AcadExternalReference
    Dim SS As AcadSelectionSet
    Dim i As Integer
    Dim gpCode(1) As Integer
    Dim Filter(1) As Variant
    Dim objXR As AcadExternalReference

    On Error Resume Next
    Set SS = ThisDrawing.SelectionSets.Add("XREF")
    If Err.Number <> 0 Then
    ThisDrawing.SelectionSets("XREF").Delete
    Set SS = ThisDrawing.SelectionSets.Add("XREF")
    End If
    On Error GoTo 0

    gpCode(0) = 0: gpCode(1) = 2
    Filter(0) = "INSERT": Filter(1) = strXR

    SS.Select acSelectionSetAll, , , gpCode, Filter

    If SS.Count > 0 Then Set objXR = SS(0)
    SS.Delete

    Set GetXR = objXR

    End Function
    ******


    Message was edited by: Michel
     
    Michel, Jul 20, 2004
    #4
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.