Jump to content

Trying to modify a LISP for multiple object selection outside of block


neeboy74

Recommended Posts

Hello to all:

 

I have some LISPS that will move single-selected entities to different layers in a drawing These objects are all inside of blocks.

 

I now need to have the functionality extended so I can select MULTIPLE OBJECTS

outside of blocks and move them to specified layers.

 

I have tried modifying the attached example file; the selection process works, but I am constantly getting "bad argument type: consp

 

I've attached the LISP; what am I doing wrong? The objects in question that need to be moved are all lines, other geometry, etc. I have tried reading about selection criteria for this operation, but it's over my head.

To_Layers.lsp

Link to comment
Share on other sites

(defun c:tolayer  (/ doc ss sn)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)))
 (vla-endundomark doc)
 (vla-startundomark doc)
 (cond
   ((not (tblsearch "LAYER" "HILMOT-ARROWS"))
    (princ (strcat "\nLayer < HILMOT-ARROWS > is not found !")))
   ((and (princ "\nSelect object to move to layer < HILMOT-ARROWS >")
         (setq ss (ssget "_:L" '((0 . "~VIEWPORT"))))
         )
    (while (setq sn (ssname ss 0))
      (entmod (append (entget sn) '((8 . "HILMOT-ARROWS"))))
      (ssdel sn ss))
    )
   )
 (vla-endundomark doc)
 (princ)
 ) (vl-load-com)

Link to comment
Share on other sites

Thanks for the contribution, Tharwat, but I think your code is moving the whole block to the specified layer. I need to be able to move multiple-selected individual items INSIDE the block, not the whole block itself.

Link to comment
Share on other sites

I just modified your attached codes a bit.

Is it okay with you to have a routine to move to layer just the picked object inside a block? is this what you are after?

Link to comment
Share on other sites

I'm after the ones I select...and when I say select, I mean select with the normal "drag a window across" method. I'm trying to avoid picking each individual object, some of them are lines less than an inch long and that gets a little unnerving, trying to pick 20-30 reaaaaally small lines individually. I have to, on a very regular basis, modify 50-150 unique (of COURSE) block definitions. I'm trying to save time any way I can, and NOT having to open/close the block editor EVERY TIME is what I'm after.

 

I've got the "move-all" option already covered.

Link to comment
Share on other sites

I'm after the ones I select...and when I say select, I mean select with the normal "drag a window across" method. I'm trying to avoid picking each individual object, some of them are lines less than an inch long and that gets a little unnerving, trying to pick 20-30 reaaaaally small lines individually. I have to, on a very regular basis, modify 50-150 unique (of COURSE) block definitions. I'm trying to save time any way I can, and NOT having to open/close the block editor EVERY TIME is what I'm after.

 

I've got the "move-all" option already covered.

 

 

Unfortunately - the SSGET function cannot do a multiple select within a block, unless you are in the refedit environment. The only way I know of is using (nentsel) which is a single selection only. If someone else here knows another way - great, but I don't think what your asking is possible with VL.

 

 

As an alternative approach: are there common layers or linetypes (or any other common property) that can be searched for in these blocks? IF that is the case you could make a lisp to search for these within the block definition and make the changes.

Link to comment
Share on other sites

Yeah that's what I was afraid of, no real solution....I am currently working on LISPS that will automate almost everything, but I was thinking about just in case "everything" isn't an ultimately-attainable solution. Thanks for your reply!

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