本帖最后由 llsheng_73 于 2025-1-16 09:06 编辑
- (defun getatts(blk)
- (if(equal(VL-CATCH-ALL-APPLY'vlax-get-property(list(setq blk(if(=(type blk)'ename)(vlax-ename->vla-object blk)blk))'HasAttributes)):vlax-true)
- (mapcar(function(lambda(x)(list(vlax-get-property x'TagString)(vlax-get-property x'TextString)x)))(vlax-safearray->list(vlax-variant-value(vlax-invoke-method blk'GetAttributes))))))
- (defun s2e(s / n lst)(if(=(type s)'pickset)(repeat(setq n(sslength s))(setq n(1- n)lst(cons(ssname s n)lst)))))
(apply'+(mapcar'(lambda(x)(read(VL-STRING-TRANSLATE"m"" "(cadr(assoc"长度"(getatts x))))))(s2e(ssget'((0 . "insert")(2 . "*长度标注")))))) |