Author Topic: Xref path help needed.  (Read 12124 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
Re: Xref path help needed.
« Reply #15 on: November 30, 2005, 03:22:09 AM »
Have you looked into exploiting the projectname variable?
I looked at it, but it doesn't work in LT and we have a few users on that.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Xref path help needed.
« Reply #16 on: January 30, 2006, 04:56:43 AM »
Please help!

We have had our migration over the weekend and every drawing has lost its xrefs path 1000s of the darn things.

What would be the quickest way of updating the xrefs.

For example our project files used to be filed in the I drive, but are now in a P drive. The drawing frames and other protected data was on the G drive but they havent restored that yet, so I dont know what letter that will be.

I can see this is going to be a great week, with lots of posts!

Catch you later
T :-)
Thanks for explaining the word "many" to me, it means a lot.

hudster

  • Gator
  • Posts: 2848
Re: Xref path help needed.
« Reply #17 on: January 30, 2006, 05:04:18 AM »
I was hoping to write a routine that looked for an xref, got the path as a string, altered the string with the new path, and then changed the path to suit.

but I haven't got round to it yet, way too busy.  We have about 5000+ drawings with Xrefs detached though.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #18 on: January 30, 2006, 05:05:49 AM »
Please help!

We have had our migration  .............

migration to ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Xref path help needed.
« Reply #19 on: January 30, 2006, 05:21:57 AM »
...to a new server, with  a bigger hard drive. The problem is, when we changed server, head office told us that we had to use these drive letters with no exceptions. What was I:\ is now P:\ and as yet I dont know where our G:\ is going to be :realmad:

As you can understand, this is causing loads of problems as none of the drawings have their xrefs attached anymore.

So, I am looking for a quick way of re-pathing the drawings from I, to P, otherwise I am going to be doing this manually for weeks.(like the other offices did!)

T :-)
Thanks for explaining the word "many" to me, it means a lot.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #20 on: January 30, 2006, 05:47:21 AM »
Are they attached ?

Hang about, I'll see what I can do ...
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Xref path help needed.
« Reply #21 on: January 30, 2006, 05:50:37 AM »
Yes, they are attached,

Thanks Kerry (once again)
Thanks for explaining the word "many" to me, it means a lot.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #22 on: January 30, 2006, 05:55:38 AM »
Is it ONLY the Drive that changed ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Xref path help needed.
« Reply #23 on: January 30, 2006, 05:58:16 AM »
I am just waiting for confirmation from the IT coordinator here, I'll let you know in a couple of minutes
Thanks for explaining the word "many" to me, it means a lot.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #24 on: January 30, 2006, 06:00:39 AM »
Try this on a COPY of one of your drawings ..

I don't use Xrefs, so testing was limited, but seems to not explode in my face :-)

(ChangeXrefDrive "P:") < or whichever drive is new >

Code: [Select]
(defun ChangeXrefDrive (newDrive / xrefEdata)
  (mapcar
    '(lambda (blockName)
       (if
         (eq
           (logand
             4
             (cdr (assoc 70 (setq xrefEdata (entget (tblobjname "BLOCK" blockName))))
             )
           )
           4
         )
          (command "._XREF"
                   "PATH"
                   (cdr (assoc 2 xrefEdata))
                   (strcat newDrive (substr (cdr (assoc 1 xrefEdata)) 3))
          )
       )
     )
    (ai_table "BLOCK" 0)
  )
  (princ)

)
« Last Edit: January 30, 2006, 06:18:01 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #25 on: January 30, 2006, 06:02:44 AM »
Quote
Opening an AutoCAD 2004 format file.

Resolve Xref "CTT": C:\CTT.dwg
"CTT.dwg" cannot be found.

Resolve Xref "Drawing111": C:\Drawing111.dwg
"Drawing111.dwg" cannot be found.

Resolve Xref "rope-sheave-dog": C:\rope-sheave-dog.dwg
"rope-sheave-dog.dwg" cannot be found.
Regenerating model.

AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.

AutoCAD menu utilities loaded.
Command:
Command: (ChangeXrefDrive "D:")

; 32 forms loaded from #<file "C:/ACAD2006/support/ai_utils.lsp">
._XREF

Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] <Attach>: PATH
Edit xref name(s) to edit path: rope-sheave-dog
xref name: "rope-sheave-dog"
Old path: C:\rope-sheave-dog.dwg
Enter new path: D:\rope-sheave-dog.dwg
Reload Xref "rope-sheave-dog": D:\rope-sheave-dog.dwg
"rope-sheave-dog" loaded.

Command: ._XREF
Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] <Attach>: PATH
Edit xref name(s) to edit path: Drawing111
xref name: "Drawing111"
Old path: C:\Drawing111.dwg
Enter new path: D:\Drawing111.dwg
Reload Xref "Drawing111": D:\Drawing111.dwg
"Drawing111" loaded.

Command: ._XREF
Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] <Attach>: PATH
Edit xref name(s) to edit path: CTT
xref name: "CTT"
Old path: C:\CTT.dwg
Enter new path: D:\CTT.dwg
Reload Xref "CTT": D:\CTT.dwg
"CTT" loaded.

Command:
« Last Edit: January 30, 2006, 06:16:45 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #26 on: January 30, 2006, 06:19:33 AM »
This MAY fall on it's head if you use nested XRefs though ...   :|
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Xref path help needed.
« Reply #27 on: January 30, 2006, 06:23:45 AM »
The use of PROJECTNAME neatly solves this issue. Previously I hated using it, but I've come to REALLY appreciate it.

I wrote a tool which would open up any number of drawings IN MEMORY, and change the PROJECTNAME setting, as well as strip any hard paths from XREFS.
This runs over several hundred drawings in literally a few minutes.

Unfortunately I can't give this out, however I do have a suggestion. Create a script that adds a certain PROJECTNAME into AutoCAD and add the paths to it. You could do this at AutoCAD startup with a bit of lisp/vba as well (vba is how I do it which reads from a master .xml file).

Then run a script over every drawing which changes the drawing's PROJECTNAME to the newly added one. Since the new PROJECTNAME has your NEW paths in it, your REFERENCE files should be found.

I hope this helps.

Cheers,
Glenn.

hudster

  • Gator
  • Posts: 2848
Re: Xref path help needed.
« Reply #28 on: January 30, 2006, 06:26:27 AM »
Be aware that project naming doesn't work with AutoCAD LT though.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Xref path help needed.
« Reply #29 on: January 30, 2006, 06:29:48 AM »
LT ?

crap, then, neither will Lisp .. , yes ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.