asos2000 Posted February 14, 2010 Posted February 14, 2010 I want to update this lisp ;to select all dimensions (defun c:dms(/ dimsel) (setq dimsel(ssget "x" '((0 . "DIMENSION")))) (command "_PSELECT" "_p" "") (PRINC) ) What I want is to add another condition "when layer is ON" because this lisp select all dimension even in OOF layers. I got the reason (when value of DXF code 62 is negative) but couldn't add the condition. Could _SELECT be used in state of _PSELECT? Because PSELECT command needs properties palate opened at least one time. Quote
Lee Mac Posted February 14, 2010 Posted February 14, 2010 How about; (defun c:dms nil (sssetfirst nil (ssget "_X" '((0 . "DIMENSION")))) (princ)) Quote
asos2000 Posted February 14, 2010 Author Posted February 14, 2010 Still select dimensions in OFF layers Quote
Lee Mac Posted February 14, 2010 Posted February 14, 2010 Hows this? (defun c:dms (/ ss) (if (setq ss (ssget "_X" '((0 . "DIMENSION")))) (sssetfirst nil (last (mapcar (function (lambda (x) (if (minusp (cdr (assoc 62 (entget (tblobjname "LAYER" (cdr (assoc 8 (entget x) ) ) ) ) ) ) ) (ssdel x ss) ss ) ) ) (mapcar (function cadr) (ssnamex ss) ) ) ) ) ) (princ) ) Quote
rkmcswain Posted February 14, 2010 Posted February 14, 2010 At the risk of being shown up by Lee or someone else... Here is one way to do it... ;to select all dimensions (defun c:dms(/ dimsel ent lst lay col newss i) (setq dimsel(ssget "x" '((0 . "DIMENSION"))) i 0 newss (ssadd)) (repeat (sslength dimsel) (setq ent (ssname dimsel i)) (setq lst (entget ent)) (setq lay (cdr (assoc 8 lst))) (setq lyr (entget (tblobjname "layer" lay))) (setq col (cdr (assoc 62 lyr))) (if (not (minusp col)) (ssadd ent newss) ) (setq i (1+ i)) ) (command "_PSELECT" newss "") (PRINC) ) If you had thousands and thousands of entities and layers, you would probably want to add some more code that you can avoid checking the same layer twice. At the risk of being shown up by Lee... See what I mean? Quote
Lee Mac Posted February 14, 2010 Posted February 14, 2010 Another: (defun c:dms (/ str tdef) (setq str "") (while (setq tdef (tblnext "LAYER" (not tdef))) (if (minusp (cdr (assoc 62 tdef))) (setq str (strcat str (chr 44) (cdr (assoc 2 tdef)))))) (sssetfirst nil (ssget "_X" (list (cons 0 "DIMENSION") (cons -4 "<NOT") (cons 8 (substr str 2)) (cons -4 "NOT>")))) (princ)) Originally Posted by rkmcswain At the risk of being shown up by Lee... See what I mean? Sorry dude :wink: 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.