bijoyvm Posted September 13, 2011 Posted September 13, 2011 hi, Please let me know how to create annotative blocks by using entmake function. (defun c:crb ( ) (if (not (tblsearch "BLOCK" "CRBLK")) (progn (if (not (tblsearch "STYLE" "Gen-Text")) (entmake (list (cons 0 "STYLE") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbTextStyleTableRecord") (cons 2 "Gen-Text") (cons 70 0) (cons 40 2.5) (cons 3 "Arial.ttf") ) ) ) (entmake (list (cons 0 "BLOCK") (cons 8 "0") (cons 370 0) (cons 2 "CRBLK") (cons 70 2) (list 10 0.0 0.0 0.0) ) ) (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 370 0) (list 10 0.0 0.0 0.0) (cons 40 1.25) ) ) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 370 0) (cons 7 "Gen-Text") (list 10 3.0 0.0 0.0) (list 11 3.0 0.0 0.0) (cons 40 2.5) (cons 1 "00") (cons 3 "Number") (cons 2 "NO") (cons 70 0) (cons 72 0) (cons 74 2) ) ) (entmake (list (cons 0 "ENDBLK") (cons 8 "0") ) ) ( (lambda ( lst ) (regapp "ACAD") (entmod (append (subst (cons 70 1) (assoc 70 lst) lst) (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) ) ) ) ) ) (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK"))))) ) ) ) (princ) ) Quote
David Bethel Posted September 13, 2011 Posted September 13, 2011 You got half of it correct in creating the BLOCK first. The other half is creating the INSERT entity: (entmake (list (cons 0 "INSERT") (cons 8 "0") (cons 66 1) (cons 2 "CP") (cons 10 (list 0 0 0)) (cons 41 1) (cons 42 1) (cons 50 0) (cons 43 1) (cons 70 0) (cons 71 0) (cons 44 0) (cons 45 0) (cons 210 (list 0 0 1)) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "ATTRIB") (cons 8 "0") (cons 10 (list 0 0 0)) (cons 40 1) (cons 1 "TESTING 123") (cons 2 "TAGNAME") (cons 70 0) (cons 73 0) (cons 50 0) (cons 41 1) (cons 51 0) (cons 7 "STANDARD") (cons 71 0) (cons 72 0) (cons 11 (list 0 0 0)) (cons 210 (list 0 0 1)) (cons 74 0) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "SEQEND") (cons 8 "0"))) The xdata could be included in the INSERT header definition or attached afterwards. -David Quote
Lee Mac Posted September 13, 2011 Posted September 13, 2011 The xdata could be included in the INSERT header definition or attached afterwards. -David The xData is to change the InsUnits of the Block Definition, refer: http://www.cadtutor.net/forum/showthread.php?62333-How-to-disable-attribute-quot-LOCK-POSITION-quot-while-creating-Lisp&p=425282&viewfull=1#post425282 Quote
bijoyvm Posted September 13, 2011 Author Posted September 13, 2011 hi mr Lee help me to create the above block, now I need that block with ANNOTATION, I dont know which code I need to change for that. I tried the Insert but still it is not creating an annotation block. thanks & regards Bijoy Quote
Lee Mac Posted September 13, 2011 Posted September 13, 2011 Unfortunately I have no experience with Annotative objects Bijoy. Quote
bijoyvm Posted September 14, 2011 Author Posted September 14, 2011 :( Lee, Annotation is the one of the most powerfull tool in AutoCAD, You should try that.. If you get an idea about Annotation then you will not do drawings without Annotation. please check this link may be it will help you http://cadlispandtips.blogspot.com/2010/11/annotation-simple-introduction.html Quote
pBe Posted September 14, 2011 Posted September 14, 2011 :( Lee, Annotation is the one of the most powerfull tool in AutoCAD Annotative Objects that is. Quote
bijoyvm Posted September 14, 2011 Author Posted September 14, 2011 hi pBe, did you know how to create annotative blocks by lisp? If anyone know please help me... Quote
pBe Posted September 14, 2011 Posted September 14, 2011 Lisp, not really. but it is as easy as using command "Block" and converting it to annotative. so i dont really bother with a lisp code for that. if we look hard enough i think we'll find it. Quote
Lee Mac Posted September 14, 2011 Posted September 14, 2011 After a little reverse engineering & guesswork... (defun c:crb ( ) ;;===============================================;; ;; Example by Lee Mac 2011 - www.lee-mac.com ;; ;;===============================================;; (if (not (tblsearch "BLOCK" "CRBLK")) (progn (if (not (tblsearch "STYLE" "Gen-Text")) (entmake (list (cons 0 "STYLE") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbTextStyleTableRecord") (cons 2 "Gen-Text") (cons 70 0) (cons 40 2.5) (cons 3 "Arial.ttf") ) ) ) (entmake (list (cons 0 "BLOCK") (cons 8 "0") (cons 370 0) (cons 2 "CRBLK") (cons 70 2) (list 10 0.0 0.0 0.0) ) ) (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 370 0) (list 10 0.0 0.0 0.0) (cons 40 1.25) ) ) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 370 0) (cons 7 "Gen-Text") (list 10 3.0 0.0 0.0) (list 11 3.0 0.0 0.0) (cons 40 2.5) (cons 1 "00") (cons 3 "Number") (cons 2 "NO") (cons 70 0) (cons 72 0) (cons 74 2) ) ) (entmake (list (cons 0 "ENDBLK") (cons 8 "0") ) ) ( (lambda ( lst ) (regapp "ACAD") (regapp "AcadAnnotative") (entmod (append (subst (cons 70 1) (assoc 70 lst) lst) (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) (list "AcadAnnotative" (cons 1000 "AnnotativeData") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) ) ) ) ) ) (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK"))))) ) ) ) (princ) ) Quote
pBe Posted September 14, 2011 Posted September 14, 2011 and Viola!!! There you have it... even before i even started looking. Good work Lee. Quote
bijoyvm Posted September 14, 2011 Author Posted September 14, 2011 Thank you so much lee... your reverse engineering is working perfect. :D:D thanks again bijoy Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.