我整天都在用这个http://www.cadtutor.net/forum/showthread.php?93900-VT属性amp文本编辑器RLX
但希望我有时间重写。。。
像这里的许多帖子一样,画一幅你想要完成的东西会很好 这是一个提示更改属性标记的版本。。。
(defun c:foo (/ _puttext _getclipboardtext atts opt s sel tags txt x)
;; RJP - 04.12.2018
;; Copies clipboard text to selected objects
(defun _puttext (o s)
(cond ((vlax-property-available-p o 'textstring) (vla-put-textstring o s))
((vlax-property-available-p o 'textoverride) (vla-put-textoverride o s))
((vlax-property-available-p o 'hasattributes)
(if (= 1 (length (setq atts (vlax-invoke o 'getattributes))))
(vla-put-textstring (car atts) s)
(progn (setq tags (mapcar '(lambda (x) (vla-get-tagstring x)) atts))
(setq opt (apply 'strcat (mapcar '(lambda (x) (strcat x "/")) tags)))
(initget 0 (apply 'strcat (mapcar '(lambda (x) (strcat x " ")) tags)))
(setq sel (cond ((getkword (strcat "\n[" opt "] <" (car tags) ">: ")))
((car tags))
)
)
(foreach a atts
(if (= sel (vla-get-tagstring a))
(vla-put-textstring a s)
)
)
)
)
)
)
)
;; http://www.theswamp.org/index.php?topic=35577.msg408049#msg408049
(defun _getclipboardtext (/ htmlfile result)
(setq
result (vlax-invoke
(vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'parentwindow)
'clipboarddata
)
'getdata
"Text"
)
)
(vlax-release-object htmlfile)
result
)
(cond
((null (setq txt (_getclipboardtext))) (print "Nothing in clipboard"))
((null (setq s (ssget ":L" '((0 . "insert,*text,multileader,dimension"))))) (print "Bye.."))
((foreach a (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
(_puttext a txt)
)
)
)
(princ)
)
(vl-load-com) 一如既往,我感谢你的工作。。。我尝试了两种解决方案。。。看起来更像我需要的是第二个,但我不想从键盘上指定属性,我想通过“单击”属性来确定粘贴到该属性上(并且只在该属性上)。。。有可能吗? 试试看。。。
(defun c:foo (/ _puttext _getclipboardtext atts opt s sel tags txt x)
;; RJP - 04.12.2018
;; Copies clipboard text to selected objects
(defun _puttext (o s / e)
(cond ((vlax-property-available-p o 'textstring) (vla-put-textstring o s))
((vlax-property-available-p o 'textoverride) (vla-put-textoverride o s))
((vlax-property-available-p o 'hasattributes)
(if (= 1 (length (setq atts (vlax-invoke o 'getattributes))))
(vla-put-textstring (car atts) s)
(and (setq e (car (nentsel "\nPick your attribute: ")))
(= "ATTRIB" (cdr (assoc 0 (entget e))))
(vla-put-textstring (vlax-ename->vla-object e) s)
)
)
)
)
)
;; http://www.theswamp.org/index.php?topic=35577.msg408049#msg408049
(defun _getclipboardtext (/ htmlfile result)
(setq
result (vlax-invoke
(vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'parentwindow)
'clipboarddata
)
'getdata
"Text"
)
)
(vlax-release-object htmlfile)
result
)
(cond
((null (setq txt (_getclipboardtext))) (print "Nothing in clipboard"))
((null (setq s (ssget ":L" '((0 . "insert,*text,multileader,dimension"))))) (print "Bye.."))
((foreach a (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
(_puttext a txt)
)
)
)
(princ)
)
(vl-load-com) 哦,这是(几乎)我需要的!!!我的最后一个问题是:是否可以通过单击来选择块和属性?
在块的情况下,当我使用命令时,我将直接在右侧属性上执行。。。
我为不断的要求道歉,我可能不得不更好地解释自己
页:
1
[2]