马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;; Field Code - Lee Mac
- ;; Returns the field expression associated with an entity
- (defun LM:fieldcode ( ent / replacefield replaceobject enx )
- (defun replacefield ( str enx / ent fld pos )
- (if (setq pos (vl-string-search "\\_FldIdx" (setq str (replaceobject str enx))))
- (progn
- (setq ent (assoc 360 enx)
- fld (entget (cdr ent))
- )
- (strcat
- (substr str 1 pos)
- (replacefield (cdr (assoc 2 fld)) fld)
- (replacefield (substr str (1+ (vl-string-search ">%" str pos))) (cdr (member ent enx)))
- )
- )
- str
- )
- )
- (defun replaceobject ( str enx / ent pos )
- (if (setq pos (vl-string-search "ObjIdx" str))
- (strcat
- (substr str 1 (+ pos 5)) " "
- (LM:ObjectID (vlax-ename->vla-object (cdr (setq ent (assoc 331 enx)))))
- (replaceobject (substr str (1+ (vl-string-search ">%" str pos))) (cdr (member ent enx)))
- )
- str
- )
- )
-
- (if
- (and
- (wcmatch (cdr (assoc 0 (setq enx (entget ent)))) "TEXT,MTEXT,ATTRIB,MULTILEADER,*DIMENSION")
- (setq enx (cdr (assoc 360 enx)))
- (setq enx (dictsearch enx "ACAD_FIELD"))
- (setq enx (dictsearch (cdr (assoc -1 enx)) "TEXT"))
- )
- (replacefield (cdr (assoc 2 enx)) enx)
- )
- )
- ;; ObjectID - Lee Mac
- ;; Returns a string containing the ObjectID of a supplied VLA-Object
- ;; Compatible with 32-bit & 64-bit systems
- (defun LM:ObjectID ( obj )
- (eval
- (list 'defun 'LM:ObjectID '( obj )
- (if
- (and
- (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
- (vlax-method-applicable-p (vla-get-utility (LM:acdoc)) 'getobjectidstring)
- )
- (list 'vla-getobjectidstring (vla-get-utility (LM:acdoc)) 'obj ':vlax-false)
- '(itoa (vla-get-objectid obj))
- )
- )
- )
- (LM:ObjectID obj)
- )
- ;; Active Document - Lee Mac
- ;; Returns the VLA Active Document Object
- (defun LM:acdoc nil
- (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
- (LM:acdoc)
- )
|