kasra Posted April 15, 2010 Posted April 15, 2010 Hi. I tryed to write a routine that select points and create a file with my desired format. It includes a "while" loop that shown here. always I run the routine and end selection of points by pressing Enter, it returns this: error: bad argument type: lselsetp nil I can't understand that where is the mistake. Please guide me. Thanks. (while (princ "\nSelect Center Line Point: ") (setq ss1 (ssget '((0 . "point")))) (setq sl1 (sslength ss1)) (repeat sl1 . . . . ) ) Quote
Lee Mac Posted April 15, 2010 Posted April 15, 2010 You routine will constantly loop, as princ always returns T, Also, the selsetp error means your selectionset is nil, you need to check for a valid selectionset before working with it. Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 you need to check for a valid selectionset before working with it. I 'm new in lisp programming. what do you mean? and how the loop can stop by pressing enter. Quote
Lee Mac Posted April 15, 2010 Posted April 15, 2010 Perhaps something like: (while (progn (princ "\nSelect Center Line Point: ") (setq ss (ssget '((0 . "POINT")))) ) ... Do something ... ) Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 Perhaps something like: (while (progn (princ "\nSelect Center Line Point: ") (setq ss (ssget '((0 . "POINT")))) ) ... Do something ... ) You are Right my friend. it is working perfect. i'm so thankful. You are the best. Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 Another question... is it meaningful in lisp?? (while ......some functions...... (while ......some functions...... ) (while ......some functions...... ) ) Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 what is this error mean? error: bad argument type: lentityp nil Quote
Lee Mac Posted April 15, 2010 Posted April 15, 2010 Yes, you can nest functions in LISP. lentityp nil ==> entity is nil Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 Yes, you can nest functions in LISP. lentityp nil ==> entity is nil my routine returns this error:bad argument type: lentityp nil this is my code: ....... (while (progn (princ "\nSelect Center Line Point: ") (setq ss1 (ssget '((0 . "point")))) ) (setq sl1 (sslength ss1)) (repeat sl1 ......... ) (right) (left) ......... ) ;--------------------------- (defun right() (princ "\nSelect Right Points: ") (setq ss2 (ssget '((0 . "point")))) (setq sl2 (sslength ss2)) (repeat sl2 ........... ) ) ;---------------------------- (defun left() (princ "\nSelect Left Points: ") (setq ss3 (ssget '((0 . "point")))) (setq sl3 (sslength ss3)) (repeat sl3 ............. ) ) what is wrong?? Quote
Lee Mac Posted April 15, 2010 Posted April 15, 2010 As I have said, you need to check for a valid SelectionSet before continuing - but your error cannot be caused by the code you have posted. Quote
lpseifert Posted April 15, 2010 Posted April 15, 2010 Without testing, it looks as if you're not selecting a point with the ssget. Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 in the first time, the routine works properly. but for second time, it returns the error, although i select 6 point as right point. (ie. by selecting right points for second time and pressing enter, the error is shown). Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 i solved my problem. thanks for helping. Quote
kasra Posted April 15, 2010 Author Posted April 15, 2010 What was the issue? I just determine ss2 and ss3 in the last code i sent, as local. cause in the first iteration, these variables get nil value by pressing enter. thus i decided to determine them as local in every iteration. now it works properly without error. 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.