I'm having a little problem. When I exit the dialog box, I run this routine to check to see if anything has changed.
(defun EditObjectsProperties (/ NewValue OldValue)
(mapcar
'(lambda (x)
(if
(and
(/= (get_tile x) "*Error getting value!!")
(not
(equal
(setq NewValue
(cond
((= (strcase x) "LAYER")
(nth (atoi (get_tile x)) LayList)
)
((= (strcase x) "LINETYPE")
(nth (atoi (get_tile x)) LTList)
)
((= (strcase x) "STYLENAME")
(nth (atoi (get_tile x)) StyList)
)
((= (strcase x) "TEXTSTYLE")
(nth (atoi (get_tile x)) StyList)
)
(t
(get_tile x)
)
)
)
(setq OldValue (vlax-get tmpObj x))
0.001
)
)
(vlax-property-available-p tmpObj x T)
)
(if
(vl-catch-all-error-p
(vl-catch-all-apply 'vlax-put (list tmpObj x NewValue))
)
(prompt (strcat "\n Could not update property \"" x "\"!!" (vl-princ-to-string OldValue) " " (vl-princ-to-string NewValue)))
(prompt (strcat "\n---- Updated property \"" x "\""))
)
)
)
PropList
)
)
PropList = List of available properties
tmpObj = Is the object selected to be changed.
All the prompts are for error testing.
My test does not seem to work the way I think it should. He is a copy from the command line.
Command:
EDITPROPERTIES
Select object to edit properties:
---- Updated property "Color"
Could not update property "EndPoint"!!(9.73584 2.95454 0.0) (9.73584 2.95454 0.0)
---- Updated property "LinetypeScale"
---- Updated property "LineWeight"
Could not update property "Normal"!!(0.0 0.0 1.0) (0.0 0.0 1.0)
Could not update property "StartPoint"!!(3.43571 5.64089 0.0) (3.43571 5.64089 0.0)
---- Updated property "Thickness"
Could not update property "TrueColor"!!#<VLA-OBJECT IAcadAcCmColor 193188e0> #<VLA-OBJECT IAcadAcCmColor 19320220>
---- Updated property "Visible"
I didn't even change anything, but my test thinks I did. How can I code this better to have it only change (or try) items that have been changed in the dialog box?
Another question:
I'm not sure if this is possible. When the item to change is a point I'm trying to have the user be able to either select a point, or type it in. I have the code to add a pick button next to the edit box when the current point value is displayed. I know I need an action tile for the button, but is there any way to write one on the fly? I was thinking of maybe writing a lisp to a temp file, load it, then delete it, but I'm not sure if that will work. Or is there a way to just write the action tile to the command line?
Thanks for any tips, answers, anything really. The code kind of works, so if you need the code I can post the whole thing.
Tim