I have a bit of code which adds a dimension to the drawing. Based on some other criteria in the drawing I'd like to change the color of this dimension to red to indicate to the user there are some special considerations to be made. We thought about a note but the users prefer that the color of this dimension object be a different color.
Ok, so I add the dimension and then try to change it's color using "CHPROP" but that's not working. Can anyone offer some advice on how to change the color of a dimension? I'll be able to use (entlast) to select it. Any by doing so I get the properties of the dimension and cheat by copying it into the IDE and formatting it. I end up with this:
I believe the DXF code 67 is the color, but how would I go about setting it to "Red" given that this object will the (entlast) or I will have assigned it to something using (entlast) before moving on. In the end, if certain criteria are true, I want to change this dimension's color to "Red".
That missed the mark as well. Am I getting the syntax right in your suggestion? I'm still not very sharp on DXF codes. I was amazed at how with the first shot I was able to change the 67 value in the list, but that apparently is not for the color.
67 isn't dxf code of color (62). With Dimension, you must specify what u want to change color (text, diménsion lines, extension line, arrow .. ?), and i think u should use Visualisp in this case
Etc :
With obj = (vlax-ename->vla-object ename_of_dimension_object) = (vlax-ename->vla-object (entlast))
You can find what u need more by dump dimension object :
Ok, I think I have it. Once the dimension is in and I can call it (entlast) or anything else...... and now for the finished product. I'm still a long way off from understanding all of the vlax and vla stuff. But this is what I've put together and it's working:
You're dealing with internal Object's which do not have to be released; only external Objects (i.e., FileScriptingObject, Shell.Application, etc.) need to be released.
The Visual LISP extension Methods only work on Vla-Object (i.e., Vlax-Ename->Vla-Object, etc.), with exception to the Vlax-Curve* functions which also accept Ename as a valid argument.
The last entity added to the Database (entlast), is not always going to be your dimension... At minimum, you'll want to check that either (wcmatch (cdr (assoc 0 )) "DIM*"), or (wcmatch (strcase (vla-get-objectname )) "*DIM*"), prior to evaluating the rest of your code, IMO.
All very good points except that with my code I add the dimension and then immediately, and I mean immediately, hit the (entlast) thing. Sometimes I use (entlast) itself, other times I immediately assign (entlast) to a temp variable. Recall, that my projects for these guys are completely automated. There is no chance that a user would interrupt it or any other object be confused for (entlast). It serves me well, but only in this totally automated process can one be assured of such.