FRAMEDNLV
2007-03-23, 07:54 PM
I have need some help with filtering xrefs.
I only need the ones from paperspace, current tab and only if it is loaded/found (attached or overlayed doesn't matter).
The problem I'm having with my current lisp is that is fails when there are any xrefs that are not found or unloaded. So I need to set a filter so it will not error out (skips unloaded and not found).
I'm guessing that it could be done at this portion:
(while (setq tdef (tblnext "BLOCK" (not tdef)))
Here is part of what I'm using so far:
(command "tilemode" "0")
;;;MINIMAL ERROR CHECKING & MODES
(setq olderr *error*
*error* (lambda (e) (princ e) (setq *error* olderr) (princ)))
(setvar "DIMZIN" 8)
;;;STEP THRU THE BLOCK TABLE - GET XREFs ONLY
(while (setq tdef (tblnext "BLOCK" (not tdef)))
(and (cdr (assoc 1 tdef))
(setq xlist (if (or
(= (cdr (assoc 70 tdef)) 100)
(= (cdr (assoc 70 tdef)) 68)
(= (cdr (assoc 70 tdef)) 102)
(= (cdr (assoc 70 tdef)) 44)
(= (cdr (assoc 70 tdef)) 36)
)
(cons (cons (cdr (assoc 2 tdef)) (cdr (assoc 1 tdef))) xlist)))))
;;MAKE A FILTER STRING
(and xlist
(setq xstr "")
(foreach x xlist
(setq xstr (strcat xstr "," (car x))))
(setq xstr (substr xstr 2)))
;;;GET INSERT SELECTION SET
(and xstr
(setq ss (ssget "X" (list (cons 0 "INSERT")
(cons 2 xstr)
(cons 67 (if (= (getvar "TILEMODE") 1) 0 1))
(cons 210 '(0 0 1)))))
Any help would be great.
Thanks,
Chris
I only need the ones from paperspace, current tab and only if it is loaded/found (attached or overlayed doesn't matter).
The problem I'm having with my current lisp is that is fails when there are any xrefs that are not found or unloaded. So I need to set a filter so it will not error out (skips unloaded and not found).
I'm guessing that it could be done at this portion:
(while (setq tdef (tblnext "BLOCK" (not tdef)))
Here is part of what I'm using so far:
(command "tilemode" "0")
;;;MINIMAL ERROR CHECKING & MODES
(setq olderr *error*
*error* (lambda (e) (princ e) (setq *error* olderr) (princ)))
(setvar "DIMZIN" 8)
;;;STEP THRU THE BLOCK TABLE - GET XREFs ONLY
(while (setq tdef (tblnext "BLOCK" (not tdef)))
(and (cdr (assoc 1 tdef))
(setq xlist (if (or
(= (cdr (assoc 70 tdef)) 100)
(= (cdr (assoc 70 tdef)) 68)
(= (cdr (assoc 70 tdef)) 102)
(= (cdr (assoc 70 tdef)) 44)
(= (cdr (assoc 70 tdef)) 36)
)
(cons (cons (cdr (assoc 2 tdef)) (cdr (assoc 1 tdef))) xlist)))))
;;MAKE A FILTER STRING
(and xlist
(setq xstr "")
(foreach x xlist
(setq xstr (strcat xstr "," (car x))))
(setq xstr (substr xstr 2)))
;;;GET INSERT SELECTION SET
(and xstr
(setq ss (ssget "X" (list (cons 0 "INSERT")
(cons 2 xstr)
(cons 67 (if (= (getvar "TILEMODE") 1) 0 1))
(cons 210 '(0 0 1)))))
Any help would be great.
Thanks,
Chris