Message 1 of 28
Lisp for Attribute to text within a block

Not applicable
02-19-2018
06:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hallo everybody
I found this great lisp on internet converting attributes into text
This routine will get all the attributes in a dwg ans make them into text except for attributes inside a block.
what do i need to do for this routine to make it work with block attributes as well?
(defun c:AttDef2Text (/ ActDoc LayoutCol tmpLayoutBlk) ; Changes attdef entities (attributes that haven't been put into a block) into dtext (vl-load-com) (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object))) (vla-StartUndoMark ActDoc) (setq LayoutCol (vla-get-Layouts ActDoc)) (vlax-for LayoutObj LayoutCol (setq tmpLayoutBlk (vla-get-Block LayoutObj)) (vlax-for Obj tmpLayoutBlk (if (= (vla-get-ObjectName Obj) "AcDbAttributeDefinition") (progn (setq TextObj (vla-AddText tmpLayoutBlk (vla-get-textString Obj) (vla-get-InsertionPoint Obj) (vla-get-Height Obj))) (vla-put-Alignment TextObj (vla-get-Alignment Obj)) (if (/= (vla-get-Alignment TextObj) 0) (vla-put-TextAlignmentPoint TextObj (vla-get-TextAlignmentPoint Obj)) ) (vla-put-Backward TextObj (vla-get-Backward Obj)) (vla-put-Layer TextObj (vla-get-Layer Obj)) (vla-put-Normal TextObj (vla-get-Normal Obj)) (vla-put-ObliqueAngle TextObj (vla-get-ObliqueAngle Obj)) (vla-put-Rotation TextObj (vla-get-Rotation Obj)) (vla-put-ScaleFactor TextObj (vla-get-ScaleFactor Obj)) (vla-put-StyleName TextObj (vla-get-StyleName Obj)) (vla-put-UpsideDown TextObj (vla-get-UpsideDown Obj)) (vla-Delete Obj) ) ) ) ) (vla-EndUndoMark ActDoc) (princ) )
Kind regards