Author Topic: [SOLVED] Modifying dimension style attributes  (Read 11512 times)

0 Members and 1 Guest are viewing this topic.

zibidi

  • Guest
Re: ISO dxf code for dimension style
« Reply #15 on: July 17, 2007, 04:44:25 AM »
Here I am, cool and fresh!  :kewl:

Thanks guys for helping me out on this on. I was really mad yesterday!

Quote
Zibidi, why are you overriding the dimstyle?
I am not, it's AutoCAD that's doing it. Overrides are evil

Quote
Anyway, I found another potential problem. That being that if the DimStyle's DIMCLRT value is the default of BYBLOCK (color 0) then it will not be in the (entget) list....which means there's nothing to modify with (subst), so that Style's Text color will not be revised per your code. Just thought you might want to know.
For once I am lucky. The DIMCLRT color is forced to "yellow" (who the < > set them to yellow in the first place?)

Quote
Yes, I'm pretty sure that zibidi's intent is to change all of the Dimension Text to be White.
Yes. Currently the text appears yellow. The only little thing I want to do is turn it into white, that's it. Overrides or not I don't care. The only little thing I want to do is change a color from yellow to white.

Quote
this is why I quit fooling with dimensions along time ago.....
:lmao:

Quote
For example, he is currently dealling with past overrides and the only way to deal with them is make more overides today.  Then lets say 6 months in the future he needs to make more changes.  Then at that time he is dealing with the overrides prior to today, today's overrides and whatever he has to do in the future.
I am not trying to create new overrides, all I want to achieve is change the text color, now if autocad does this by creating overrides or some other cryptic behavior, that is not my fault. Changing an object's attribute should be the simplest thing on earth either by directly assigning its value (bad practice) or by using a setter method to which we can pass a parameter and takes care of setting the value accordingly.

What I am really trying to do, is change the text color as if I were doing it by hand in the dimstyle editor, it's as simple as that. Type: "dimstyle", select the dimstyle to edit, click "modify", then choose the "text" tab, select the white color, click "ok", then repeat for all dimstyles, click close, and all the dimstyles have now white text, no overrides or that kind of crap, no animal has been harmed during the process, and the environment has been preserved.  :-)

Now why this process cannot be "easily" mimicked in autolisp, that is another question...  :pissed:
« Last Edit: July 17, 2007, 12:04:40 PM by zibidi »

CADaver

  • Guest
Re: ISO dxf code for dimension style
« Reply #16 on: July 17, 2007, 10:11:55 AM »
.....this is why I quit fooling with dimensions along time ago.....
ummmm... what do you use instead??

CADaver

  • Guest
Re: Modifying dimension style attributes
« Reply #17 on: July 17, 2007, 10:24:15 AM »
hmmm... I step through each dimstyle, setting it current, changing the dimclrt, saving it, works just fine for me.  No need for "update" "all", this will not update those dims that have overridden the dim text color, however.

"Dim1 UPDATE ALL" does exactly what it is meant to do, make all the dimensions match the current settings.  If that's NOT what you wish to do then don't use that.

As far as I can see it's all working as it should.

zibidi

  • Guest
Re: Modifying dimension style attributes
« Reply #18 on: July 17, 2007, 12:01:39 PM »
Quote
hmmm... I step through each dimstyle, setting it current, changing the dimclrt, saving it, works just fine for me.
So if you have 30 dwgs and each drawing has 10 or more dimension styles, you don't mind clicking around 1500 times to make the changes?  :-o

Quote
"Dim1 UPDATE ALL" does exactly what it is meant to do, make all the dimensions match the current settings.  If that's NOT what you wish to do then don't use that.
Ok, you are the 3rd or 4th person who tells me that I am not using the correct command, thank you I appreciate that, now that I have got the point could we move a step forward?  So what's the function/command that redraws the dimensions according to the dxf definition? That's what I am looking for.

Quote
As far as I can see it's all working as it should.
Here are screenshots showing the trouble:

One this first one you see, that the dimension I have highlighted uses the ISONORM00 dimension style:


And on this one which is the DXF definition for ISONORM00, you can see that the DXF code #178 (the one in charge of DIMCLRT which is the text color) is set to 7 which is white. And you can clearly see that the text is still yellow unless you are color blinded or that I myself have troubles in seeing colors.


So as the dimension styles have got their attribute changed, how do I make autocad apply these changes? Yeah I know, no more DIM1 "update", so what else?

When using entmod to update the radius of a circle for instance, autocad redraws the circle immediately with no fuss, I have programmed it and tested it successfully.  ;-)
« Last Edit: July 17, 2007, 12:07:12 PM by zibidi »

CADaver

  • Guest
Re: Modifying dimension style attributes
« Reply #19 on: July 17, 2007, 01:08:06 PM »
Quote
hmmm... I step through each dimstyle, setting it current, changing the dimclrt, saving it, works just fine for me.
So if you have 30 dwgs and each drawing has 10 or more dimension styles, you don't mind clicking around 1500 times to make the changes?  :-o
First off I do the proper setup to begin with, secondly this works just fine in lisp

Quote
"Dim1 UPDATE ALL" does exactly what it is meant to do, make all the dimensions match the current settings.  If that's NOT what you wish to do then don't use that.
Ok, you are the 3rd or 4th person who tells me that I am not using the correct command, thank you I appreciate that, now that I have got the point could we move a step forward?  So what's the function/command that redraws the dimensions according to the dxf definition? That's what I am looking for.
Ya know, you can either lose the attitude or get lost, I personally don't care which.  If you want help, there are plenty around here that will, if you just want to pop-off, go to the adesk boards.

Once the dimstyle is saved there is no need in revising the dxf definition, no need for entmod.  That is unless you've, for some reason, already overidden the color of indivdual dims.

zibidi

  • Guest
Re: Modifying dimension style attributes
« Reply #20 on: July 17, 2007, 03:04:54 PM »
What's up CADaver,

I really love your sense of humor, it's kinda special to grasp at first, but it sure is cool.  8-)

Your second post was much more clear than the first one, and you have put me on a new track to explore.

By the way, in general is it a good practice to modify entities by accessing their DXF data or is it better to use as much autocad commands as possible? I suspect the latter to be the correct answer.

Here is my new proposal, I did it by typing it by hand in the command line:
Code: [Select]
-dimstyle
restore
name-of-the-dimstyle
(setvar "dimclrt" 7)
-dimstyle
save
name-of-the-dimstyle
yes
If I get your approval I can now edit my code and make it loop through this snippet and that would mean that it all works great!  :-)
« Last Edit: July 17, 2007, 03:16:25 PM by zibidi »

CADaver

  • Guest
Re: Modifying dimension style attributes
« Reply #21 on: July 17, 2007, 03:23:05 PM »
By the way, in general is it a good practice to modify entities by accessing their DXF data or is it better to use as much autocad commands as possible? I suspect the latter to be the correct answer.
Depends on what you're doing.  Most programers would probably prefer manipulating the element without calling the command.  In this case I'd use tblnext to step through each dimstyle making whatever changes needed through a while loop and cons.

If you have access to the old ddmodify.lsp function there is an excellent example of using tblnext "dimstyle" as I've indicated above.

Then again some "real" code guru like Charles or Michael or any of a dozen guys here can explain it better than I.

deegeecees

  • Guest
Re: Modifying dimension style attributes
« Reply #22 on: July 17, 2007, 03:23:49 PM »
zibidi,

If you are trying to do this through coding, then it would help us help you a bit more efficiently if you were to post the code you are working on. Other than that, it is an exercise in futility to keep trying to guess at what you need. So, in light of that, here are a cuple questions to clear things up:

1. Are you trying to create an application in Lisp?

1a. (Yes from #1) Can you post the code?

1b. (No from #1) Do you need help in figuring out how to manipulate dimstyles?

zibidi

  • Guest
Re: Modifying dimension style attributes
« Reply #23 on: July 17, 2007, 03:31:58 PM »
Hu?  :? I posted the code on the previous page, here is a direct link to it if you missed it: http://www.theswamp.org/index.php?topic=17631.msg213010#msg213010

However, the approach I used in it, i.e:access the DXF data of each dimstyle, is a dead end as CADaver said. I run into so many troubles when some dimstyles have overrides.

So based on CADaver's second post, which shed the light on a new path, I have proposed a small snippet that works for a single dimstyle. If someone tells me that this is the correct way to modify the dimstyle text color, then I can go forward and to it into a loop that goes through each dimstyle, and then run it on all my drawings. All I need to know is will I run into any other trouble that I am not aware of?

PS: if you didn't see my code, probably I am not using the correct tags, tell me if I am doing anything wrong.  :-)

LE

  • Guest
Re: Modifying dimension style attributes
« Reply #24 on: July 17, 2007, 03:33:45 PM »
something like this ?

edit by me...the image is not needed anymore.
« Last Edit: July 17, 2007, 04:33:47 PM by LE »

deegeecees

  • Guest
Re: Modifying dimension style attributes
« Reply #25 on: July 17, 2007, 03:36:47 PM »
OOOoooops!

Ok, help is on the way. My apologies zibidi!

zibidi

  • Guest
Re: Modifying dimension style attributes
« Reply #26 on: July 17, 2007, 03:53:00 PM »
@LE: yep that's typically want I want to do, except that I want autolisp to do it for me, I am fed up clicking a hundred times. What did you use for the screencast? That was cool, I want to do the same! camstasia? fraps?

@deegeecees: no problem, I should have highlighted my code to me more clear.

By the way I tried a fully functional program, but for some reason it doesn't work:
Code: [Select]
(defun C:DSP (/ dimStyleIdentifier)
(setq dimStyleIdentifier (tblnext "DIMSTYLE" T)) ;get the first DIMSTYLE name and store it in dimStyleIdentifier

(while dimStyleIdentifier
(command "._DIMSTYLE" "R" dimStyleIdentifier)
(setvar "dimclrt" 7)
(command "._DIMSTYLE" "S" dimStyleIdentifier "Y")

(setq dimStyleIdentifier (tblnext "DIMSTYLE")) ;get the next dimstyle
) ;ends the while loop
) ;end the defun
It doesn't seem to be taking my dimStyleIdentifier.  :x

LE

  • Guest
Re: Modifying dimension style attributes
« Reply #27 on: July 17, 2007, 04:00:10 PM »
@LE: yep that's typically want I want to do, except that I want autolisp to do it for me, I am fed up clicking a hundred times. What did you use for the screencast? That was cool, I want to do the same! camstasia? fraps?

yes it is camtasia studio... the routine is all done in lisp... the functions can be call to simple tell autocad to the appropriate updates to the dimstyles... the routine uses an ini file, and I have my standards in there, so no need to do any clicking, just to set when needed the dimension and text styles.

zibidi

  • Guest
Re: Modifying dimension style attributes
« Reply #28 on: July 17, 2007, 04:05:08 PM »
Arghh!!

I tried this:
Code: [Select]
(defun C:DSP (/ dimStyleIdentifier)
(command "._DIMSTYLE" "restore" "08")
(setvar "dimclrt" 7)
(command "._DIMSTYLE" "save" "08" "Y")
) ;end the defun
And it works. This means my dimStyleIdentifier is not recognized. Hmm....  :-(

CADaver

  • Guest
Re: Modifying dimension style attributes
« Reply #29 on: July 17, 2007, 04:05:27 PM »
Code: [Select]
(command "._DIMSTYLE" "R" (cdr (assoc 2 dimStyleIdentifier)))