ctrlaltdel Posted August 24, 2016 Share Posted August 24, 2016 This LISP runs on BricsCAD but has an error when running on AutoCAD 2014. Please help to covert the below LISP to run on AutoCAD 2014. Thanks (defun c:test ( / nentselLst nestLevel) (if (and (setq nentselLst (nentsel)) (= 4 (length nentselLst)) (<= 0 (setq nestLevel (- (length (cadddr nentselLst)) 2))) ) (progn (setvar 'cmdecho 0) (command "_.-refedit" (list (last (cadddr nentselLst)) (cadr nentselLst))) (repeat nestLevel (command "_next")) (command "_ok" "_all" "_yes") (setvar 'cmdecho 1) ) ) (princ) ) Error when running this LISP on AutoCAD 2014 Command: testSelect object: *Invalid selection* Expects a single object. Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. Select reference: *Cancel* Command: *Cancel* Quote Link to comment Share on other sites More sharing options...
BKT Posted August 24, 2016 Share Posted August 24, 2016 I don't have AutoCAD available to me, but have you tried what AutoCAD is telling you in the error message? Try changing the command to command-s in your code and see if that helps. BKT Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted August 24, 2016 Author Share Posted August 24, 2016 Hi BKT Change the LISP as suggested. But no go. Not sure if its still due to BricsCAD incompatibility or the code is not right, though the writer said it worked in BricsCAD (defun c:test ( / nentselLst nestLevel) (if (and (setq nentselLst (nentsel)) (= 4 (length nentselLst)) (<= 0 (setq nestLevel (- (length (cadddr nentselLst)) 2))) ) (progn (setvar 'cmdecho 0) (command-s "_.-refedit" (list (last (cadddr nentselLst)) (cadr nentselLst))) (repeat nestLevel (command-s "_next")) (command-s "_ok" "_all" "_yes") (setvar 'cmdecho 1) ) ) (princ) ) After I click the entity, it was suppose to bring me to a block in-place mode of a block level but nothing happend Command: testSelect object: Select reference: *Cancel* Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. Command: Command: *Cancel* Quote Link to comment Share on other sites More sharing options...
BKT Posted August 24, 2016 Share Posted August 24, 2016 Have you modified this code at all? Where did you get the original? BKT Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted August 24, 2016 Author Share Posted August 24, 2016 Have you modified this code at all? BKT I change all the "command" to "command-s" in the LISP Where did you get the original? BKT I ask for help on a LISP. The code is by roy_043 https://www.theswamp.org/index.php?topic=51887.0 Quote Link to comment Share on other sites More sharing options...
BKT Posted August 24, 2016 Share Posted August 24, 2016 Ah, OK. The suggestion about command-s was strictly based on the error message you got but doesn't look like that's the problem. As Roy mentions, the command calls seem to be the issue, but I'm also running BricsCAD, so hopefully someone else will be along soon with a fix for you. BKT Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted August 25, 2016 Author Share Posted August 25, 2016 Ah, OK. The suggestion about command-s was strictly based on the error message you got but doesn't look like that's the problem. As Roy mentions, the command calls seem to be the issue, but I'm also running BricsCAD, so hopefully someone else will be along soon with a fix for you. BKT Many thanks for your help BKT Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 25, 2016 Share Posted August 25, 2016 Run it line by line should find which line is the problem start with (setq nentselLst (nentsel)) then if nothing appears do !nentsellst if its Nil then its a problem just keep going copy and paste each line to the commnad line. Stop and check answer if nothing appears have the text screen open ie F2 use !andvariablename, you can also check a part of a longer netsed lisp (cadddr nentselLst) 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.