Attach an Xref with relative/Nopath option

Discussion in 'AutoCAD' started by manoj_vest, May 19, 2004.

  1. manoj_vest

    manoj_vest Guest

    Is any body knowswhether it is possible to attach an external reference through API with the following option or not
    No Path/Relative path.

    This options are available from the AutoCAd UI.

    Thanks In advance
     
    manoj_vest, May 19, 2004
    #1
  2. manoj_vest

    Danny P. Guest

    There's not an option while attaching, but you can change the Path
    property immediately after to remove the path or make it relative.

    HTH,
    Danny Polkinhorn
    WATG
    Honolulu
     
    Danny P., May 19, 2004
    #2
  3. manoj_vest

    manoj_vest Guest

    I tried your option and it is working fine. But my problem is as follows.

    I have created a drawing with Xref option and has been saved on a particular location.
    The Xref has been inserted using absolute path method.
    Now I copied the drawing and its dependent file to a new location/ drive in a single folder. When I open the drawing which contains the xRef, it resolves the xreferences from the original location instead of from the current folder. But I need that whenever the file is opened it should open from the current folder.
    For achieving this I tried to read the Xreferences and trying to detach the XReferences and attach from the new location with no path option. But while doing it I found that, If there is a nested XReference then the detach method of block not only fails but it crashes the AutoCAD. So this method too is not going to serve my purpose.

    So can you advice what I should doo.

    Thanks

    Manoj
     
    manoj_vest, May 20, 2004
    #3
  4. Don't detach in the copy of the drawing. Simply created a filtered selection
    set of the inserted XRefs, and change the Path property of each
    ExternalReference object.

    --
    R. Robert Bell


    I tried your option and it is working fine. But my problem is as follows.

    I have created a drawing with Xref option and has been saved on a particular
    location.
    The Xref has been inserted using absolute path method.
    Now I copied the drawing and its dependent file to a new location/ drive in
    a single folder. When I open the drawing which contains the xRef, it
    resolves the xreferences from the original location instead of from the
    current folder. But I need that whenever the file is opened it should open
    from the current folder.
    For achieving this I tried to read the Xreferences and trying to detach the
    XReferences and attach from the new location with no path option. But while
    doing it I found that, If there is a nested XReference then the detach
    method of block not only fails but it crashes the AutoCAD. So this method
    too is not going to serve my purpose.

    So can you advice what I should doo.

    Thanks

    Manoj
     
    R. Robert Bell, May 20, 2004
    #4
  5. manoj_vest

    manoj_vest Guest

    Thanks for your input. I tried the same but the problem is that even after changing the path property the document is refering the drawing from the original location only. For refering it from the current location I need to save the drawing after changing the path property. Close the document and again re-open it. Closing and re-opening is some thing iritating. So I don't want that. So it it possible that the drawing is refering from the current location without re-opening it?

    Thanks once again

    Manoj
     
    manoj_vest, May 21, 2004
    #5
  6. manoj_vest

    manoj_vest Guest

    Thanks for your input. I tried the same but the problem is that even after changing the path property the document is refering the drawing from the original location only. For refering it from the current location I need to save the drawing after changing the path property. Close the document and again re-open it. Closing and re-opening is some thing iritating. So I don't want that. So it it possible that the drawing is refering from the current location without re-opening it?

    Thanks once again

    Manoj
     
    manoj_vest, May 21, 2004
    #6
  7. manoj_vest

    manoj_vest Guest

    Sorry I posted my response twice because my server was not responding and hence I clicked twice.
     
    manoj_vest, May 21, 2004
    #7
  8. This sample assumes only one object in model space, an XRef named "Det" with
    an absolute path. It replaces the path with just the drawing's filename
    which is also saved in the current folder of the test drawing.

    Sub Test()
    Dim myXRef As AcadExternalReference
    Set myXRef = ThisDrawing.ModelSpace.Item(0)
    Debug.Print "Old path=" & myXRef.Path
    myXRef.Path = "Det.dwg"
    Debug.Print "New path=" & myXRef.Path

    Set myXRef = Nothing

    Dim xrDef As AcadBlock
    Set xrDef = ThisDrawing.Blocks.Item("Det")
    xrDef.Reload

    AcadApplication.ZoomExtents
    Set xrDef = Nothing
    End Sub


    --
    R. Robert Bell


    Thanks for your input. I tried the same but the problem is that even after
    changing the path property the document is refering the drawing from the
    original location only. For refering it from the current location I need to
    save the drawing after changing the path property. Close the document and
    again re-open it. Closing and re-opening is some thing iritating. So I don't
    want that. So it it possible that the drawing is refering from the current
    location without re-opening it?

    Thanks once again

    Manoj
     
    R. Robert Bell, May 21, 2004
    #8
  9. manoj_vest

    manoj_vest Guest

    Robert,

    Thanks for your help, Now it is working greate inside AutoCAD. The only problem I am having that I am unable to either dettach or reload the external references inside Mechanical AutoCAD. I don't know why?

    Thanks once again?
     
    manoj_vest, May 24, 2004
    #9
  10. For MDT/Mechanical you might need to check out its object model (I haven't
    had MDT since v4, so I don't have a way to help you there.)

    --
    R. Robert Bell


    Robert,

    Thanks for your help, Now it is working greate inside AutoCAD. The only
    problem I am having that I am unable to either dettach or reload the
    external references inside Mechanical AutoCAD. I don't know why?

    Thanks once again?
     
    R. Robert Bell, May 24, 2004
    #10
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.