Jump to content

Press the number button either choosing objects with mouse.


Recommended Posts

Posted

I want to get the amount of objects.

(setq amount (sslength (ssget)))


or

(setq amount (getint "\nAmount of details: "))


to choose from at the same time.
Does it possible?

Posted

Not as a single prompt (at least not without recreating your own version of ssget using a grread loop).

 

I would instead suggest something like this:

(defun c:test ( / qty tmp )
    (initget 6)
    (if
        (setq qty
            (cond
                (   (getint "\nNumber of details <select>: "))
                (   (setq tmp (ssget))
                    (sslength tmp)
                )
            )
        )
        (progn
            (princ (strcat "\nThe user specified " (itoa qty) " object" (if (= 1 qty) "." "s.")))
            ;; do something else
        )
    )
    (princ)
)

 

  • Like 1

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