Jump to content

Attaching Multiple tif's to separate drawings?


ahb001

Recommended Posts

Hello all,

 

I have about 1500 .tif files that I need to attach to drawings. Is it possible to write a script or macro of some sort that will automate this process?

 

I know how to insert them manually in raster design, but the number of files would be very time consuming. I am using AutoCAD 2009.

 

Any help would be appreciated.

Link to comment
Share on other sites

For sure you can use a script to automate this task. Create a BAT file in the same folder with those TIFF files and paste there the code below - run that file to get the list of the files to insert.

DIR /b *.TIF > fileslst.txt

After I suggest you to use Excel to create the script lines.

Link to comment
Share on other sites

Your script file should look like:

_NEW  _IMAGE _A [color=magenta]C:\\TiffFiles\\TiffFile1st.TIF[/color] [color=blue]0,0[/color] [color=darkorange]1[/color] [color=darkgreen]0[/color] _ZOOM _E _SAVE [color=red]C:\\DWGFiles\\DWGFile1st.DWG[/color] _CLOSE
_NEW  _IMAGE _A [color=magenta]C:\\TiffFiles\\TiffFile2nd.TIF[/color] [color=blue]0,0[/color] [color=darkorange]1[/color] [color=darkgreen]0[/color] _ZOOM _E _SAVE [color=red]C:\\DWGFiles\\DWGFile2nd.DWG[/color] _CLOSE
_NEW  _IMAGE _A [color=magenta]C:\\TiffFiles\\TiffFile3rd.TIF[/color] [color=blue]0,0[/color] [color=darkorange]1[/color] [color=darkgreen]0[/color] _ZOOM _E _SAVE [color=red]C:\\DWGFiles\\DWGFile3rd.DWG[/color] _CLOSE
   

Adjust the colored parts to match your requirements - path of TIFF file, insertion point, scale factor, rotation angle and target DWG file's path.

Please take care that after _NEW you should let 2 spaces; also the script should end with an empty line. Save this file with SCR extension.

It is very important to don't have spaces in TIFF or DWG paths, since those will be treated as .

 

Call the SCRIPT command, you will be asked to point to the said script file.

Edited by MSasu
Extra comments
Link to comment
Share on other sites

Thanks, I got it working...... sort of.

 

I created a test file on my desktop and the script works perfectly.

 

The files I need to work with are on our server and the file path has spaces in it. The script gives an error on the first space every time. Is there a way to ignore the space in the file path?

Link to comment
Share on other sites

Try to contain that path with quotation marks (").

_NEW  _IMAGE _A "C:\\TiffFiles\\TiffFile1st.TIF" 0,0 1 0 _ZOOM _E _SAVE "C:\\DWGFiles\\DWGFile1st.DWG _CLOSE"

Link to comment
Share on other sites

I am just trying to insert it at this point. This is what my script looks like:

 

_NEW _IINSERT "G:\Engineering\CURRENT JOBS\PLANT\11153 DCS Migration Execute Phase\DRAWINGS\WORKING SET\LOOPS\HEATH1.TIF"

 

This is what shows up in the AutoCAD text window:

 

Command: _IINSERT

Command:

Enter image file name: "G:\Engineering\CURRENT JOBS\PLANT\11153

DCS Migration Execute Phase\DRAWINGS\WORKING SET\LOOPS\HEATH1.TIF"

"G:\Engineering\CURRENT JOBS\PLANT\11153 DCS Migration Execute

Phase\DRAWINGS\WORKING SET\LOOPS\HEATH1.TIF" was not found or is not valid.

Link to comment
Share on other sites

Seems that the path you used isn'y valid of the file is not available.

Please past the line below on AutoCAD's command prompt - if the result will be "nil" then you should re-check the path.

(findfile "G:\\Engineering\\CURRENT JOBS\\PLANT\\11153 DCS Migration Execute Phase\\DRAWINGS\\WORKING SET\\LOOPS\\HEATH1.TIF")

Link to comment
Share on other sites

Well, if I copied the path and entered it manually, it worked. Just wouldnt work when the script ran. I got it to work though, I think I was missing a space or blank line. Thanks for all your help.

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...