Author Topic: Renaming XRefs  (Read 17298 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #15 on: November 12, 2010, 01:57:21 PM »
I wish they would be willing to pay....they just don't see anything wrong with how they do things.....so basically, I am trying to make the best of a bad situation....like I said, it's easy when it's one or two files, it is a lot more complicated when there are more.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Renaming XRefs
« Reply #16 on: November 12, 2010, 02:00:16 PM »
ergo item 4
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Renaming XRefs
« Reply #17 on: November 12, 2010, 03:47:10 PM »
I know I am architect and I am stupid.  I agree with that line of thought.  But from being on the other end of dealing with stupid sub-consultants that never seem to be using the most current xref, I have taken the habit of prefixing my xref file name with the date every time I send them out.  It just makes that useless game end a little faster.  Now what I won''t rename is are my nested xrefs but we do not have a lot of them to begin with.

I know that that is pita for them (and you) but oh well.   But I add by saying that 100 files to be renamed is bit much. 

Now if you want them to change hit them them where it hurts, charge them additional services.  The will either change their ways or pay you.  But I would do that if it is way beyond resonable expectations.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #18 on: November 12, 2010, 04:21:45 PM »
A simple prefix, I have no problems with, because I can use a bulk rename utility.

Here's what typically happens in these situations, the filename is set with some sort of convention, then another drafter at the architect's office is assigned to the project, they decide that they don't like how files are named and change them, then send them to us.

I have tried to get my boss to go for extra services when they change all of their filenames, but he will not go for it.

Here is an example of how we get to 100 files easily:
Say we have a project with 3 floor and 8 buildings, each of those buildings have 30 units on 3 floors spread across 20 unit types. Each unit type is an xref, so that is 20 files right there, then each building has nine files (one for the xref of each floor and the roof and each one has the sheet that we have to xref because that is what has the room names, slopes, etc. on it. There is also the gridlines for each bulding), then there are the site plans, then the elevations and sections, which are quite often required these days. The total can quite easily get up to 100.

Now when file names are renamed, they will do something like:
1st flr plan -> First Floor Plan
or
1st flr plan -> A-2.0
or
A-2.0 -> 1st flr plan

But this can change with some architects every single time that they send files.

Also, please note that I never once said Architects are stupid (others may have, but I did not), I only said that this issue causes major problems. As I said, a prefix makes sense, but to educate the Architects on this board, your changing one filename can affect 20+ sheets.

For Example:
You change the filename for Building 1 (3 story), well that file is referenced into the following sheets:
Mechanical
     Site Plan
     First Floor Plan
     Second Floor Plan
     Third Floor Plan
     Roof Plan
     Enlarged Plans (2-3 Sheets worth)
Electrical
     Site Plan
     First Floor Lighting Plan
     First Floor Power and Signal Plan
     Second Floor Lighting Plan
     Second Floor Power and Signal Plan
     Third Floor Lighting Plan
     Third Floor Power and Signal Plan
     Roof Plan
     Enlarged Plans (4-6 Sheets worth)
Plumbing
     Site Plan
     First Floor Waste & Vent
     First Floor Water & Gas
     Second Floor Waste & Vent
     Second Floor Water & Gas
     Third Floor Plan Waste & Vent
     Third Floor Water & Gas
     Roof Plan
     Enlarged Plans (4-6 Sheets worth)

As you can see, it adds up fast and the enlarged plans are enlarged areas of the floor plans, not including the unit plans. If i had my way, every time that a file is changed by the architect, I would charge an extra service, but since it is not my choice, I have to do what I can to make it easier to deal with.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #19 on: November 12, 2010, 05:16:24 PM »
Please note that the code has not been fully tested, but here is what I have come up with:
Code: [Select]
;Thanks to Lee Mac for the starting off point for this at http://www.theswamp.org/index.php?topic=35702.msg409330#msg409330
(defun c:FXP (/ x a fld pth fl oldname newname changed)
(vl-load-com)
(setq Doc (vla-get-activedocument (vlax-get-acad-object)))
(setq space
(if (zerop (vla-get-activespace doc))
(if (= (vla-get-mspace doc) :vlax-true)
(vla-get-modelspace doc) ; active VP
(vla-get-paperspace doc)
)
(vla-get-modelspace doc)
)
)
(setq fld (dos_getdir "" "h:\\BEI-TEMP\\" "Select the folder that has the updated backgrounds:" T))
(vlax-for x (vla-get-blocks Doc)
(cond
((= (vla-get-isXref x) :vlax-true)
(setq a (vl-filename-base (vla-get-path x))
      pth (strcat (vl-filename-directory (vla-get-path x)) "\\")
)
(cond
((= (vl-file-size (strcat fld a)) nil)
(cond
((/= (vl-file-size (strcat pth "remap.dat")) nil)
(setq fl (open (strcat pth "remap.dat") "r"))
(while (setq oldname (read-line fl))
(cond
((= (strcase oldname) (strcase a))
(setq newname (read-line fl))
(cond
((/= newname nil)
(vl-file-copy (strcat fld newname ".dwg") (strcat pth newname ".dwg"))
(vl-file-delete (strcat pth oldname ".dwg"))
(vla-put-name x newname)
(vla-put-path x (strcat pth newname ".dwg"))
(vla-reload x)
(setq changed T)
)
)
)
    )
)
(close fl)
(cond
((= changed nil)
(setq oldname a)
  (while (= newname nil)
  (setq newname (vl-filename-base (getfiled (strcat "Select file to replace " a "with") fld "" 8)))
  )
  (vl-file-copy (strcat fld newname ".dwg") (strcat pth newname ".dwg"))
  (vl-file-delete (strcat pth oldname ".dwg"))
  (vla-put-name x newname)
  (vla-put-path x (strcat pth newname ".dwg"))
  (vla-reload x)
)
)
)
(T
(setq oldname a)
(while (= newname nil)
(setq newname (vl-filename-base (getfiled (strcat "Select file to replace " a "with") fld "" 8)))
)
(vl-file-copy (strcat fld newname ".dwg") (strcat pth newname ".dwg"))
(vl-file-delete (strcat pth oldname ".dwg"))
(vla-put-name x newname)
(vla-put-path x (strcat pth newname ".dwg"))
(vla-reload x)
)
)
)
)
)
)

(setq newname nil
  oldname nil
      changed nil)
)
)

Let me know what you think or if there are improvements that can be made.

Edit: I think I have the problems that I have found fixed now, let me know what you think.
« Last Edit: November 12, 2010, 07:01:43 PM by cmwade77 »

danallen

  • Guest
Re: Renaming XRefs
« Reply #20 on: November 12, 2010, 07:41:23 PM »
Couldn't you just as well write a routine to rename the files vs the xrefs? Since they've already given you the CSV with new & old names? I'm an architect and I don't care how you rename yor copy of my files, I just want you to keep your info separate from mine, so that when you send me your files I don't have to manually separate the data.

Dan

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #21 on: November 12, 2010, 08:01:00 PM »
Yeah, but this was the path that was started earlier and it was easier to work through it......plus, I think in the long run that this will be more beneficial.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Renaming XRefs
« Reply #22 on: November 14, 2010, 05:13:00 PM »
That is right I forgot about apartment building's xrefs being set up like that.  I have been on Medical and Food industry for so long that I forgot that apartment buildings are architecture too.  
 :-D
as for the stupid part, there are bad apples in every barrel that make every occupation look bad.  :-)

Do I have this right? They are sending you renamed xrefs and host files that are referencing the old xref name?   Ohh I would be having a litter of kittens over that one!   :pissed: :pissed:
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Daniel J. Ellis

  • Swamp Rat
  • Posts: 811
Re: Renaming XRefs
« Reply #23 on: November 15, 2010, 03:22:58 AM »
Now if you want them to change hit them them where it hurts, charge them additional services.  The will either change their ways or pay you.  But I would do that if it is way beyond resonable expectations.

Or most likely change consultant :|

dJE
===
dJE

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #24 on: November 15, 2010, 10:54:48 AM »
Yeah, so the routine that I posted above, should fix most of these issues, still a little bit of a pain, but not too bad.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Renaming XRefs
« Reply #25 on: November 15, 2010, 11:51:54 AM »
Question:
What does "dos_getdir" do?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Renaming XRefs
« Reply #26 on: November 15, 2010, 11:53:48 AM »
Dos_getdir is part of doslib and it simply allows you to select a folder......never have quite figured out a good way to do this with pure lisp.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Renaming XRefs
« Reply #27 on: November 15, 2010, 12:00:42 PM »
I usually use this.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Renaming XRefs
« Reply #28 on: November 15, 2010, 12:01:05 PM »
I know I am architect and I am stupid.  I agree with that line of thought.  But from being on the other end of dealing with stupid sub-consultants that never seem to be using the most current xref, I have taken the habit of prefixing my xref file name with the date every time I send them out.  It just makes that useless game end a little faster.  Now what I won''t rename is are my nested xrefs but we do not have a lot of them to begin with.

I know that that is pita for them (and you) but oh well.   
why not put that information in the DRAWING PROPERTIES and stop causing problems you are aware of by renaming XREF files at all?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Renaming XRefs
« Reply #29 on: November 15, 2010, 12:34:50 PM »
Dos_getdir is part of doslib and it simply allows you to select a folder......never have quite figured out a good way to do this with pure lisp.

Look into the getfiled function.

Code: [Select]
(getfiled "Select a file" "" "*" 0)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org