Well, after calming down a little (I almost lost my business because of that), I have decided to give it one last chance.
Here is my script:
(defun C:DSP ( / dimStyleIdentifier dimStyleName dimStyleEntityName dimStyleEntity)
(setq dimStyleIdentifier (tblnext "DIMSTYLE" T)) ;get the first DIMSTYLE name and store it in dimStyleIdentifier
;Actually, it sets dimStyleIdentifier to the next dimstyle, but because there is the T
;parameter, it rewinds the table to the first entry of the DIMSTYLE table.
;The problem with tblnext is that it doesn't return a usable entity that can be updated with entmod. So we have
;to make a twist and first fetch the dimstylename, then fetch the correct dimstyle entity using tblobjname followed
; by an entget, then we can apply the entmod to update its attibutes.
(while dimStyleIdentifier
(setq dimStyleName (cdr (assoc 2 dimStyleidentifier))) ;fetch dimStyleIdentifier's name and store it in dimStyleName
(setq dimStyleEntityName (tblobjname "DIMSTYLE" dimStyleName)) ;fetch the dimstyle entity name.
(setq dimStyleEntity (entget dimStyleEntityName)) ;here we finally fetch the correct entity on which entmod can be invoked
(entmod (subst '(178 . 7) (assoc 178 dimStyleEntity) dimStyleEntity)) ;perform a substitution of the DXF code for DIMCLRT
;entmod is the function that actually applies the changes
(setq dimStyleIdentifier (tblnext "DIMSTYLE")) ;get the next dimstyle
); ends the while loop
(command "._DIM1" "update" "all" "") ;that's what updates the dimensions and redraws them white.
); ends the defun
The code is simple and I have commented it heavily so it'll be easy for you to understand. All I do, is make a substitution on the DXF code 178 which is the dimension style text color, and I force it to white. That's all my code does.
It seems, that the last line (command "._DIM1" "update" "all ""), is the one that deletes the <dimstyle override> (even though it shouldn't). The problem is that without this line, the changes don't get redrawn on the screen.
Anyone has an idea on that?
In my timezone, it is actually midnight, so I'll go to sleep, I hope the rest will give me some good advice on that enormous flaw.
EDIT: jeff_m you replied while I was writing this post. Yes definitely it is the fact that <dimstyle override> get deleted is what is causing me trouble.