Jump to content

Recommended Posts

Posted

Hi,

I'm trying to create a selection function, that only selects items from current layer.

The problem is that after ssget i need to specify what to do with the selected items.

What I want is to simply select items like with a mouse, so i can use ACAD edit options to move, copy, delete, change attributes.

 

Here is the code I have so far.

 

(defun c:select1 (/ lay)
   
 (setq lay (getvar "clayer"))

 (if (ssget (list (cons 8 lay)))
   (progn
       

   );; progn 
 );; if
);;c:select1

It selects items from current layer but after I finish selecting it just writes nil because there is no action specified after progn. Can any one tell me how to add the ssget selected pool to ACAD selection? I want it to work as a simple version of qselect. It's propably a simple line of code, but I wasn't able to find it so far.

 

P.S. Thanks for help if any will be provided ;)

Posted

Congrats on your first post, and welcome to the forums!

 

I believe you're interested in the sssetfirst function, more information found in the Developer Documentation.

 

Also, if you'd like, you *can* combine a couple lines of code (that doesn't mean you have to), like this:

 

...
 (if (setq ss (ssget (list (cons 8 (getvar 'clayer)))))
   (progn
   ...

 

 

 

Hope this helps!

Posted
(sssetfirst nil (ssget (list (cons 8 (getvar 'clayer)))))

Posted

(defun c:select1 ()    
(sssetfirst nil (ssget (list (cons 8 (getvar 'clayer)))))
);;c:select1

 

Thats exactly what I needed.

 

Thanks.

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