C4D_M4N Posted May 1, 2012 Share Posted May 1, 2012 I'm am attempting to export models from Plant 3D using ExportToAutoCAD. However, I don't want to be prompted as to whether I want to overwrite, I just want it to save these files out, whether the file exists or not. My lisp skills are sorely lacking but I thought I might try this statement, but my syntax is incorrect: ((if(findfile DWGN2))(command "-EXPORTTOAUTOCAD" "2010" DWGN2 "y")(command "-EXPORTTOAUTOCAD" "2010" DWGN2)) What is the correct way to write this? There is probably much better way to accomplish this task so any help would be much appreciated! Thanks, Mitch Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 1, 2012 Share Posted May 1, 2012 Hi Mitch, and welcome to CADTutor. Firstly, I would recommend that you read the Code Posting Guidlines, so that you know how to format code for future posts. Now, regarding the code, assuming the variable DWGN2 contains a valid filename, I think: (if (findfile DWGN2) (command "_.-exporttoautocad" "_F" "2010" "" DWGN2 "_Y") (command "_.-exporttoautocad" "_F" "2010" "" DWGN2) ) Note, however, that this doesn't allow for the case in which the filename already exists and is in use. Quote Link to comment Share on other sites More sharing options...
ibach Posted September 20, 2013 Share Posted September 20, 2013 (edited) Ok this works, but how to overwrite the file? (use same file name of the file that the lisp is used at) This should be done using script so one could create new file with suffix or prefix, than close the file, delete original, rename new file to old file name and reopen it... anybody knows how to script it? and batch ...? Oh, and more important of all, how to prevent loss of page setups and named views when using the exporttoautocad command?! The loss of above is bloody irritating.... this is what i use to avoid all the dialogs (command "-exporttoautocad" "_F" "2013" "_B" "N" "_T" "I" "_M" "N" "_P" "1_" "_S" "." "" "") it produces the file in 2013 format, no xrefs binded, with 1_ prefix in file name. Edited September 20, 2013 by ibach Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.