Pither Rukka Posted November 23, 2010 Posted November 23, 2010 Hi all, Have you a lisp for check and indicate the non original dimensions selected (ex. change the text to other colour), because sometime I have drawing that I will check only change the dimension not change the object...please Quote
pBe Posted November 23, 2010 Posted November 23, 2010 are you pertaining to dimesnon overrides? Try this (defun c:test (/ sel objects) (vl-load-com) (cond ((setq sel (ssget "_X" '((0 . "DIMENSION")))) (setq objects (mapcar 'cadr (ssnamex sel))) (setq overides_selectopn (mapcar '(lambda (u) (if (not (assoc -3 (entget u '("ACAD")))) (setq objects (vl-remove u objects)) ) ) objects ) ) (princ (strcat (itoa (length objects)) " dimensions with overrides" ) ) ) ) (princ) ) Quote
Lee Mac Posted November 23, 2010 Posted November 23, 2010 (sssetfirst nil (ssget "_X" '((0 . "*DIMENSION") (-4 . "")))) Quote
Least Posted November 23, 2010 Posted November 23, 2010 Finds any "fudged" dimensions and automatically changes them to a layer called FUDGED-DIMS. ;;; ;;; FUDGE.LSP Version 1.0 ;;; ;;; Copyright (C) 1996 by Jay Garnett ;;; ;;; Permission to use, copy, modify, and distribute this software ;;; for any purpose and without fee is hereby granted, provided ;;; that the above copyright notice appears in all copies and ;;; that both that copyright notice and the limited warranty ;;; below appear in all supporting documentation. ;;; ;;; JAY GARNETT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. ;;; JAY GARNETT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. JAY GARNETT ;;; DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE ;;; UNINTERRUPTED OR ERROR FREE. ;;; ;;; DESCRIPTION ;;; Finds any "fudged" dimensions and automatically changes them to a layer called FUDGED-DIMS. ;;; ;;; By Jay Garnett ;;; Bolingbrook, IL ;;; ;;; E-Mail jgarnett@enteract.com ;;; (defun c:FUDGE(/ DIM-TXT E1 FUDGED IDX SS) (setq SS(ssget "x" '((0 . "DIMENSION"))) IDX 0 ) (while (< IDX (sslength SS)) (setq E1(entget( ssname ss IDX ))) (setq DIM-TXT(cdr(assoc 1 E1))) (if (and(not(wcmatch DIM-TXT "*<>*"))(/= DIM-TXT "")) (if (not FUDGED) (setq FUDGED(ssadd (ssname SS IDX))) (setq FUDGED(ssadd (ssname SS IDX) FUDGED)) ) );end if (setq IDX (1+ IDX)) );end while (if FUDGED (progn (if (not(tblsearch "layer" "FUDGED-DIMS")) (command ".layer" "M" "fudged-dims" "c" "magenta" "" "") );end if (command ".change" FUDGED "" "p" "la" "fudged-dims" "") (alert (strcat (itoa(sslength FUDGED)) " fudged dimensions changed \nto Layer FUDGED-DIMS")) );end progn (alert "No fudged dimensions found in this drawing") );endif );end defun Quote
Pither Rukka Posted November 23, 2010 Author Posted November 23, 2010 Thanks pBE, I mean the routine can search the dimension had changed (the original value deleted) then sign it (dimtext to other colour, ex. my original dimtext=red, -->if not oribinal changed to green). Thanks Quote
Lee Mac Posted November 23, 2010 Posted November 23, 2010 I mean the routine can search the dimension had changed (the original value deleted) then sign it (dimtext to other colour, ex. my original dimtext=red, -->if not oribinal changed to green). Maybe? (defun c:FindDodgyDims ( / ss ) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*DIMENSION") (1 . "*?*")))) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (vla-put-TextColor (vlax-ename->vla-object e) acgreen) ) ) -1 ) ) (princ) ) Quote
pBe Posted November 24, 2010 Posted November 24, 2010 Maybe? (defun c:FindDodgyDims ( / ss ) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*DIMENSION") (1 . "*?*")))) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (vla-put-TextColor (vlax-ename->vla-object e) acgreen) ) ) -1 ) ) (princ) ) Threre it is. Only i would have code it longer than Lee Macs' Would you want it to revert to the original text value as well not just change the colors? and to make it more challenging, show the "fudged" dimesions below the orginal value? Are you using this for error/standard checking? Quote
Pither Rukka Posted November 24, 2010 Author Posted November 24, 2010 Thanks all. Thanks Lee Mac, your routine is perfect and doing well.....I'm . Quote
Pither Rukka Posted November 25, 2010 Author Posted November 25, 2010 Sorry I forget something... I try to develop your code (FindDodgyDims) to make the not original selected also put background color (dimtfillclr=white) so we can easy to see the result. I try to add code "VLA-PUT-TEXTWINBACKGRNDCOLOR" But no working.. (because I'm still beginner) Could you give corret routine for add the background text. Quote
Lee Mac Posted November 25, 2010 Posted November 25, 2010 Did you look up the function "VLA-PUT-TEXTWINBACKGRNDCOLOR" in the VLIDE Help Documentation at all? If you had, you would find it was for controlling the background of the command line window - hence absolutely nothing to do with dimensions. If you don't know how to look up a function see here. (defun c:FindDodgyDims ( / ss ) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*DIMENSION") (1 . "*?*")))) ( (lambda ( i / e o ) (while (setq e (ssname ss (setq i (1+ i)))) (vla-put-TextColor (setq o (vlax-ename->vla-object e)) acgreen) (vla-put-TextFillColor o acwhite) (vla-put-TextFill o :vlax-true) ) ) -1 ) ) (princ) ) Quote
Guest kruuger Posted November 25, 2010 Posted November 25, 2010 how about to indicates overrides dims that way: (defun C:HL (/ SS PT PT2) (if (setq SS (ssget "_X" '((0 . "*DIMENSION") (1 . "*?*")) ) ) (if (setq PT (getpoint "\nSelect anchor point: ")) (foreach % (jk:SSX_SS->List SS) (setq PT2 (cdr (assoc 11 (entget %)))) (entmakex (list (cons 0 "LINE") (cons 10 PT) (cons 11 PT2) (cons 62 2) ) ) ) (princ "\n>> Invalid point. ") ) (princ "\n>> No overrided dimensions. ") ) (princ) ) (defun jk:SSX_SS->List (sel / n l) (repeat (setq n (sslength sel)) (setq n (1- n) l (cons (ssname sel n) l) ) ) ) (princ) kruuger Quote
Pither Rukka Posted November 29, 2010 Author Posted November 29, 2010 Thanks Lee Mac, I try your update code but I don't know why cannot fill background the text. I try to use set the dimtfill and dimtfillclr and it ok: (defun c:FindDodgyDims ( / ss ) (vl-load-com) (setvar "dimtfillclr" 5) (setvar "dimtfill" 2) (if (setq ss (ssget "_X" '((0 . "*DIMENSION") (1 . "*?*")))) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (vla-put-TextColor (vlax-ename->vla-object e) acgreen) (command "-dimstyle" "A" ss "") ) ) -1 ) ) (setvar "dimtfill" 0) (princ) ) But new problem, cannot undo after doing the code...please help me:( Kruuger, thank for your code..it is spectacular code. Quote
Lee Mac Posted November 29, 2010 Posted November 29, 2010 My code seems to work for me - do you receive an error? Your code is changing the Dimension Style for the same selection set over and over for the number of entities in the set. 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.