您的警报缺少 ( infront.also (length) 使其查找该名称的函数并导致错误“没有函数定义:” 如果您尝试这样做(警报长度),它仍然会出错,因为该变量是一个数字,您需要使用 rtos 将其转换为字符串。 - (defun c:TL ( / selnew selAll len)
- (vl-load-com)
- (setq selnew (ssadd))
- (setq len 0)
- (if (setq selAll (ssget "_X" '((0 . "ACPP*"))))
- (foreach ent (mapcar 'cadr (ssnamex selAll))
- (setq vlaObj (vlax-ename->vla-object ent))
- (if (vlax-property-available-p vlaObj 'CutLength)
- (progn
- (setq len (+ (vlax-get-property vlaObj 'CutLength) len))
- (ssadd ent selnew)
- )
- )
-
- )
- )
- (sssetfirst nil selnew)
- (if (> len 0)
- (alert (strcat "Total Length: " (rtos len 2 3)))
- )
- (princ)
- )
|