Try this:
- (defun c:setprofile ( / lst prf prn ) (setq prn "Engineering" prf (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) ) (vla-getallprofilenames prf 'lst) (setq lst (vlax-safearray->list lst)) (if (member prn lst) (vla-put-activeprofile prf prn) (progn (vla-copyprofile prf (getvar 'cprofile) prn) (vla-put-activeprofile prf prn) ) ) (princ))(vl-load-com) (princ)
I wouldn't assume that the current profile will always be first in the list returned by the getallprofilenames method. |