Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copying all objects from Xref to Drawings

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
923 Views, 3 Replies

Copying all objects from Xref to Drawings

Hi All,

 

As a newbie to AUTOLisp, I am trying to accomplish the following with a script/function, however I still haven't found much useful information

 

1. While looping through the files in the directory, check if each drawing has any xrefs attached.

2. If yes, then copy all objects from all attached xrefs to the current drawing, and detach them. If no, skip the the next drawing. (If there are xref objects that cannot be copied to the drawing (such as jpgs), then leave them as they are).

3. Save the drawing with the same file name in another folder.

 

I know this sounds like asking someone else to do the homework for me, but any kind of help is appreciated as a lot of time has been used already googling around without much progress.....
Cheers

3 REPLIES 3
Message 2 of 4
Shneuph
in reply to: Anonymous

To me, batch processing files with lisp is complicated.

A workaround I use to limp through is to save the code I want to run on each drawing into a file named "acaddoc.lsp" within the folder that the files reside.   Then you just open the files from windows explorer (maybe 10 at a time) and your code will run.

The code inside the acaddoc.lsp file will look something like this:

(load "fileiwithmyfunctions.lsp");load files from support directories
(C:MyBatchCommand);run commands
(command "-view" "sei");run commands
(setvar "perspective" 1);set variables etc.

...any other lisp code...
(command ".qsave");save (command ".close");and close the drawing.

Be sure to test whatever code you are going to run on some sample files because it will automatically save the changes your code made to the files you open.  You can commend out the ;(command ".qsave") and ;(command".close") and inspect the drawing for the changes made.

 

When you are done batch processing the files in that directory just move the acaddoc.lsp file to the next one.  Then save it as acaddoc.txt in a folder somewhere if you want to save it for later use.

 

I'd like to hear any feedback criticism of batch processing files this way from other users as well.

 

PS- to "copy" objects from the xrefs to the current drawing perhaps binding the xref and exploding the resulting block will be the easiest.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 4
Anonymous
in reply to: Shneuph

Thanks Shneuph for the quick reply. I need to do this for >1000 files hence the batch processing approach is pretty much a must.

 

I have got some tips about batch processing from here

 

http://www.lee-mac.com/

 

which seems to be helpful.  Putting all the files that needs to be processed in the same directory would not be much of a problem for me, as some tests have been successfully made with some sample files

 

Cheers again for the input.

Message 4 of 4
3wood
in reply to: Anonymous

You can also try bind the xref, then explode them.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost