Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD LISP Help!

Status
Not open for further replies.

billyfinlay

Technical User
Sep 8, 2001
5
GB
I need to reformat a load of AutoCAD drawings (all of which have TIFF raster images included courtesy of GTX RasterCAD's gATTACH) to perform the following task:

1 IMAGE | <select> | DETACH all associated TIFFs (sometimes the same TIFF twice)
2 IMAGEATTACH each TIFF once more, once only, and without transparency
3 &quot;Send Image to Back&quot; the TIFF(s)

There are various automation tools out there to allow the same task to be performed on multiple files, but I am not sure that they are sophisticated enough to log which images were incorrectly attached so they can reattach the same ones.
 
I'm not familiar with the various automation tools, but have heard of battman(?) for AutoCAD 2000+. It would seem these would allow you to perform a lisp routine or script on each file. Or, a script file could be used to open each file, manipulate, close (I've heard 2000 makes this more difficult to automate beacause of multiple drawing interface). You're probably correct that a lisp would be in order to 'filter' and not reattach all Images. I'm not sure if the routine would have to be loaded each session. Say the routine is 'imagescreen', and it is invoked with 'imgo', the 'macro' you'd want run on each drawing would be:

(load &quot;imagescreen.lsp)
imgo

Now the lisp would be something like:

(defun c:imgo ()
(setq imageset (ssget &quot;X&quot; '((0 . &quot;IMAGE&quot;))));;select all images
..then loop through the set of images..
..detach each image...
..for each image name add to list of names..
...if already on list do nothing...
..otherwise &quot;imageattach&quot; w/ options...
..use 'draworder' to send to back...

If this looks doable, and you need help on the lisp, you could email me at cab@eeiteam.com.

Good luck,
Carl
 
Some help on the script you would need

Something similar to the code between the --- goes in a batch file (from for to go.scr is one line) ie PROCESS.BAT in the same directory as your drawings.

---
@echo off
for %%f in (*.dwg) do &quot;C:\Program Files\AutoCAD 2002\acad.exe&quot; %%f /b go.scr
---

Remember to enter the correct path to ACAD.EXE

GO.SCR (again in the same dierctory) contains something like
---
(load &quot;imagescreen&quot;)
imgo
qsave
quit
---

Type PROCESS<return>
Sit back & watch

Nick
nick.hall@altasystems.co.uk


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top