Author Topic: Batch xref attach to overlay  (Read 20808 times)

0 Members and 2 Guests are viewing this topic.

adrian

  • Guest
Batch xref attach to overlay
« 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

KewlToyZ

  • Guest
Re: Batch xref attach to overlay
« Reply #1 on: February 12, 2008, 06:23:21 PM »
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.

KewlToyZ

  • Guest
Re: Batch xref attach to overlay
« Reply #2 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.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Batch xref attach to overlay
« Reply #3 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.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Batch xref attach to overlay
« Reply #4 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.

KewlToyZ

  • Guest
Re: Batch xref attach to overlay
« Reply #5 on: May 12, 2009, 04:34:05 PM »
seems to fail changing them to attachments and all xref's are accounted for?

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Batch xref attach to overlay
« Reply #6 on: May 12, 2009, 05:14:22 PM »
Hmmm...It is working here, testing it on AutoCAD 2010.

Notes:
  • Will not change nested xrefs.
  • Will not change xrefs that cannot be found using the (findfile) function, please note that if the xrefs are in a different folder than the drawing you are in, the folder with the xrefs must either be in the project search path or AutoCad's support file search path.
  • May not change unloaded or unreferenced xrefs.

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.
« Last Edit: May 13, 2009, 11:11:27 AM by cmwade77 »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Batch xref attach to overlay
« Reply #7 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?

KewlToyZ

  • Guest
Re: Batch xref attach to overlay
« Reply #8 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.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Batch xref attach to overlay
« Reply #9 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.

KewlToyZ

  • Guest
Re: Batch xref attach to overlay
« Reply #10 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.

plesseym

  • Guest
Re: Batch xref attach to overlay
« Reply #11 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

Klapka

  • Mosquito
  • Posts: 2
Re: Batch xref attach to overlay
« Reply #12 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 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
« Last Edit: December 09, 2021, 09:39:20 AM by Klapka »

Bryco

  • Water Moccasin
  • Posts: 1882
Re: Batch xref attach to overlay
« Reply #13 on: January 06, 2022, 10:14:59 PM »
reference manager is made for this kind of thing.

Klapka

  • Mosquito
  • Posts: 2
Re: Batch xref attach to overlay
« Reply #14 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?