Author Topic: Publish formating question. Changing the -  (Read 104 times)

0 Members and 1 Guest are viewing this topic.

Lonnie

  • Newt
  • Posts: 60
Publish formating question. Changing the -
« on: June 10, 2021, 05:25:28 PM »
I tried the autodesk forum many years ago on this one. Stealing this right out of my question.

I have a client requesting we change our dwf file names. This will be an ongoing thing. Say 1,000 sets with 8 sheets per set so it's worth a little time for me to figure this out.

 

When you publish file name + view name you get.

3610 - PLANS AND DETAILS-3515.dwf

I want to change it to.
3610 - PLANS AND DETAILS - 3515.dwf

It's the space around the last - that we need.
DETAILS - 3515

 

My quick question would be.

Since acad is putting the - can you get to it in any way shape or form?

https://forums.autodesk.com/t5/autocad-forum/publish-formating-question-changing-the/m-p/7725000#M917261
« Last Edit: June 10, 2021, 05:29:24 PM by Lonnie »

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9617
Re: Publish formating question. Changing the -
« Reply #1 on: June 10, 2021, 05:38:32 PM »
I would use a batchscript to do this. Iím not at a pc at the moment but I would look at the thread I had a few years ago about using XPS instead of PDF/etc. I had some file renaming in one of those scripts. I can get you more whenever I get back on a pc.

https://www.theswamp.org/index.php?topic=50646.0
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9617
Re: Publish formating question. Changing the -
« Reply #2 on: June 10, 2021, 05:58:24 PM »
Real quick (I have to run). I coded this blind and I have no way of testing it yet so you will have to be the tester.

You would have to save this to a file called (or something of your choosing) in a directory with some files: "renameabunchofstufffortheclient.bat"

Double click and your files should rename (I hope).

Code - Bash: [Select]
  1. @echo off
  2.  
  3. pushd "%~p1"
  4. setlocal enabledelayedexpansion
  5.  
  6. for /f "tokens=1-4 delims=-." %%a in ("%%~nxf") do (
  7.  
  8.         echo. Name has been delimited:
  9.         echo. a is "%%a" b is "%%b" c is "%%c"
  10.  
  11.         IF NOT %%a=="" (
  12.  
  13.                 set number=%%a
  14.                 set type=%%b
  15.                 set number=%%c
  16.                 set ext=%%d
  17.                 set namestring="!number! - !type! - !number!.!ext!"
  18.                 echo. Target name is: !namestring!
  19.                 ren %%f !namestring!
  20.                 echo. %%f has been renamed to !namestring!
  21.  
  22.         )
  23.  
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

Lonnie

  • Newt
  • Posts: 60
Re: Publish formating question. Changing the -
« Reply #3 on: June 10, 2021, 06:03:27 PM »
I will see if it works in the morning.

Thank you.

BIGAL

  • Swamp Rat
  • Posts: 699
  • 30 + years of using Autocad
Re: Publish formating question. Changing the -
« Reply #4 on: June 10, 2021, 06:47:00 PM »
From Autodesk renames a file
(vl-file-rename  old-filename new-filename)

There is lisp for get a list of dwgs from a selected directory.

It would be feasible to use accoreconsole where the script/lisp calls a plot lisp that saves the dwf with correct name so no need to do a rename, only thing is the plot lisp part picking plot area. For us with a fixed title block not a problem.
A man who never made a mistake never made anything

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9617
Re: Publish formating question. Changing the -
« Reply #5 on: June 10, 2021, 09:08:45 PM »
But if you already have a set of plot files, what would be the point to plotting 8,000 sheets just to change a name? Or only limit yourself to one method of plotting (only with a script instead of a sheet set or publish list)? ...windows can rename those files in seconds vs hours to replot.
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

Lonnie

  • Newt
  • Posts: 60
Re: Publish formating question. Changing the -
« Reply #6 on: June 11, 2021, 09:11:48 AM »
This is an ongoing thing. We publish about 20 of these sets each week. The client was ok with no space between the sheet name and the dwg name for 10 years. Now they want spaces on each side. We do it with the renamer softerware after the fact but it sure would be nice to have AutoCAD publish the correct syntax.
Once again it's AutoCAD putting the "-" between sheetview name and dwg name that is the problem.  What adds to the problem is there is an earlier "-" in the sheet name.

No one in the AutoDesk forums could help. You all are so eclectic group I was hoping for some out of the box answer.
« Last Edit: June 11, 2021, 03:39:48 PM by Lonnie »