moberdacker Posted April 28 Posted April 28 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. Quote
Lee Mac Posted April 28 Posted April 28 The syntax of the foreach loop would need to be: (foreach item prgitms (command ".-purge" item "*" "n") ) Quote
moberdacker Posted April 28 Author Posted April 28 @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. Quote
Recommended Posts
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.