Lee Mac Posted August 23, 2010 Posted August 23, 2010 Thanks for making me think it through, Lee! You're quite welcome Just for fun, for those fussy with grammar: (princ (strcat "\n<< There " (cond ( (not (setq ss (ssget "_X" '((0 . "INSERT"))))) "are no Blocks >>" ) ( (= 1 (setq n (sslength ss))) "is 1 Block >>" ) ( (strcat "are " (itoa n) " Blocks >>") ) ) ) ) Quote
Michaels Posted August 23, 2010 Author Posted August 23, 2010 And won't (sslength nil) give nil all the time if blocks are found or not ? So that's logically return nil. Quote
Lee Mac Posted August 23, 2010 Posted August 23, 2010 And won't (sslength nil) give nil all the time if blocks are found or not ? So that's logically return nil. That is what we are testing for - (sslength nil) will error, so we must prevent such a case occurring. Quote
BlackBox Posted August 23, 2010 Posted August 23, 2010 Just for fun, for those fussy with grammar: (princ (strcat "\n<< There " (cond ( (not (setq ss (ssget "_X" '((0 . "INSERT"))))) "are no Blocks >>" ) ( (= 1 (setq n (sslength ss))) "is 1 Block >>" ) ( (strcat "are " (itoa n) " Blocks >>") ) ) ) ) Hilariously fitting, Lee. Quote
Michaels Posted August 23, 2010 Author Posted August 23, 2010 You're quite welcome Just for fun, for those fussy with grammar: (princ (strcat "\n<< There " (cond ( (not (setq ss (ssget "_X" '((0 . "INSERT"))))) "are no Blocks >>" ) ( (= 1 (setq n (sslength ss))) "is 1 Block >>" ) ( (strcat "are " (itoa n) " Blocks >>") ) ) ) ) Yes, It is GREATLY fussy with grammer. I guess you mean my formal writtings. Thanks Quote
BlackBox Posted August 24, 2010 Posted August 24, 2010 (princ (strcat "\n<< There " (cond ( (not (setq ss (ssget "_X" '((0 . "INSERT"))))) "are no Blocks >>" ) ( (= 1 (setq n (sslength ss))) "is 1 Block >>" ) ( (strcat "are " (itoa n) " Blocks >>") ) ) ) ) Just for fun... (if (= "The Soul of Wit" "Brevity") (setq LeeMac "Witty")) Quote
David Bethel Posted August 24, 2010 Posted August 24, 2010 Just an FYI, If (sslength ss) return is greater than 32767 entities, sslength returns a REAL, not an INT and will crash (itoa) Out of habit, I use (rtos (sslength ss) 2 0) -David Quote
BlackBox Posted August 24, 2010 Posted August 24, 2010 Just an FYI, If (sslength ss) return is greater than 32767 entities, sslength returns a REAL, not an INT and will crash (itoa) Out of habit, I use (rtos (sslength ss) 2 0) -David Good to know, David! Quote
Lee Mac Posted August 24, 2010 Posted August 24, 2010 Just an FYI, If (sslength ss) return is greater than 32767 entities, sslength returns a REAL, not an INT and will crash (itoa) Out of habit, I use (rtos (sslength ss) 2 0) -David David, this would only be applicable on 16-bit systems, most systems today are at the very least 32-bit, some even 64-bit. Quote
David Bethel Posted August 24, 2010 Posted August 24, 2010 Lee, Give it a try. I know A2K still has the limitation. Array a line by 129 x 257 and try making a selection set of the lines and the check the length with (sslength) It should return 33153. -David Quote
BlackBox Posted August 24, 2010 Posted August 24, 2010 Lee, Give it a try. I know A2K still has the limitation. Array a line by 129 x 257 and try making a selection set of the lines and the check the length with (sslength) It should return 33153. -David AutoCAD Civil 3D 2009 Land Desktop Companion handles this without issue: Command: (sslength (ssget)) Select objects: Specify opposite corner: 33153 found Select objects: 33153 It took a while to complete the array command, but otherwise, no issue. Quote
Lee Mac Posted August 24, 2010 Posted August 24, 2010 There shouldn't be a problem, as on a 32-bit system an INT is stored as 32bit signed two's-complement integer, hence it should go to 2,147,483,647 ((2^32 / 2) -1) Command: (setq a 32767) 32767 Command: (itoa (1+ a)) "32768" Command: (setq a 2147483647) 2147483647 Command: (itoa (1+ a)) "-2147483648" Quote
David Bethel Posted August 24, 2010 Posted August 24, 2010 I thought it was an ACAD only problem....... Quote
Lee Mac Posted August 24, 2010 Posted August 24, 2010 I thought it was an ACAD only problem....... No - it relates to the sizes of the different data types, here is a good reference - look at the 'Fundamental Data Types' section: http://www.cplusplus.com/doc/tutorial/variables/ 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.