DWG Destroyer Posted November 15, 2011 Share Posted November 15, 2011 Hey guys, I have a problem that does not seem to have an answer when I search the net, but there must be one as it is so (seemingly) fundamental. My acaddoc.lsp file has a few simple routines that I have added (for example, a simple “set layer to 0”) and I am very pleased them with as they work fine 100% of the time. BUT when I go to invoke these commands in bulk dwg processing - I’ve tried both autoscript and script pro – these new routines are not recognised (acad actually returns that the command is not recognised, even though I just tested it before batch processing!) and the processing fails. I cannot seem to get past this problem - could anyone possibly shed some light on this for me? I would love to further my understanding in this area! Cheers! Quote Link to comment Share on other sites More sharing options...
pBe Posted November 15, 2011 Share Posted November 15, 2011 Does your routine require user input? Quote Link to comment Share on other sites More sharing options...
DWG Destroyer Posted November 15, 2011 Author Share Posted November 15, 2011 None whatsoever! Quote Link to comment Share on other sites More sharing options...
pBe Posted November 15, 2011 Share Posted November 15, 2011 None whatsoever! hmmmmn Not script pro but something else ---> Here Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 15, 2011 Share Posted November 15, 2011 How are you loading said LISP routines? How are you calling them with your script from ScriptPro/AutoScript? Quote Link to comment Share on other sites More sharing options...
DWG Destroyer Posted November 15, 2011 Author Share Posted November 15, 2011 Wow, LeeMac’s program works perfectly! That’s absolutely brilliant – thanks for your help pBe! Alan, a simple example of what I was trying to achieve; (defun c:VPL () (command "TILEMODE" "0" "-VPORTS" "LOCK" "ON" "ALL" "")) Works fine by itself, but when I put it in a script to batch process via autoscript/ scriptpro (written as the following ):- (COMMAND "VPL" ) (COMMAND "_QSAVE" ) (COMMAND "CLOSE" ) ACAD spits “VPL” back at me saying it is not a recognised command… Odd! Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 15, 2011 Share Posted November 15, 2011 Wow, LeeMac’s program works perfectly! That’s absolutely brilliant – thanks for your help pBe! Alan, a simple example of what I was trying to achieve; (defun c:VPL () (command "TILEMODE" "0" "-VPORTS" "LOCK" "ON" "ALL" "")) Works fine by itself, but when I put it in a script to batch process via autoscript/ scriptpro (written as the following ):- (COMMAND "VPL" ) (COMMAND "_QSAVE" ) (COMMAND "CLOSE" ) ACAD spits “VPL” back at me saying it is not a recognised command… Odd! That's because VPL is a LISP routine, not a native AutoCAD command. Try: (c:VPL) (command "_.qsave" "_.close") Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 15, 2011 Share Posted November 15, 2011 Wow, LeeMac’s program works perfectly! That’s absolutely brilliant – thanks for your help pBe! Glad it works for you (COMMAND "VPL" ) (COMMAND "_QSAVE" ) (COMMAND "CLOSE" ) ACAD spits “VPL” back at me saying it is not a recognised command… Odd! To answer your question: 'VPL' is not a recognised command, it is a LISP function; so you will need to call the LISP function using: (c:VPL) Quote Link to comment Share on other sites More sharing options...
DWG Destroyer Posted February 18, 2013 Author Share Posted February 18, 2013 Hi again guys, I know it’s been a while but I’ve come into some more trouble with this problem! I recall Lee’s program helping me in the past, but I don’t think I ever got around to finding out how to work without it! Anyway, upon advancing a couple of acad versions in addition to my work internet connection to that program becoming blocked, and I find myself asking the question I started with once more. I can see the suggestions people have made about calling the lisp function differently (ie as Lee has described above) but in doing so I still get an unrecognised command error. Is there something else I could be doing wrong? – Cheers! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 19, 2013 Share Posted February 19, 2013 What does your script look like? Quote Link to comment Share on other sites More sharing options...
DWG Destroyer Posted February 19, 2013 Author Share Posted February 19, 2013 Hi Lee, Simple script, undoubtedly WRONG. (C: PA)(COMMAND "_QSAVE" )(COMMAND "CLOSE" ) ‘PA’ is just a simple lisp that pastes objects to 0,0,0. Obviously when I get this to work the possibilities will be endless for other batch processes... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 19, 2013 Share Posted February 19, 2013 If you are using my Script Writer program to construct the script, try the following as the Script Line: _.open *file* (if (load "PA.lsp" nil) (c:PA)) _.qsave _.close [ Assuming your program is saved as 'PA.lsp' in your support path ] Quote Link to comment Share on other sites More sharing options...
DWG Destroyer Posted February 19, 2013 Author Share Posted February 19, 2013 I was hoping to avoid using your writer if possible (no offence!), as I want to become more self-dependant! Surely what I've written should work in Autoscript? Nonetheless I did have a go with your program, but it seems that copy & pasting that code into your writer will call acad to open the files ok, but will not do the pasting? When invoking PA manually it works like a charm... Here's what my lisp looks like as well if you were wondering: (defun c:PA () (command "PASTECLIP" "0,0")) And normally I keep all my routines in my acaddoc.lsp file, but for this example I did save the PA command to PA.lsp just to test. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 19, 2013 Share Posted February 19, 2013 Surely what I've written should work in Autoscript? I've never used 'AutoScript' so couldn't answer that question; but, after removing the space between 'C:' and 'PA', the code looks syntactically correct. Nonetheless I did have a go with your program, but it seems that copy & pasting that code into your writer will call acad to open the files ok, but will not do the pasting? When invoking PA manually it works like a charm... Maybe you have altered the contents of the clipboard before running the program? Though, for a simple one-line expression it would probably be easier to include the expression directly in the Script, avoiding the need to define a separate command; e.g.: _.open *file* _.pasteclip _non 0,0 _.qsave _.close 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.