Jump to content

Is there any advanced purge lisp like this?


Elektrik

Recommended Posts

I want to convert all drawing to the current layer used, then set all drawing by layer, then purge it, then -purge regapps (without verifying each name to be purged), and finally 

laydel (delete all layers other than the current one). Thanks in advance.
 

Link to comment
Share on other sites

Give this a try

 

;;----------------------------------------------------------------------------;;
;; Condence Drawing to one layer
(defun C:OOF (/ SS)
  (setq SS (ssget "_X" '((410 . "Model")))) ;select everything in model space
  ;change selection set SS to current layer and color to bylayer
  (vl-cmdf "_Chprop" SS "" "LA" (getvar 'clayer) "C" "Bylayer" "") 
  (repeat 3 (vl-cmdf "_.Purge" "A" "*" "N")) ;purge 3 times  
  (princ)
)

 

  • Like 3
Link to comment
Share on other sites

Beaten to it by MHUPP... but you have done all the hard work by writing out the process you want to follow - an internet search would give you all the components of what you want to do and then all you need is to put it all together. OK might not be as pretty as above, but it should work out.

 

Might want to add something like this https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-all-to-0-layer-by-layer-including-block-and-block-in/td-p/5376995 to set all block contents to layer 0, with options from KentClark and Lee Mac - I tend to favour Lees code through experience it works well.

  • Like 1
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...