Rooster Posted June 22, 2009 Posted June 22, 2009 I'm struggling to get my LISP to call & run another LISP (actually, it's a .vlx file). Here's the relevant bit of code: (LOAD "SPL2PL") (COMMAND "SPL2PL" "ALL" "" "0.1") And here's my error message: [DS> Another Freebee from http://www.dotsoft.com loaded, type SPL2PL to run!SPL2PL Unknown command "SPL2PL". Press F1 for help.] I'm confused..... Quote
Lee Mac Posted June 22, 2009 Posted June 22, 2009 (C:SPL2PL) should work, although you may have trouble with the "ALL" "" and "0.1" Quote
Rooster Posted June 22, 2009 Author Posted June 22, 2009 thanks for the reply lee, but i'm still getting the same message after changing it... Quote
Lee Mac Posted June 22, 2009 Posted June 22, 2009 Is the load successful? Include an [onfailure] msg: (load "spl2pl" "Load Failed") (c:spl2pl) Quote
Rooster Posted June 22, 2009 Author Posted June 22, 2009 done that - same message again, no reference to load being successful or not.... is it because it's a .vlx file rather than a .lsp? or should that not make a difference? Quote
Lee Mac Posted June 22, 2009 Posted June 22, 2009 is it because it's a .vlx file rather than a .lsp? or should that not make a difference? I wouldn't have thought it'd make a difference... I shall experiment Quote
Commandobill Posted June 22, 2009 Posted June 22, 2009 I'm not sure why your getting that error. As far as passing those arguments in know you can pass a selection set to a lisp like so... (sssetfirst nil (ssget "X" '((0 . "SPLINE")))) (C:SPL2PL) That is of course if that is what you meant by "all" Quote
Lee Mac Posted June 22, 2009 Posted June 22, 2009 I'm not sure why your getting that error. As far as passing those arguments in know you can pass a selection set to a lisp like so... (sssetfirst nil (ssget "X" '((0 . "SPLINE")))) (C:SPL2PL) That is of course if that is what you meant by "all" Nice idea, but I think that would depend upon how the LISP is engineered, I think that would only work if the LISP had an ssgetfirst call to start. Quote
Commandobill Posted June 22, 2009 Posted June 22, 2009 I dont believe thats necessarily true. It works with burst. As long as the lisp is looking for a selection set it should work. as far as the '.01' I'm not sure how you would pass that argument Quote
Lee Mac Posted June 22, 2009 Posted June 22, 2009 Just tested your theory, and yes, I've got to admit, you were right on this one (defun c:test () (if (ssget) (alert "CommandoBill was right!") (alert "CommandoBill was wrong!")) (princ)) ^^ code used to test theory. Quote
Commandobill Posted June 22, 2009 Posted June 22, 2009 Just tested your theory, and yes, I've got to admit, you were right on this one (defun c:test () (if (ssget) (alert "CommandoBill was right!") (alert "CommandoBill was wrong!")) (princ)) ^^ code used to test theory. Ahahahaha Quote
alanjt Posted June 22, 2009 Posted June 22, 2009 untested, but this should work: (defun c:TEST (/) (or c:SPL2PL (load "SPL2PL")) (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object) ) ;_ vla-get-activedocument "SPL2PL all 0.1 " ) ;_ vla-sendcommand (princ) ) ;_ defun Quote
Rooster Posted June 24, 2009 Author Posted June 24, 2009 I'm still struggling to get my LISP to call & run other LISPS. Below is a simple LISP that someone on here helped me with - it just filters text by style. When I try and call this LISP from another LISP I get an 'unknown command' error. How do I do it??!! aaargh! ;FILTER TEXT BY STYLE (defun c:fts(/ cSet) (setq cSet(ssget '((0 . "TEXT,MTEXT")(7 . "Standard")) ); end ssget ); end setq (if cSet (progn (princ(strcat "\n" (itoa(sslength cSet)) " found.")) (sssetfirst nil cSet) ); end progn (princ "\nNothing found. ") ); end if (princ) ); end of c:fts Quote
Commandobill Posted June 24, 2009 Posted June 24, 2009 All this function is doing is calling another function and sending a selection set to it. Give it a shot. Make sure you change the "c:\\fts.lsp" to the correct location and file name of the lisp (defun c:run () (load "c:\\fts.lsp" "Load Failed");change to have the name and location of the lisp (sssetfirst nil (ssget)) (c:fts) ) Quote
Lee Mac Posted June 24, 2009 Posted June 24, 2009 Something like this? (defun c:fts (/ cSet) (if (setq cSet (ssget '((0 . "*TEXT") (7 . "Standard")))) (progn (princ (strcat "\n" (rtos (sslength cSet) 2 0) " found.")) (sssetfirst nil cSet)) (princ "\n<< Nothing found >>")) (princ)) (defun c:test () (c:fts) (princ)) EDIT: Beat me to it by seconds... Quote
Commandobill Posted June 24, 2009 Posted June 24, 2009 EDIT: Beat me to it by seconds... Wow.. literally Quote
Lee Mac Posted June 24, 2009 Posted June 24, 2009 Wow.. literally But I also re-vamped his original LISP Quote
Rooster Posted June 25, 2009 Author Posted June 25, 2009 Something like this? (defun c:fts (/ cSet) (if (setq cSet (ssget '((0 . "*TEXT") (7 . "Standard")))) (progn (princ (strcat "\n" (rtos (sslength cSet) 2 0) " found.")) (sssetfirst nil cSet)) (princ "\n<< Nothing found >>")) (princ)) (defun c:test () (c:fts) (princ)) EDIT: Beat me to it by seconds... so using this way would be like creating a sub-function within the lisp, right? the fts lisp that i already have is already automatically loaded into every new drawing. if i was using it on its own (ie. not through another lisp) i would just type 'fts' at the commandline and off we go. can i not do something similar when using it within another lisp? i also have quite a few other small simple lisps like the fts one that i also want to use within this lisp, so i don't really want dozens of sub-functions if i can help it. i still can't get what you've coded above to work anyway - same old error: unknown command..... Quote
Lee Mac Posted June 25, 2009 Posted June 25, 2009 The fts still remains independent, and can be called on its own, and the "test" LISP is just calling it: (c:fts) It all works fine for me, which command is it saying is unknown? Quote
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.