AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

Reply
Active Contributor
dshood
Posts: 37
Registered: ‎01-05-2009
Message 11 of 16 (216 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

07-10-2013 06:19 AM in reply to: jonathanburke6933

Use this utility "Lupus" it works ver well for us...

Dave Shood

 

Active Member
jonathanburke6933
Posts: 9
Registered: ‎06-27-2012
Message 12 of 16 (166 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

10-14-2013 08:43 AM in reply to: dshood

Sorry for late reply thanks mate

Active Contributor
sniktun
Posts: 48
Registered: ‎09-11-2013
Message 13 of 16 (99 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

04-01-2014 04:32 AM in reply to: jonathanburke6933

Did you guys ever find an answer for this? It looks like I am after almost the exact same thing for different reasons. When we create a project it goes through a number of scrutinies by different members of the company as every project is different with different calculations needed. This means that they will refer to a page number and I must be able to navigate to that page number without counting down the drawings.

 

I could number the drawings as I add them but just as is says in this thread I often have to insert drawings into the middle of a project and require an automated re-numbering In the drawing names

 

 

*Expert Elite*
Icemanau
Posts: 941
Registered: ‎06-01-2010
Message 14 of 16 (93 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

04-01-2014 03:18 PM in reply to: jonathanburke6933

 

Under Projects, there should be a 'Project Wide Update/Retag' icon. This will go through and update all the sheet numbers in a project. I believe that you would have to run the title block update to then transfer the new sheet number to the appropriate area.

 

You would still have to change the file name to reflect the change in sheet number, but is easier than having to also open each dwg to change the sheet number.

 

IF you use the Bulk Rename Utility ( http://www.bulkrenameutility.co.uk/Main_Intro.php ) just remember to close the project before you do the renaming.

Then before you open the project again, you have to remember to edit the wdp file and change the file names located at the end of the file. This is also where the drawing descriptions are kept.

 

The format is as follows

=Section

==Sub-Section

===Drawing Description 1

===Drawing Description 2

===Drawing Description 3

Relative path and filename

 

If there is no drawing description set, the line itself may not show in the wdp file.

The relative path is the path from where the wdp file is located to where the file is located. For example a dwg located in the same folder will just show as the file name where as a dwg in a sub directory will show as sub directory\filename.

 

Regards Brad

 

 

Icemanau (NNTP handle: Brad Coleman)


Active Member
jonathanburke6933
Posts: 9
Registered: ‎06-27-2012
Message 15 of 16 (85 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

04-02-2014 01:05 AM in reply to: Icemanau

Hi there I have since found a lisp that renumbers my filenames to an attibute value in the border. It was not written by me but as noted in the LISP by

Tony Tanzillo and modified by Tim Willey. The LISP is below. Copy into a notepad file and save as batchrename.txt , then change extension to lsp .

Change the A2 in  (setq BlkName "A2") to the block name that contains the attribute value you would like the sheet renamed to, and change the SHT in (setq TagName "SHT") to the attribute you would like to use for the renaming. Seems to work ok if there are no errors, but stops dead if there are errors without notification. You need to ensure there are no files with the same attibutes with the same values in them (ie trying to rename two files with same filename), and ensure the block you are asking it to look for are in the files you need to rename. I am no expert in lsp so if you are able to improve its error checking capability please advise as it is most useful. LISP is below:

 

(defun c:BatchRename (/ *error* Directory-Dia BlkName TagName Dir dbxApp FileName RenameList )

(vl-load-com)
(defun *error* (msg)

(if dbxApp (vlax-release-object dbxApp))
(setq dbxApp nil)
(vl-bt)
)
;---------------------------------------------------------
(defun Directory-Dia ( Message / sh folder folderobject result)
;; By Tony Tanzillo
;; Modified by Tim Willey
;; 16 Will let you type in the path
;; 64 Will let you create a new folder

(vl-load-com)
(setq sh
(vla-getInterfaceObject
(vlax-get-acad-object)
"Shell.Application"
)
)


(setq folder
(vlax-invoke-method
sh
'BrowseForFolder
(vla-get-HWND (vlax-get-Acad-Object))
Message
0 ; This is the bit number to change.
)
)
(vlax-release-object sh)


(if folder
(progn
(setq folderobject
(vlax-get-property folder 'Self)
)
(setq result
(vlax-get-property FolderObject 'Path)
)
(vlax-release-object folder)
(vlax-release-object FolderObject)
(if (/= (substr result (strlen result)) "\\")
(setq result (strcat result "\\"))
result
)
)
)
)
;--------------------------------------------------------------------------------------
(setq BlkName "A2") ; update to your block name
(setq TagName "SHT") ; update to your attribute's tag value

(if (setq Dir (Directory-Dia "Select directory to rename."))
(progn
(setq dbxApp
(if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
(vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
(vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
)
)
(foreach file (mapcar (function (lambda (x) (strcat Dir x))) (vl-directory-files Dir "*.dwg" 1))
(if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Open (list dbxApp file)))
(prompt (strcat "\n *Error opening file: " file))
(vlax-for lo (vla-get-Layouts dbxApp)
(vlax-for obj (vla-get-Block lo)
(if
(and
(= (vla-get-ObjectName obj) "AcDbBlockReference")
(= (vla-get-Name obj) BlkName)
)
(foreach att (vlax-invoke obj 'GetAttributes)
(if (= (vla-get-TagString att) TagName)
(setq FileName (vla-get-TextString att))
)
)
)
)
)
)
(setq RenameList (cons (cons file FileName) RenameList))
(setq FileName nil)
)
)
)
(vlax-release-object dbxApp)
(setq dbxApp nil)
(foreach i RenameList
(if
(or
(null (cdr i))
(not (vl-file-rename (car i) (strcat Dir (cdr i) ".dwg")))
)
(prompt "\n *Was not able to rename: " (car i))
)
)
(princ)
)

Active Member
jonathanburke6933
Posts: 9
Registered: ‎06-27-2012
Message 16 of 16 (83 Views)

Re: Rename dwg with Autocad Electrical Project Manager Sheet Number

04-02-2014 01:08 AM in reply to: jonathanburke6933

I have saved this as a README.txt to advise how to use it Hope it is useful.

 

THE BATCHRENAME.LSP CHANGES THE AUTOCAD FILENAME TO THE SHT ATTRIBUTE VALUE.

STEP1:
ZIP TARGET PROJECT THROUGH PRINT UTILITY EXCLUDING DATABASE (DURING NORMAL USE REMOVING FILES IN THE ACE PROJECT MANAGER LEAVES THE FILE BEHIND IN PROJECT FOLDER. USING THE ZIP UTILITY ENSURES ONLY PROJECT FILES ARE ZIPPED UP WHICH CAN BE EXTRACTED TO THE O&M FOLDER)

STEP2:
UNZIP ABOVE ZIP FILE PROJECT INTO THE CORRECT O&M DRAWING FOLDER

STEP3:
TYPE APPLOAD IN ACE
CLICK STARTUP SUITE CONTENTS
CLICK ADD AND BROWSE TO WHERE BATCHRENAME.LSP IS SAVED
SELECT AND CLICK OPEN
CLICK CLOSE
CLICK CLOSE
YOU SHOULD NOT HAVE TO DO STEP 3 AGAIN UNLESS YOUR SETTINGS BECOME CORRUPT

STEP4:
CALL LISP BY TYPING BATCHRENAME
POINT TO CORRECT O&M FOLDER CONTAINING THE DWG'S
HIT ENTER AND DRAWINGS SHOULD RENAME TO THE SHEET VALUES.

STEP5:
OPTIONAL: USE BULK RENAME SOFTWARE TO ADD THE DRAWING NUMBER PREFIX (STW REQUIRES THIS)

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.