You're welcome, and I have a few little suggestions....
If you use (getangle), the User can input an angle in whatever the current angle format is, and it will return radians directly for use in (entmod) later, eliminating the need to convert anything. So you can replace
(setq ang1 (getstring "Insert Rotation Value: "))
(setq rad1 (angtof ang1))
with just
(setq rad1 (getangle "Insert Rotation Value: "))
and skip the ang1 variable altogether. AND, (getangle) *also* gives the User the option of specifying the angle by *picking two points on-screen*, such as locations in an equipment Block insertion you want to align with, so they don't need to know the numerical value at all, which would be very helpful in the case of oddly-rotated equipment.
You ought to also include ang1 [if you keep it around], rad1, and newdata in the localized variables list.
You can combine multiple (setq)'s into one function:
(setq
i (1+ i)
edata (entget (ssname cstr i))
newdata (subst (cons 50 rad1) (assoc 50 edata) edata)
); end setq
And you might want to filter at least for Block insertions:
(setq cstr (ssget '((0 . "INSERT"))))
because as you have it, any other kind of object the User happens to catch in their selection that has a rotation angle [Text or Dimensions, for example] will also be rotated, and if they grab something without a code-50 value at all, it will have a problem trying to change that. You could also filter for particular block names. For instance, if all your Caster blocks have names starting with "Caster", you could do a wildcard filter like this:
(setq cstr (ssget '((0 . "INSERT") (2 . "Caster*"))))
and then the User could save time by just grabbing a *whole area* with a Window or Crossing selection, and it will "find" only those Caster Blocks -- even if there are other kinds of Blocks [or Text, or whatever] in there, it won't change their rotations.
--
Kent Cooper
Kent Cooper, AIA