马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 newer 于 2017-12-12 00:23 编辑
问题:
Hi all
While working on a project comes instructions from the Clint to change buildings numbering (12 buildings ).
that impact on the file path in all files.
Is there a solution
Example:
CHange
V:\01.Projects\K-1502\DWG\01-AR BASE\0.1.9-BUILDINGS_09\K1502_B09_B_ALL.dwg
To
V:\01.Projects\K-1502\DWG\01-AR BASE\0.1.7-BUILDINGS_07\K1502_B07_B_ALL.dwg
Thanks in advance
===============================================================================
解决代码:
[Plain Text] 纯文本查看 复制代码
(setq txt "V:\\01.Projects\\K-1502\\DWG\\01-ARBASE\\0.1.9-BUILDINGS_09\\K1502_B09_B_ALL.dwg")
(setq txt1 (xd::string:regexpr "BUILDINGS_[0-9]+" txt "BUILDINGS_07" ""))
(setq txt2 (xd::string:regexpr "B[0-9]+" txt1 "B07" ""))
(setq txt3 (xd::string:regexpr "0.1.[0-9]+" txt2 "0.1.7" ""))
or:
1.(setq txt1 (xd::string:regexpr "(BUILDINGS_)[0-9]+" txt (strcat "$1" "07") ""))
$1 = BUILDINGS_
2.(setq txt2 (xd::string:regexpr "(B)[0-9]+" txt1 (strcat "$1" "07") ""))
$1=B
3.(setq txt3 (xd::string:regexpr "(0.1.)[0-9]+" txt2 (strcat "$1" "7") ""))
$1=0.1.
or merge 1,2:
(setq txt1 (xd::string:regexpr "(BUILDINGS_)[0-9]+|(B)[0-9]+" txt (strcat "$1" "07") ""))
or
(setq txt1 (xd::string:regexpr "(B|BUILDINGS_)[0-9]+" txt (strcat "$1" "07") ""))
(setq txt3 (xd::string:regexpr "(0.1.)[0-9]+" txt1 (strcat "$1" "7") ""))
===================
txt3 = "V:\\01.Projects\\K-1502\\DWG\\01-ARBASE\\0.1.7-BUILDINGS_07\\K1502_B07_B_ALL.dwg"
函数如下:
[PHP] 纯文本查看 复制代码
(defun _AddBuildingFloor (str floor / txt1)
(setq txt1 (xd::string:regexpr
"(B|BUILDINGS_)[0-9]+"
txt
(strcat "$1" floor)
""
)
)
(setq txt1 (xd::string:regexpr
"(0.1.)[0-9]+"
txt1
(strcat "$1" (itoa (atoi floor)))
""
)
)
)
命令: (_ADDBUILDINGFLOOR txt "07")
"V:\\01.Projects\\K-1502\\DWG\\01-ARBASE\\0.1.7-BUILDINGS_07\\K1502_B07_B_ALL.dwg"
命令: (_ADDBUILDINGFLOOR txt "12")
"V:\\01.Projects\\K-1502\\DWG\\01-ARBASE\\0.1.12-BUILDINGS_12\\K1502_B12_B_ALL.dwg"
正则表达式替换函数见开源函数库:
(XD::String:RegExpR)对字符串进行正则表达式替换
|