Jump to content

Recommended Posts

Posted

Hii,

i have layer names like "Earth Line'", "Steel Line", "Concrete Line" etc..

so i need select all mentioned layer named containing objects and delete them.

any code for this task?

 

Thankyou..

Posted

Not tested:

 

(defun C:test ( / acDoc SS )
 (cond
   ( (not (ssget "X" '((8 . "Earth Line',Steel Line,Concrete Line")))) (prompt "\nNo Selection.") )
   ( (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
     (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)
     (vlax-map-collection (setq SS (vla-get-ActiveSelectionSet acDoc)) ''((x) (vl-catch-all-apply 'vla-Delete (list x))))
     (vla-Delete SS)
     (vla-EndUndoMark acDoc)
   )
 )
 (princ)
)
(vl-load-com)(princ)

Posted

grrr thank you very much. it is working.

can you provide selecting objects only? instead of delete.

 

Thank you.

Posted
grrr thank you very much. it is working.

can you provide selecting objects only? instead of delete.

 

Thank you.

 

Thanks for confirming,

This should limit the selection to the active viewport (as my previous suggestion selects objects in all viewports - and that might be unwanted) :

(defun C:test nil 
 (sssetfirst nil
   (ssget "X" 
     (list 
       '(8 . "Earth Line',Steel Line,Concrete Line") 
       (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model"))
     )
   )
 )
 (princ)
)

Posted
:roll:

 

Give it a try..

 

My bad.. I thought you want to delete the layer itself..:geek:

Posted
My bad.. I thought you want to delete the layer itself..:geek:

 

LOL its ok and thank you..

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