メッセージ1/7
Xref rename issue
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- パーマリンクを表示
- 印刷
- 報告
I got some help to develop a code but i found out it doesnt do as i want some times.
It will change my name to 64CCBA.
But
It will change my path to..
.\64CCBA
It cuts out the .dwg.. Any ideas about this? So far the code saved alot of time since i run this on hundreds of files.
(Defun C:F64 ( / StringtoFind StringtoPut) (setq StringtoFind "61";(getstring "\nEnter string in Xref name: ") StringtoPut "64CCBA";(getstring "\nEnter new string here: ") );setq (vlax-for MyXref (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)));<--go through all block objects (if (and (vl-string-search (strcase StringtoFind) (strcase (vla-get-name MyXref)));<---if the name contains your string (= (vla-get-isxref MyXref) :vlax-true);<---if it's an xref ) (progn (vla-put-name myxref (vl-string-subst StringtoPut;<---Change the name (substr (vla-get-name MyXref) (1+ (vl-string-search (strcase StringtoFind) (strcase (vla-get-name MyXref)))) (strlen StringtoPut));substr (vla-get-name myxref) );string subst );vla-put-name (vla-put-path myxref (vl-string-subst StringtoPut;<---Change the Path (substr (vla-get-path MyXref) (1+ (vl-string-search (strcase StringtoFind) (strcase (vla-get-path MyXref)))) (strlen StringtoPut));substr (vla-get-path myxref) );string subst );vla-put-path (vla-reload myxref) );progn );if );vlax-for (princ) );defun