Jump to content

dxf files rename and content changing for dxf files


nithink55

Recommended Posts

hii all...

i have 100 dxf drawings in a folder. i want change its file name from 69xx to 70xx

and its content also will be changing from 69xx to 70xx.

 

can you help me out. i am also working on this...

 

thanks

nithin

Link to comment
Share on other sites

For renaming the files I suggest you to look for a third part tool - one example is LupasRename (freeware).

 

 

its content also will be changing from 69xx to 70xx.

Please clarify, what do you mean by this?

Link to comment
Share on other sites

i have around 100 dxf files basically its file name and text in the file are to be changed.

the txt inside the dxf file is like 69-5511,69-5512,69-5513....etc.

in one dxf there will be only one text and that has to be changed to 70-xxxx.

Link to comment
Share on other sites

If the content of those files is only one string and taking into consideration that DXF is an ASCII (plain text) file, then may want to look for a text editor that supports batch processing; one example is NotePad++.

Link to comment
Share on other sites

;; purge, zoom and saves all drawings in a folder
;; By Abbas Aqdam
(defun C:PZT ( / path files dwg sf )
(if (or (= (getvar "SDI") 0) (> (getvar "DBMOD") 0))
  (alert "Please: \n\n1-SAVE and close all open drawing!\n\n2-Set SDI to 0")
  (progn
     (setq path "C:\\TEST\\")
     (setq files (vl-directory-files path "*.dwg" 1))
     (if (> (length files) 0)
        (progn
           (setq sf (open (strcat path "T.SCR") "w"))
           (write-line "Filedia" sf)
           (write-line "0" sf)
           (foreach dwg files
              (write-line "open" sf)
              (write-line (strcat "\"" path dwg "\"") sf)
              (write-line "(command \"purge\" \"a\" \"*\" \"N\")" sf)
              (write-line "(command \"zoom\" \"e\" \"zoom\" \"s\" \"0.95x\")" sf)
              (write-line "qsave" sf)
           );foreach
           (write-line "Filedia" sf)
           (write-line "1" sf)
           (close sf)
           (command "script" (strcat path "t.scr"))
        );progn
        (Alert (strcat "There is no dwg files in " path "!"))
     );if
  );progn
);if
);defun

 

 

 

hope instead of purge and zoom we can use the edit text commands..

 

awaiting reply..

Link to comment
Share on other sites

That code is building a script for a list of files; you will need to call it later by SCRIPT command. There are other solutions to do this for a bunch of files, one being the use of Excel (or other worksheet application, for that matter).

I didn’t suggested you above the script approach since I’m really not sure how to edit a text entity by a pattern using this technology.

Link to comment
Share on other sites

I didn’t suggested you above the script approach since I’m really not sure how to edit a text entity by a pattern using this technology.

 

what do you mean by pattern?

 

69 replaced with 70 right??

seriously i dont know how to use notepad++, and no idea how to do in excel also..

 

may be ii have to study more about notepad++

 

thanks for your quick reply...

 

nithin

Link to comment
Share on other sites

By pattern edit I mean to replace "69-????" with "70-????" - that it replace only a part of the string.

Excel will come handy only if someone will be able to contribute with a solution to do this edit by script; then you may generate a list of the files to be edited, write the script for first one and use Excel's features to clone that for all files.

Link to comment
Share on other sites

not wishing to confuse the issue but I would be very wary of trying to replace patterns in a DXF file. you might just replace a dxf code instead of a text string and totally change the structure.

 

I am confused as to whether you intend using AutoCAD to change these or by a text editor. From your reference to DXF files I assumed you didn't want to use AutoCAD but now I'm not so sure.

 

Personally I would use the DOS RENAME command to change file names and would open the DXF file in AutoCAD and do a find & replace. As usual I am sure Lee Mac has one of these already written.

Link to comment
Share on other sites

I intend using AutoCAD to change text in dxf file. can u please send the code for this

 

DOS RENAME command to change file names and would open the DXF file in AutoCAD and do a find & replace. As usual I am sure Lee Mac has one of these already written.

 

and please find the dxf file i attached.

 

thanks

999969-25-M008.dxf

Link to comment
Share on other sites

can u please send the code for this

I don't have the code for this.

 

If you search for Lee Mac you will find he has a lot of LISP files in his collection. I am sure there is a search and replace one in there.

 

The DOS command would be (something like) REN ????69*.DXF ????70*.DXF but try it on a copy first.

Link to comment
Share on other sites

Thanks Mr. dbroada and Mr.Msasu i have got the lisp file bfind. please find the attached....

still i am facing prob in opening files from directory and executing... any way i am doing with option "all opened drawings"...

 

Thanks again

 

nithin

BFindV2-0.lsp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...