Jump to content

Recommended Posts

Posted

I am trying to write a clean drawing lisp routine that will purge most things, but leaves unused layers and a couple other items intact for company reasons.  I was trying to avoid having to write a separate line for each of the fourteen types of items I want to purge. I am getting unknown command "*" and unknown command "N" then "nil" and I don't quite know why.  Well the nil is probably because it gets to the end of the list.  Maybe it's just what I'm trying to do is not an option?  

 

here is the code i have that doesn't seem to do anything except return errors:

 

;;Purge unused items
(defun c:purgeitems ( / prgitms)
	(setq prgitms '("blocks" "detailviewstyles" "groups" "ltypes" "materials" "plotstyles" "shapes"
	  "mlinestyles" "sesctionviews" "visualstyles" "regapps" "zero-length geometry" "empty text objects"
	  "oprhaned data"))
	(foreach prgitms
		(command ".-purge" prgitms "*" "n")
	)
)

 

If I got that to wok then I was planning to run through the function a few times to try to catch all the nested blocks since I can't seem to find a way to tell the command line version of purge to include nested items, zero-length items, empty text, and orphaned data like you can with the check boxed with the "regular" purge command.

 

Posted

The syntax of the foreach loop would need to be:

(foreach item prgitms
    (command ".-purge" item "*" "n")
)

 

Posted

@Lee Mac that's what I started with but I kept getting function cancelled errors, so I changed it.  but after posting I noticed that I misspelled one of the options and that's probably why it wasn't working. I feel like a right idiot now.  but thank you for your response.

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