ljpnb
发表于 2024-10-13 14:22:26
惜惜2 发表于 2024-10-10 10:19
ljpnb 发表于 2024-10-7 17:34
是的,先取值
平时很少用到属性块,也学习了一下
(setq e3-length (length E3))这时的length不对,应该是(setq e3-length (strlen E3))
(setq E4 (strcat (substr E3 0 4) "-" (substr E3 4 2) "-" (substr E3 6 2)))中的(substr E3 0 4)应该是(substr E3 1 4),从1开始
惜惜2
发表于 2024-10-14 17:05:30
ljpnb 发表于 2024-10-13 14:22
(setq e3-length (length E3))这时的length不对,应该是(setq e3-length (strlen E3))
(setq E4 (strc ...
感谢
xyp1964
发表于 2024-10-14 21:52:24
(defun c:tt ()
(setq dn (vl-filename-base (getvar "dwgname")))
(if (setq nn (vl-string-search " " dn))
(progn
(setq aa (substr dn 1 nn))
(setq bb (substr dn (+ nn 2)))
(setq ss (ssget "x" '((0 . "INSERT") (66 . 1))))
(repeat (setq n (sslength ss))
(setq s1 (ssname ss (setq n (1- n))))
(foreach a (reverse (xyp-Att2list s1))
(setq ts (cadr a)
b(car a)
)
(cond ((= ts "客户图号") (xyp-SubUpd b 1 aa))
((= ts "零件名称") (xyp-SubUpd b 1 bb))
((= ts "设计日期") (xyp-SubUpd b 1 (menucmd "m=$(edtime,$(getvar,DATE),yyyy-mo-dd)")))
((= ts "产品编码") (setq e1 (last a)))
((= ts "客户") (xyp-SubUpd b 1 (substr E1 2 3)))
)
)
)
)
)
(princ)
)
惜惜2
发表于 2024-10-15 09:02:19
xyp1964 发表于 2024-10-14 21:52
感谢版主大大更新的方法