TheSwamp

CAD Forums => CAD General => Topic started by: adrian on November 10, 2004, 07:57:19 PM

Title: Batch xref attach to overlay
Post by: adrian on November 10, 2004, 07:57:19 PM
Does anyone know a way to change the xref in drawings from being attached to overlay without going into the drawing.  
I have to overlay some architects files into my drawing to make sure it all lines up, but I dont want to have all his attached files come with it, particularly the ones that are unloaded.

Thanks
Title: Re: Batch xref attach to overlay
Post by: KewlToyZ on February 12, 2008, 06:23:21 PM
http://discussion.autodesk.com/thread.jspa?messageID=5846212&#5846212 (http://discussion.autodesk.com/thread.jspa?messageID=5846212&#5846212)
For a quick idea this is a decent little tool.
I'm dissappointed this isn't just a standard command line call from the API to begin with.
X2A - changes all XREF's to Overlay in a Drawing
X2O - changes all XREF's to Overlay in a Drawing

There seems to be some extra quotes calling the command twice but I have yet to see where it may be an easy way to go past errors from other calls.
Title: Re: Batch xref attach to overlay
Post by: KewlToyZ on February 12, 2008, 06:24:49 PM
Here is the last download of it...

Reply From: cmwade77
Date: Dec/28/06 - 17:20 (EST)
   
    Re: xref attach to overlay lisp completed
I have with some major help fixed up this LISP routine to work with nested xrefs, please note the following limitations:
1. All saved paths must physically exist
2. Any locked layers prior to running the commands may not be locked after running the commands.
3. I have only tested the routine in 2006 and newer.
Title: Re: Batch xref attach to overlay
Post by: cmwade77 on May 12, 2009, 01:01:05 PM
I have found a bug in the routine in that if an xref cannot be found, then it causes an error and prevents the routine from being run on the remainder of the xrefs. This update fixes this, please note that if the xref cannot be found, then the routine now skips that xref and goes to the next one and displays a message on the command prompt accordingly.
Title: Re: Batch xref attach to overlay
Post by: cmwade77 on May 12, 2009, 02:12:04 PM
Ok, one more modification, if there is somehow a block with the same name as one of the filenames, the routine would cause an error, this fixes that.
Title: Re: Batch xref attach to overlay
Post by: KewlToyZ on May 12, 2009, 04:34:05 PM
seems to fail changing them to attachments and all xref's are accounted for?
Title: Re: Batch xref attach to overlay
Post by: cmwade77 on May 12, 2009, 05:14:22 PM
Hmmm...It is working here, testing it on AutoCAD 2010.

Notes:

That's all that I can think of at the moment that might be a problem. Also, have you made sure you were using the last one that I uploaded, in the other one, if it couldn't find the xref, it would cause an error that would cause it to stop processing any further.
Title: Re: Batch xref attach to overlay
Post by: cmwade77 on June 03, 2009, 01:20:34 PM
seems to fail changing them to attachments and all xref's are accounted for?

Has this been working for you (based on my previous post) or is it still failing?
Title: Re: Batch xref attach to overlay
Post by: KewlToyZ on June 04, 2009, 10:24:23 AM
Actually it has worked in the older format because,
by volume none of the items you listed as requirements for the new version to work are possible with my AutoCAD deployment.
I use relative paths for XREF's, but with over 300 projects on the network at any given time, adding them to the support folder or project search makes it nearly impossible to maintain with any reasonable actions.

The old format worked best without using project search.
Title: Re: Batch xref attach to overlay
Post by: cmwade77 on November 13, 2009, 06:35:00 PM
I see, for our needs, when we need to do this, we put all of the xrefs in one folder, so that works for us at least.
Title: Re: Batch xref attach to overlay
Post by: KewlToyZ on November 24, 2009, 02:16:13 PM
It is working now.
We use the same folder structure in every project with a single XREF folder.
(Arch, MECH, ELEC, PLUM)
I found some issues with the files themselves being the cause for errors.
Also, cleaning up unregistered regapps has improved quite a few projects significantly in terms of overall loading performance and project life cycle.
Now if only relative pathing could be performed by ETRANSMIT or DWG TrueView when packaging a project life would be truly productive.
Title: Re: Batch xref attach to overlay
Post by: plesseym on July 06, 2010, 01:12:59 AM
I have consistently used Etransmit to convert full paths to relative paths provided you use the Transmittal setup in a specific way.

1. Ensure that the transmittal file folder is at the root of your local drive. (C or D for example) not a network mapped drive and preferably not the drive that stores the project being archived.
2. Under "Path options" select "Organised folder structure" and put the root folder of your project to be archived (eg: e:\mechanical)

Hope this works for you
Title: Re: Batch xref attach to overlay
Post by: Klapka on December 09, 2021, 06:22:56 AM
I was searching for routine for batch changing attachment to overlay. Your routine looked nice, though reinserting is not good because the layers settings are gone. Can it in theory use this .NET approach listed here (https://adndevblog.typepad.com/autocad/2012/06/use-the-converter-class-to-format-distances-and-angles.html) by Stephen Preston?


Code: [Select]
    <CommandMethod("changeToOverlay")> _
    Public Sub changeToOverlay()
      Dim doc As Document =
                        Application.DocumentManager.MdiActiveDocument
      Dim db As Database = doc.Database
      Using trans As Transaction =
                            db.TransactionManager.StartTransaction()
        Dim bt As BlockTable =
                trans.GetObject(db.BlockTableId, OpenMode.ForRead)
        For Each btrId As ObjectId In bt
          Dim btr As BlockTableRecord =
                            trans.GetObject(btrId, OpenMode.ForRead)
          If btr.IsFromExternalReference Then
            btr.UpgradeOpen()
            btr.IsFromOverlayReference = True
          End If
        Next
        trans.Commit()
      End Using
    End Sub

Or this is not possible with Autolisp and it can be done only in VB? If so, could then in theory such VB subroutine be accessed from Autolisp?

Best regards,
Klapka
Title: Re: Batch xref attach to overlay
Post by: Bryco on January 06, 2022, 10:14:59 PM
reference manager is made for this kind of thing.
Title: Re: Batch xref attach to overlay
Post by: Klapka on January 07, 2022, 12:09:54 PM
reference manager is made for this kind of thing.

No, it is not (as far a I know):

Standalone reference manager application does not allow changing attachment to overlay status. Unfortunatelly.

Reference manager as internal command allows it only one by one clicking per file . That is no multiple selection, no batch processing, no nested file treatment etc.
Furthermore command-line version does not include subcommand for changing the status, thus it is unusable for this topic completely.

Or am I missing something?
Title: Re: Batch xref attach to overlay
Post by: Paulli_apa on January 02, 2024, 05:09:32 PM
With the External Reference Palette (as of AutoCAD 2014) you can select multiple xrefs, right mouse click, choose Xref Type & then select either Attach or Overlay and that will change all items selected.
See video tutorial here: https://www.youtube.com/watch?v=-_AOmbFwWfg