sharpooth Posted January 31, 2012 Posted January 31, 2012 Hello guys, Can any one help me with this case: in List_box I have a lot of members (more than 1000!). When I want to select more than 600 members AutoCad2009 is crashes down!!! Why? This my routine : ;;; by shapooth ;;; ; author of str-lst Evgeniy Elpanov (defun c:go () (setq i 1500 b-list nil new-blist nil ) (repeat 1500 (setq b-list (cons (itoa i) b-list)) (setq i (- i 1)) ) (defun str-lst (s p) ; author of str-lst Evgeniy Elpanov (if (vl-string-search p s) (str-lst (vl-string-subst "\"\"" p s) p) (read (strcat "(\"" s "\")")) ) ;if ) ;;defun str-lst (setq list-str '( "Dialog" ": dialog" "{" " label = \"check\" ;" " : row " " { " " label = \"list1\" ;" " alignment = centered ;" " : column " " { " " : list_box {" " key = \"List1-d\" ;" " width = 30 ; " " height = 14 ;" " fixed_width = true ;" " fixed_height = true ;" " alignment = left ;" " multiple_select = true ;" " is_tab_stop = true ;" " }" " : text { key = \"count1-d\" ; } " " } " " : column " " { " " : button " " { " " key = \"Button-Add\";" " is_default = false ; " " fixed_width = true ; " " alignment = left ; " " label = \"add\" ; " " }" " } //column " " : column " " { " " : list_box {" " key = \"List2-d\" ;" " width = 30 ; " " height = 14 ;" " fixed_width = true ;" " fixed_height = true ;" " alignment = left ;" " multiple_select = true ;" " is_tab_stop = true ;" " }" " : text { key = \"count2-d\" ; }" " } " " }//row" " ok_only ;" "} // dialog" )) (setq cDCL "c:\\1.dcl") (setq f (open cDCL "w")) (foreach e list-str (write-line e f)) (close f) (setq f nil) (setq dcl_id (load_dialog cDcl)) (if (not (new_dialog "Dialog" dcl_id)) (exit)) (start_list "List1-d") (mapcar 'add_list b-list) ; (end_list) (set_tile "count1-d" (strcat "List1: " (itoa (length b-list)))) (action_tile "Button-Add" "(go-Button-Add)") (action_tile "List1-d" "(go-List1))") (defun go-List1 () (set_tile "count1-d" (strcat "list1: " (itoa (length b-list)) " / Sel: " (itoa (length (str-lst (get_tile "List1-d") " "))) )) );defunn (defun go-Button-Add () (if (setq xy1 (str-lst (get_tile "List1-d") " ")) (progn (foreach e xy1 (progn (setq ei (nth (atoi e) b-list)) (if (not (member ei new-blist)) (progn (setq new-blist (cons ei new-blist)) (setq new-blist (vl-sort new-blist '> )) (start_list "List2-d") (mapcar 'add_list new-blist) ; (end_list) (set_tile "count2-d" (strcat "List2: : " (itoa (length new-blist)))) );progn );if );progn );foreach );progn );if );defun (start_dialog) (unload_dialog dcl_id) ); defun Thanks Quote
MSasu Posted January 31, 2012 Posted January 31, 2012 Seems that there some limitations related to the number of items a list_box control can handle. May be useful to check if dos_multilist function from DosLib extension isn't a better approach. Regards, Mircea Quote
BlackBox Posted January 31, 2012 Posted January 31, 2012 Seems that there some limitations related to the number of items a list_box control can handle. If this is correct, it is ironic... That a list_box function has trouble processing large lists, yet is meant to work with LISP. LoL Quote
sharpooth Posted January 31, 2012 Author Posted January 31, 2012 If this is correct, it is ironic... That a list_box function has trouble processing large lists, yet is meant to work with LISP. LoL Hi RenderMan, check it. Select first member from list and press shift button continiusly and then member 600. My AutoCad is 2009. Quote
sharpooth Posted January 31, 2012 Author Posted January 31, 2012 Seems that there some limitations related to the number of items a list_box control can handle. May be useful to check if dos_multilist function from DosLib extension isn't a better approach. Regards, Mircea Hi msasu, I will try to use dosLib extension. Quote
MSasu Posted January 31, 2012 Posted January 31, 2012 If this is correct, it is ironic... That a list_box function has trouble processing large lists, yet is meant to work with LISP. LoL Ironic or not, you can check by yourself: create a list with variable number of items, load it into a list_box control, select all items and see what it returns. On my tests it works well for 500 entries, but crash for 600. So, the limit lays somewhere between. My answer was due to the fact that I had myself issues in the past with this control. Regards, Mircea Quote
MSasu Posted January 31, 2012 Posted January 31, 2012 This is what I have used for my tests: (defun TestLimitListBox( / theList DCLid theAnswer ) (repeat 501 ;;; <-- adjust this (setq theList (append theList '("x")))) (setq DCLid (load_dialog "X.dcl")) (if (not (new_dialog "TEST" DCLid)) (exit)) (start_list "theList") (mapcar 'add_list theList) (end_list) (action_tile "accept" "(setq theAnswer (get_tile \"theList\"))(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (start_dialog) (unload_dialog DCLid) (print theAnswer) ) The DCL definition: TEST : dialog { : list_box { key = "theList"; multiple_select = true; } ok_cancel; } Regards, Mircea Quote
BlackBox Posted January 31, 2012 Posted January 31, 2012 Hi RenderMan,check it. Select first member from list and press shift button continiusly and then member 600. My AutoCad is 2009. Ironic or not, you can check by yourself: create a list with variable number of items, load it into a list_box control, select all items and see what it returns. On my tests it works well for 500 entries, but crash for 600. So, the limit lays somewhere between.My answer was due to the fact that I had myself issues in the past with this control. You've missed my point completely. DCL is meant to work with LISP, which can process incredibly large lists (not sure of their limit?). Hence Mapcar, Apply, etc., and this DCL function bombs after +/-600 list items - this is funny to me (while unfortunate for OP). Quote
MSasu Posted January 31, 2012 Posted January 31, 2012 Should not forget that DCL was introduced with AutoCAD R12 and didn't evolved since... Regards, Mircea Quote
sharpooth Posted February 1, 2012 Author Posted February 1, 2012 This is what I have used for my tests: (defun TestLimitListBox( / theList DCLid theAnswer ) (repeat 501 ;;; <-- adjust this (setq theList (append theList '("x")))) (setq DCLid (load_dialog "X.dcl")) (if (not (new_dialog "TEST" DCLid)) (exit)) (start_list "theList") (mapcar 'add_list theList) (end_list) (action_tile "accept" "(setq theAnswer (get_tile \"theList\"))(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (start_dialog) (unload_dialog DCLid) (print theAnswer) ) The DCL definition: TEST : dialog { : list_box { key = "theList"; multiple_select = true; } ok_cancel; } Regards, Mircea Hi Mircea, I saw this problem with DCL in c:go posted in OP. My be there is no limit for list_box because Autocad craches with any errors (0xC0000005 ... and so on). If List_box have an limit why Autocad will crash? Regards Sharpooth Quote
MSasu Posted February 1, 2012 Posted February 1, 2012 In my tests the AutoCAD (2007) did not crashed - but the list_box does not return correctly when the list size was ~600 entries. Regards, Mircea Quote
sharpooth Posted February 1, 2012 Author Posted February 1, 2012 In my tests the AutoCAD (2007) did not crashed - but the list_box does not return correctly when the list size was ~600 entries. Regards, Mircea Thanks Mircea, Today I will test it on AutoCAD 2004. After that I will send a post. Regards Sharpooth Quote
MSasu Posted February 1, 2012 Posted February 1, 2012 Tested again, in more AutoCAD versions, with 700 entries: 2010: AutoCAD simply vanish. 2011: Same error as you, no crash. 2012: No error, but it return nil. Regards, Mircea Quote
sharpooth Posted February 1, 2012 Author Posted February 1, 2012 Tested again, in more AutoCAD versions, with 700 entries: 2010: AutoCAD simply vanish. 2011: Same error as you, no crash. 2012: No error, but it return nil. Regards, Mircea Thank you Mircea for the tests! I just finished with Autocad 2004 test: on 530 ent - return ; error: bad argument type: (or stringp symbolp): nil For AutoCad 20212 - > It is better to return nil than crash )) Regards Sharpooth 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.