Jump to content

Variable that stores the count of the last selection set?


Recommended Posts

I'm just wondering if there is a way to return the number of objects in a selection set?

 

For example, I hope to use Diesel to interpret an IF statement that takes a particular action if the selection equals zero.

 

Cannot use Lisp, only macros and scripts with Diesel on LT. Thanks.

Link to comment
Share on other sites

In saying that, another way would be to return the number of objects on a given layer. I could also interpret that data in the same way.

Link to comment
Share on other sites

Maybe IF Nil rather than zero or check IF T is it true means selection exists.

 

Understand for LT but a lisp example

(setq ans (entsel))
(if (/= ans nil) ; or (if ans this checks for TRUE
(alert "object picked")
(alert "blank space picked")
)

Edited by BIGAL
Link to comment
Share on other sites

  • 3 weeks later...

Thanks BIGAL, you always have a wealth of options.

 

I don't think entsel works on LT, though it looks almost perfect.

 

I can run a List command, which puts the following in the command line:

 

LIST
 Select objects: Last
 1 found
  
 Select objects:
  
                   LWPOLYLINE  Layer: "0"
                             Space: Model space
                    Handle = 9355
             Closed
     Constant width     0.000
               area   3705.718
          perimeter   215.795
  
           at point  X=  305.429  Y=   34.592  Z=    0.000
              bulge    -0.986
             center  X=  321.636  Y=   64.872  Z=    0.000
             radius    34.345
        start angle 208d9'27.7"
          end angle 26d31'17.0"
           at point  X=  336.972  Y=   95.603  Z=    0.000
              bulge    -1.014
             center  X=  321.636  Y=   64.872  Z=    0.000
             radius    34.345
        start angle 26d31'17.0"
          end angle 208d9'27.7"
 

 

The number "1 found" is exactly what I need, and I am wracking my brain attempting to write that into a temporary variable somehow.

 

I have not found any variable that stores that information such that I can return it at a particular time. I am now wondering if the best thing for me would be to SetVar UserR1 to zero, then try a Move command, and then SetVar UserR1 to 1.

 

Then I can interpret UserR1 in a second button macro (if there is data to move then it will have gone through to the end of the macro and changed the UserR1, but if no selection then it will hang expecting user ti input selection set).

 

Something like:

 

^C^C$M=$(IF(getvar,userr1),1,move,^C^C)

(in english in case my simplified example is incorrect - if true then move selection up 8 units, if false then do nothing.

 

It's not exactly bullet-proof, but it could work, and is the best I can come up with so far.

Link to comment
Share on other sites

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