这可能会让你开始:
- (defun c:note (/ fpath doc spc iPt file nStr)
- (vl-load-com)
- (setq fpath "C:\" ) ;; filename of notes.txt
- (setq doc (vla-get-ActiveDocument
- (vlax-get-acad-object))
- spc (if (zerop (vla-get-activespace doc))
- (if (= (vla-get-mspace doc) :vlax-true)
- (vla-get-modelspace doc)
- (vla-get-paperspace doc))
- (vla-get-modelspace doc)))
- (cond ((not (findfile fpath))
- (princ "\n** Notes File could not be Found **"))
- ((not (setq iPt (getpoint "\nSpecify Point for Note: "))))
- (t
- (vla-StartUndomark doc)
- (setq file (open (findfile fpath) "r") nStr "")
- (while (setq nl (read-line file))
- (setq nStr (strcat nStr nl "\\P")))
- (close file)
- (vla-AddMText spc (vlax-3D-point iPt) 0 nStr)
- (vla-EndUndoMark doc)))
- (princ))
-
|