ElAmigo Posted March 8 Posted March 8 (edited) Hello, I'm trying to write a code that changes the dimension style of all dimensions in layer Dimension(ISO). I need the code to change it to variable "DimStyleOverrider" and this variable must be dependant on another variable. When OldFactor = 10 I need "DimStyleOverrider" to be "Change10" and when OldFactor = 5 I need it to be "Change5". You can assume these styles already exist in the file. I hope someone can help me. Edited March 8 by ElAmigo Quote
devitg Posted March 10 Posted March 10 On 3/8/2024 at 9:17 AM, ElAmigo said: I have been able to solve it @ElAmigo it would be nice if you could share your solution, so we can learn about it. Quote
ElAmigo Posted March 11 Author Posted March 11 (defun WhichDimension () (setq DimStyleOverrider (cond ((= OldFactor 5) "Change5") ((= OldFactor 10) "Change10") (defun example () (WhichDimension) (while (< i (sslength selectie)) (setq ent (ssname selectie i)) ; (setq data (entget ent)) (if (= (cdr (assoc 0 data)) "DIMENSION") ; (progn (setq newData (subst (cons 3 DimStyleOverrider) (assoc 3 data) data)) ; Changes DIMSTYLE (entmod newData) (entupd ent) ) ) (setq i (+ i 1)) ) ) I hope this is clear enough. Had to change some names. This code works for me but after changing the DIMSTYLE it doesn't update everything that should. I created another post about that because I haven't been able to find a solution in days. 1 Quote
devitg Posted March 11 Posted March 11 1 minute ago, ElAmigo said: (defun WhichDimension () (setq DimStyleOverrider (cond ((= OldFactor 5) "Change5") ((= OldFactor 10) "Change10") (defun example () (WhichDimension) (while (< i (sslength selectie)) (setq ent (ssname selectie i)) ; (setq data (entget ent)) (if (= (cdr (assoc 0 data)) "DIMENSION") ; (progn (setq newData (subst (cons 3 DimStyleOverrider) (assoc 3 data) data)) ; Changes DIMSTYLE (entmod newData) (entupd ent) ) ) (setq i (+ i 1)) ) ) I hope this is clear enough. Had to change some names. This code works for me but after changing the DIMSTYLE it doesn't update everything that should. I created another post about that because I haven't been able to find a solution in days. @ElAmigo Thanks 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.