tiffanysml Posted October 5, 2011 Posted October 5, 2011 Hi I have a bunch of drawings where some contain an xref that was xclipped and others did not. I want to run a command on the files that use the xclip to generate the xclip frame polyline So to the effect of: (if (**xclip is used**) (command "xclip" "all" "" "p") ) Is there a way to write a conditional statement to prove xclip is used/active in the dwg? Does using xclip leave any sort of marker on the dwg file? Thank you! Quote
Lee Mac Posted October 6, 2011 Posted October 6, 2011 Using some code I already had written: (defun HasXClip ( / a b c d e f ) (and (while (setq a (tblnext "BLOCK" (null a))) (if (= 4 (logand 4 (cdr (assoc 70 a)))) (setq b (cons "," (cons (cdr (assoc 2 a)) b))) b ) ) (setq c (ssget "_X" (list '(0 . "INSERT") (cons 2 (apply 'strcat (cdr b)))))) (setq d -1) (progn (while (and (not f) (setq e (ssname c (setq d (1+ d))))) (setq f (LM:XClipBoundary e)) ) f ) ) ) (defun LM:XClipBoundary ( ename / xdict ) (if (setq xdict (cdr (assoc 360 (entget ename)))) (LM:XClipBoundary xdict) (if (and (eq "SPATIAL_FILTER" (cdr (assoc 0 (setq ename (entget ename))))) (eq 1 (cdr (assoc 71 ename))) ) ( (lambda ( massoc ) (massoc 10 ename)) (lambda ( key elist / item ) (if (setq item (assoc key elist)) (cons (cdr item) (massoc key (cdr (member item elist)))) ) ) ) ) ) ) Call with: (HasXClip) Will return T if drawing contains an XRef with an XClip. Hence in your IF statement: (if (HasXClip) ... ) Quote
tiffanysml Posted October 6, 2011 Author Posted October 6, 2011 Wow thank you so much Lee! You're the best! 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.