马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×

- ;; Begin code
- ;; Written by Lee Ambrosius (lee_ambrosius@hyperpics.com)
- ;; HyperPics LLC ([url]http://www.hyperpics.com[/url])
- ;; Created on: 5/12/2005
- ;; AutoCAD Release: 2006
- ;; This program allows you to lock the position of an Attribute.
- ;; Sets the Lock Position behavior
- (defun c:SetAttLock ()
- (setLockPosition
- (car
- (entsel
- "\nSelect Attribute Definition to set Lock Position: "
- )
- )
- '("AcDbAttr" (1070 . 0) (1070 . 1))
- )
- )
- ;; Removes the Lock Position behavior
- (defun c:RemoveAttLock ()
- (setLockPosition
- (car
- (entsel
- "\nSelect Attribute Definition to remove Lock Position: "
- )
- )
- '("AcDbAttr" (1070 . 0) (1070 . 0))
- )
- )
- ;; Example (setLockPosition entityName '("AcDbAttr" (1070 . 0) (1070 . 1))))
- (defun setLockPosition (entityName lstValue / entData)
- (if (/= entityName nil)
- (progn
- (setq entData (entget entityName '("AcDbAttr")))
- (if (= (cdr (assoc 0 entData)) "ATTDEF")
- (progn
- (if (/= (assoc -3 entData) nil)
- (if (= (nth 0 (cadr (assoc -3 entData))) "AcDbAttr")
- (setq entData (subst (cons -3 (list lstValue))
- (assoc -3 entData)
- entData
- )
- )
- (setq entData (append entData (list (list -3 lstValue))))
- )
- (setq entData (append entData (list (list -3 lstValue))))
- )
- (entmod entData)
- )
- )
- )
- )
- (princ)
- )
- ;; End code
|