CALCAD Posted August 27, 2008 Share Posted August 27, 2008 lpseifert, the ssget function line looks weird to me. I don't understand the filter. Isn't the vertex list nothing but point data? I don't have Autocad available to test this with visual lisp. Anyway the error message seems to be complaining about the data submitted to the ssget so I would verify that the vertex list really is nothing but point data. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted August 27, 2008 Share Posted August 27, 2008 The argument to the "_WP" filter is a list of points extracted from the vertexes of the created polygon. When queried the variable 'vertex_list' does indeed show a list of points.... I don't know, seems odd it works, then doesn't work. Lesson in futility I guess. Thanks- Quote Link to comment Share on other sites More sharing options...
mauro Posted August 27, 2008 Author Share Posted August 27, 2008 Thank you very much for your help. fuccaro's program functioned perfectly. but calcad´s program did not function, perhaps because my autocad 2005 is the spanish version. thanks likewise. Quote Link to comment Share on other sites More sharing options...
mauro Posted August 27, 2008 Author Share Posted August 27, 2008 that explains my poor English:oops: Quote Link to comment Share on other sites More sharing options...
fuccaro Posted August 27, 2008 Share Posted August 27, 2008 but calcad´s program did not function, perhaps because my autocad 2005 is the spanish version. See here, maybe you can fix it: http://www.cadtutor.net/forum/showthread.php?t=7278 Quote Link to comment Share on other sites More sharing options...
CALCAD Posted August 28, 2008 Share Posted August 28, 2008 lpseifert, The following code works reliably on my system. I use Intellicad. ;;-------------------------------------------------------------------- ;; get pline vertex list for LWPline only by CAB ;(defun get_pline_cor (elst) ; (mapcar 'cdr ; (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst) ; ) ;;---------------------------------------------------------------------------- (defun gpc (elst / plst ptlist pc ec) (setq plst (- (length elst) (length (member (assoc 10 elst) elst)))) (setq ptlist nil) (setq pc plst) (setq plst (- (length elst) 1)) (while (< pc plst) (setq ec (nth pc elst)) (setq ec (cdr ec)) (setq ptlist (cons ec ptlist)) (setq pc (+ pc 4)) ) ptlist ) (defun c:CIC (/ circ circle_list pt_center circle_radius vertex_list ) (setq old_echo (getvar "cmdecho")) (setvar "cmdecho" 0) (setq circ (entsel "Select a circle: ") circle_list (entget (car circ)) pt_center (cdr (assoc 10 circle_list)) circle_radius (cdr (assoc 40 circle_list)) ) (command "_polygon" 360 pt_center "I" circle_radius) (setq elst (entget (entlast)) ) (entdel (entlast)) (setq vertex_list (gpc elst) ) (alert (strcat "There are " (itoa (sslength (ssget "_WP" vertex_list '((0 . "circle")(8 . "Clientes"))))) " objects inside the circle" ) ) (setvar "cmdecho" old_echo) (princ) ) As you can see, the main difference is that I replaced the visual lisp based function get_pline_cor with my old-style lisp function gpc. I also deleted the pt_on variable because it is not used anywhere. The fact that this code works on my system shows that your logic and syntax are basically correct. It doesn't prove that there is anything wrong with the get_pline_cor function, but something is still causing instability in your system. All I can suggest now is that, at the beginning of the main program, you could try saving the OSMODE value and set it to zero, then restore the saved OSMODE at the end. I have seen object snap settings screw up lisp execution in Autocad. Good luck. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted August 28, 2008 Share Posted August 28, 2008 Thanks, but using your code I get the same error message 'error: bad argument type: lselsetp nil'; the vertex_list returns a list of point data, but when I enter (ssget "_WP" vertex_list) it returns nil.... I dunno, the concept is good, and it did work a few times. 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.