pinkguju Posted September 21, 2010 Posted September 21, 2010 I need to be able to make sure that there are Dimension Strings in a CAD file that range from 0 to 210. So each dimension string has a number ("01") as the unit. I want to be able to pull an external file (txt) off all the numbers that are NOT in the file. So if 200 and 151 were not in the file it would give me that. Any thoughts? Quote
Lee Mac Posted September 21, 2010 Posted September 21, 2010 (edited) A rough estimate, hacked together: (defun c:test ( / _PadLeft ) (defun _PadLeft ( s l ) (if (< (strlen s) l) (_PadLeft (strcat "0" s) l) s) ) ( (lambda ( i / l ) (while (<= (setq i (1+ i)) 210) (or (ssget "_X" (list '(0 . "DIMENSION") (cons 1 (_PadLeft (itoa i) 3)))) (setq l (cons i l)) ) ) (print l) ) -1 ) ) File: (defun c:test ( / _PadLeft f ) (defun _PadLeft ( s l ) (if (< (strlen s) l) (_PadLeft (strcat "0" s) l) s) ) (if (setq f (getfiled "Output File" "" "txt" 1)) ( (lambda ( i / l ) (while (<= (setq i (1+ i)) 210) (or (ssget "_X" (list '(0 . "DIMENSION") (cons 1 (_PadLeft (itoa i) 3)))) (setq l (cons i l)) ) ) (setq f (open f "a")) (princ l f) (close f) ) -1 ) ) (princ) ) Edited September 22, 2010 by Lee Mac Quote
BlackBox Posted September 21, 2010 Posted September 21, 2010 *IF* I understand you correctly, using Visual LISP, look into the TextOverride property of the Dimension object(s). Quote
pinkguju Posted September 21, 2010 Author Posted September 21, 2010 *IF* I understand you correctly, using Visual LISP, look into the TextOverride property of the Dimension object(s). That is exactly what i need. Quote
pinkguju Posted September 22, 2010 Author Posted September 22, 2010 Lee Mac - This works but it's reporting all the dimension strings that are in the CAD file. Even the ones that i deleted and purged out of the drawing. I deleted "178" and "180" from the file, saved and ran the LISP routine. 178 and 180 showed up on the report. Is there a way to show which ones are missing versus which ones are in the file? We have the criteria (0-210) Quote
Lee Mac Posted September 22, 2010 Posted September 22, 2010 What is the exact format of these dimension strings? Quote
alanjt Posted September 22, 2010 Posted September 22, 2010 FYI, Lee: (wcmatch "25" "*5") T I liked the idea. Quote
Lee Mac Posted September 22, 2010 Posted September 22, 2010 FYI, Lee: (wcmatch "25" "*5") T I liked the idea. Ahh - overlooked that fact Thanks mate. I need more sleep lately Quote
pinkguju Posted September 22, 2010 Author Posted September 22, 2010 The exact format.... Linear dimension string numbers in quotes ("02") what else do you need? Quote
pinkguju Posted September 23, 2010 Author Posted September 23, 2010 i tried the updated code. it's still giving me all of the ones that are in the CAD file. I just need the ones that are not in the file. it's also giving me the ones that i've deleted and purged from the file. Quote
Lee Mac Posted September 23, 2010 Posted September 23, 2010 Unless the dimension string matches exactly, that is what it will do. I am matching 001, 002, etc. Quote
pinkguju Posted September 23, 2010 Author Posted September 23, 2010 So then should i change the original to have the ### convention? Quote
Lee Mac Posted September 23, 2010 Posted September 23, 2010 So then should i change the original to have the ### convention? That's why I asked for your format. You say that the numbers run from 0 to 210, but then you give examples of 01, 02... Quote
pinkguju Posted September 23, 2010 Author Posted September 23, 2010 Sorry. i misunderstood what you were asking for. the strings are written as such "001", "002", "003", "004", "005". all the way up to "210" is that better? Quote
Lee Mac Posted September 23, 2010 Posted September 23, 2010 If that's the case then my original code should work Quote
pinkguju Posted September 24, 2010 Author Posted September 24, 2010 I tried the original code and it's giving me the same result. Listing all the one that are in the file, as opposed to the ones that are not in the file. The ones that are not in the file are also coming up in the list. Quote
Lee Mac Posted September 24, 2010 Posted September 24, 2010 Just tested the programs and it seems to work fine for me.. Testing on Dims such as... Quote
pinkguju Posted September 27, 2010 Author Posted September 27, 2010 The strings have the quotation marks in them. Once all strings ("001" to "210") have been verified i have a script that turns them into text. if i have numbers without the quotes then the conversion text doesn't work. Quote
alanjt Posted September 27, 2010 Posted September 27, 2010 What about something like this? (defun c:Test (/ ss) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "DIMENSION") (-4 . "<NOT") (1 . "") (-4 . "NOT>")))) ((lambda (i n / lst e) (while (> (setq n (1- n)) 0) (setq lst (cons n lst))) (while (setq e (ssname ss (setq i (1+ i)))) (setq lst (vl-remove (atoi (vl-list->string (vl-remove 34 (vl-string->list (cdr (assoc 1 (entget e))))) ) ) lst ) ) ) (cond (lst (print lst))) ) -1 211 ) ) (princ) ) 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.