Jump to content

Recommended Posts

Posted
Thanks for making me think it through, Lee! :thumbsup:

 

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 >>") )
   )
 )
)

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    13

  • Lee Mac

    10

  • Michaels

    8

  • David Bethel

    3

Top Posters In This Topic

Posted

And won't (sslength nil) give nil all the time if blocks are found or not ?

 

So that's logically return nil.

Posted
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.

Posted

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. :lol:

Posted
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. :lol:

 

I guess you mean my formal writtings. :)

 

Thanks

Posted

(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"))

 

:P

Posted

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

Posted
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!

Posted
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.

Posted

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

Posted
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.

Posted

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"

Posted

I thought it was an ACAD only problem.......

Posted
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/

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...