Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
dvanerem
Posts: 225
Registered: ‎06-26-2006
Message 1 of 5 (252 Views)

Select Multiple Objects

252 Views, 4 Replies
06-05-2009 09:39 AM
I cannot seem to figure out how I can make this pick more than one object. I know that it must be realatively simple, but everything that I have tried has not worked. Can someone help?

(defun C:MM-BYBLOCK ( / ENT SCMDE SORMOD VLAY)

(setq SOSMOD (getvar "osmode")) ; captures current snap settings
(setq SCMDE (getvar "cmdecho")) ; capture current setting
(setq SORMOD (getvar "orthomode")) ; capture current setting
(setvar "cmdecho" 0) ; stop screen output
(setvar "osmode" 0) ; set osnap to none
(setvar "orthomode" 0) ; set ortho off

(setq ENT (entsel "\nSelect Object :"))

(command "change" ENT "" "p" "la" "0" "C" "byblock" "")

(setvar "cmdecho" SCMDE) ; reset
(setvar "orthomode" SORMOD) ; reset
(setvar "osmode" SOSMOD) ; reset snap mode
(gc)
(princ)
)
*Expert Elite*
Kent1Cooper
Posts: 5,251
Registered: ‎09-13-2004
Message 2 of 5 (252 Views)

Re: Select Multiple Objects

06-05-2009 10:11 AM in reply to: dvanerem
Use (ssget) rather than (entsel) if you want more than one object.

--
Kent Cooper


dvenerem wrote...
I cannot seem to figure out how I can make this pick more than one object....
....
(setq ENT (entsel "\nSelect Object :"))
....
Kent Cooper
Distinguished Contributor
dvanerem
Posts: 225
Registered: ‎06-26-2006
Message 3 of 5 (252 Views)

Re: Select Multiple Objects

06-05-2009 11:37 AM in reply to: dvanerem
I did put this in my code, but it does not seem to work. Can you elaborate a little more.
*Expert Elite*
Kent1Cooper
Posts: 5,251
Registered: ‎09-13-2004
Message 4 of 5 (252 Views)

Re: Select Multiple Objects

06-05-2009 12:39 PM in reply to: dvanerem
It wouldn't work if you simply substitute the term "ssget" in place of "entsel" -- the functions use different arguments [e.g. you can't spell out a prompt in (ssget), but it has many powerful options that (entsel) doesn't]. See the AutoLisp Reference for details on how to use it -- that will be the best elaboration. If you try it and it doesn't work, you can post what you tried, and someone will probably be able to tell you how to fix it.

--
Kent Cooper
Kent Cooper
*Expert Elite*
tcorey
Posts: 2,468
Registered: ‎12-18-2002
Message 5 of 5 (252 Views)

Re: Select Multiple Objects

06-06-2009 03:00 PM in reply to: dvanerem
Here's the code:



(setq SSET (ssget))



(command "change" SSET "p" "la" .......





Tim Corey
Tim Corey, Owner
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community