TINDANG Posted July 27, 2022 Posted July 27, 2022 To change the dim color to red. I selected it, then edited the parameters in the properties panel. Please help me create a lisp to do that Quote
Tharwat Posted July 27, 2022 Posted July 27, 2022 Here you go. (defun c:Test (/ int sel ent nxt) ;; Tharwat Al Choufi. - Date: 27.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq nxt (tblobjname "BLOCK" (cdr (assoc 2 (entget ent))))) (while (setq nxt (entnext nxt)) (entmod (append (entget nxt) '((62 . 1)))) ) ) (command "_.REGEN") ) (princ) ) Â Like, Share and subscribe. Â 2 Quote
TINDANG Posted July 28, 2022 Author Posted July 28, 2022 Â 10 hours ago, Tharwat said: Here you go. (defun c:Test (/ int sel ent nxt) ;; Tharwat Al Choufi. - Date: 27.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq nxt (tblobjname "BLOCK" (cdr (assoc 2 (entget ent))))) (while (setq nxt (entnext nxt)) (entmod (append (entget nxt) '((62 . 1)))) ) ) (command "_.REGEN") ) (princ) ) Â Like, Share and subscribe. Â Thanks, Tharwat! Lisp has actually changed it to red, but when i moved it to another location, the red color was lost. Can you change its properties? 1 Quote
Dadgad Posted July 28, 2022 Posted July 28, 2022 Tharwat to the rescue, he'll get you back on the tracks. Is this something to be done ONLY to selected dimensions, or across the board to all dimensions in the drawing? 1 Quote
Tharwat Posted July 28, 2022 Posted July 28, 2022 8 hours ago, TINDANG said: Â Thanks, Tharwat! Lisp has actually changed it to red, but when i moved it to another location, the red color was lost. Can you change its properties? Here is another way to change colours of selected dimensions and they won't be reverted back to original colours even if you carry / copy them to another DWG or layout ... etc. (defun c:Test (/ int sel ent obj) ;; Tharwat Al Choufi. - Date: 28.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (mapcar '(lambda (f) ((eval f) obj 1)) '(vla-put-TextColor vla-put-ExtensionLineColor vla-put-DimensionLineColor) ) ) ) (princ) ) Â Â Â Â Quote
TINDANG Posted July 29, 2022 Author Posted July 29, 2022 23 hours ago, Tharwat said: Here is another way to change colours of selected dimensions and they won't be reverted back to original colours even if you carry / copy them to another DWG or layout ... etc. (defun c:Test (/ int sel ent obj) ;; Tharwat Al Choufi. - Date: 28.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (mapcar '(lambda (f) ((eval f) obj 1)) '(vla-put-TextColor vla-put-ExtensionLineColor vla-put-DimensionLineColor) ) ) ) (princ) ) Â Â Â Â Great! Thanks, it worked fine. I have 1 more question. If i want to change more dim line lineweight, how do i do it? (eg dim line lineweight = 0.1) 1 Quote
mhupp Posted July 29, 2022 Posted July 29, 2022 2 hours ago, TINDANG said: Great! Thanks, it worked fine. I have 1 more question. If i want to change more dim line lineweight, how do i do it? (eg dim line lineweight = 0.1) Â Put inside the while statement before or after the mapcar. Â (vla-put-dimensionlineweight obj 0.1) Â 1 Quote
TINDANG Posted August 5, 2022 Author Posted August 5, 2022 (edited) On 7/29/2022 at 7:38 PM, mhupp said:  Put inside the while statement before or after the mapcar.  (vla-put-dimensionlineweight obj 0.1)  I put it in . but the result is 0.00. is there something wrong? (defun c:Test (/ int sel ent obj) ;; Tharwat Al Choufi. - Date: 28.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (vla-put-dimensionlineweight obj 0.1) (mapcar '(lambda (f) ((eval f) obj 1)) '(vla-put-TextColor vla-put-ExtensionLineColor vla-put-DimensionLineColor) ) ) ) (princ) ) Edited August 5, 2022 by TINDANG insert code Quote
mhupp Posted August 5, 2022 Posted August 5, 2022 Seems to be a factor of 10 I don't have 0.1 so it gave an error  But this code set it to 0.13 (defun c:Test (/ int sel ent obj) ;; Tharwat Al Choufi. - Date: 28.Jun.2022 ;; ;; website: https://autolispprograms.wordpress.com ;; (and (setq int -1 sel (ssget '((0 . "*DIMENSION")))) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (vla-put-dimensionlineweight obj 13) (mapcar '(lambda (f) ((eval f) obj 1)) '(vla-put-TextColor vla-put-ExtensionLineColor vla-put-DimensionLineColor) ) ) ) (princ) )  Quote
Jonathan Handojo Posted August 5, 2022 Posted August 5, 2022 I was gonna say, if you were just changing its colour (a general property), recording a macro would be the easier option without any need of LISP coding. Dimension line weight falls outside of general properties, so it looks like you need some coding. What mhupp put up there should work just fine. If anything, just use (ssget "_:L" '((0 . "*DIMENSION"))), otherwise the command will fail when dimensions in a locked layer happens to be accidentally selected. 1 Quote
TINDANG Posted August 8, 2022 Author Posted August 8, 2022 It was working fine. Thanks @Tharwat, mhupp, Jonathan Handojo for the support ! 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.