下面是一些注释代码。。。请花点时间研究一下。
- (defun c:goo (/ a c c2 i p s)
- ;; Create 'ArialBlack' Style
- (entmakex '((0 . "STYLE")
- (100 . "AcDbSymbolTableRecord")
- (100 . "AcDbTextStyleTableRecord")
- (2 . "ArialBlack")
- (70 . 0)
- (40 . 0.0)
- (41 . 1.0)
- (50 . 0.0)
- (71 . 0)
- (42 . 0.125)
- (3 . "ariblk.ttf")
- (4 . "")
- )
- )
- (defun _ps (str del / pos)
- (if (setq pos (vl-string-search del str))
- (vl-remove "" (cons (substr str 1 pos) (_ps (substr str (+ pos 1 (strlen del))) del)))
- (list str)
- )
- )
- (if (setq s (ssget '((0 . "insert") (2 . "CUSTOM_MPE_EQUIP_TYPE") (66 . 1))))
- (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
- ;; Get the block insertion point
- (setq p (cdr (assoc 10 (entget b))))
- ;; You have to look for the correct attribute tagnames to populate the correct information
- (foreach x (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
- (cond ((= "TYPE" (vla-get-tagstring x)) (setq a (vla-get-textstring x)))
- ((= "READING" (vla-get-tagstring x)) (setq c (_ps (vla-get-textstring x) "\n")))
- )
- )
- (if
- (progn (entmake
- (list '(0 . "MTEXT")
- '(100 . "AcDbEntity")
- '(67 . 0)
- '(8 . "MPE_ANNO")
- '(62 . 1)
- '(6 . "Continuous")
- '(100 . "AcDbMText")
- (cons 10 p)
- '(40 . 2.0)
- '(41 . 0.0)
- '(46 . 0.0)
- '(71 . 5)
- '(72 . 5)
- ;; Join the resultant text together
- (cons 1
- (if (and a c)
- (strcat a
- "\\P"
- (cond ((< (length c) 3) (car c))
- ((apply 'strcat
- (mapcar '(lambda (x) (strcat x "\\P"))
- (list (nth (- (length c) 2) c) (last c))
- )
- )
- )
- )
- )
- "Something is not right!"
- )
- )
- '(7 . "ArialBlack")
- '(11 1.0 0.0 0.0)
- '(50 . 0.0)
- '(73 . 1)
- '(44 . 1.0)
- )
- )
- ;; Delete the block
- (entdel b)
- )
- )
- )
- )
- (princ)
- )
- ;; Loads ActiveX extensions
- (vl-load-com)
下面是如何在论坛中添加代码标签。 |