structo Posted November 16, 2017 Posted November 16, 2017 (edited) Hi friends, i need automatic grid labeling by selecting all lines. please have a look at my sample format of drawing. Thank you all lines.dwg Edited November 17, 2017 by structo Quote
ronjonp Posted November 16, 2017 Posted November 16, 2017 (edited) I'm feeling generous today so: *I've created an attributed block rather than inserting separate text & circle. (defun c:foo (/ _dxf _layout a b c d i n o p2 s sp x) ;; RJP - 11.16.2017 (defun _layout (name / o) (if (and (setq o (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_LAYOUT")))) (setq o (cdr (assoc -1 (dictsearch o name)))) ) (vla-get-block (vlax-ename->vla-object o)) ) ) (defun _dxf (code ename) (cond (ename (cdr (assoc code (entget ename)))))) ;; This checks for metric drawings ( assuming it's set correctly ) (if (= 0 (getvar 'measurement)) (setq c 18. d 18. n "rjpbubble" ) (setq c 0.24 d 0.2 n "rjpbubble_metric" ) ) (if (null (tblobjname "block" n)) (progn (entmake (list '(0 . "BLOCK") '(100 . "AcDbEntity") '(67 . 0) '(8 . "0") '(100 . "AcDbBlockReference") '(66 . 1) (cons 2 n) '(10 0. 0. 0.) '(70 . 2) ) ) (entmake (list '(0 . "CIRCLE") '(100 . "AcDbEntity") '(67 . 0) '(62 . 53) '(8 . "grid-circle") '(100 . "AcDbCircle") '(10 0. 0. 0.) ;; This is the radius (cons 40 c) ) ) (entmake (list '(0 . "ATTDEF") '(100 . "AcDbEntity") '(67 . 0) '(62 . 121) '(8 . "Grid Text") '(100 . "AcDbText") '(10 -6.9925 -9. 0.) ;; Text height (cons 40 d) '(1 . "-") '(50 . 0.) '(41 . 1.) '(51 . 0.) (cons 7 (if (tblsearch "style" "LA-grid") "LA-grid" "Standard" ) ) '(71 . 0) '(72 . 1) '(11 0. 0. 0.) '(100 . "AcDbAttributeDefinition") '(280 . 0) '(3 . "Number") '(2 . "#") '(70 . 0) '(73 . 0) '(74 . 2) '(280 . 1) ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) ) ) (if (tblobjname "block" n) (if (and (setq s (ssget '((0 . "line")))) (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq sp (_layout (_dxf 410 (car s)))) (setq s (apply 'append (mapcar '(lambda (x) (list (_dxf 10 x) (_dxf 11 x))) s))) (setq a (apply 'min (mapcar 'car s))) (setq b (apply 'max (mapcar 'cadr s))) ) (progn (setq i 0) (foreach p (vl-sort (vl-remove-if-not '(lambda (x) (equal a (car x) 1e-) s) '(lambda (a b) (> (cadr a) (cadr b))) ) (setq p2 (vlax-3d-point (list (- (car p) c) (cadr p) (caddr p)))) (if (and (setq o (vla-insertblock sp p2 n 1 1 1 0)) (setq o (vlax-invoke o 'getattributes)) ) (vla-put-textstring (car o) (itoa (setq i (1+ i)))) ) ) (setq i 64) (foreach p (vl-sort (vl-remove-if-not '(lambda (x) (equal b (cadr x) 1e-) s) '(lambda (a b) (< (car a) (car b))) ) (setq p2 (vlax-3d-point (list (car p) (+ c (cadr p)) (caddr p)))) (if (and (setq o (vla-insertblock sp p2 n 1 1 1 0)) (setq o (vlax-invoke o 'getattributes)) ) (vla-put-textstring (car o) (if (= 91 (1+ i)) (chr (setq i 65)) (chr (setq i (1+ i))) ) ) ) ) ) ) (print "Block could not be created .. bye...") ) (princ) ) (vl-load-com) Edited November 17, 2017 by ronjonp Quote
Grrr Posted November 16, 2017 Posted November 16, 2017 BTW your entmaking BLOCK reminded me that I wanted to finish a generic entmake INSERT, so here it is: [color=#8b4513]; [b][color=BLACK]([/color][/b]VanillaINSERT [b][color=FUCHSIA]([/color][/b]getpoint[b][color=FUCHSIA])[/color][/b] [color=#2f4f4f]"VLD_Tag"[/color] [b][color=FUCHSIA]([/color][/b]getvar 'ctab[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b][/color] [b][color=BLACK]([/color][/b]defun VanillaINSERT [b][color=FUCHSIA]([/color][/b] p nm spc / GetBlkAttDefProps atts r [b][color=FUCHSIA])[/color][/b] [color=#8b4513]; '[b][color=FUCHSIA]([/color][/b]87 114 105 116 116 101 110 32 66 121 32 71 114 114 114[b][color=FUCHSIA])[/color][/b][/color] [b][color=FUCHSIA]([/color][/b]setq GetBlkAttDefProps [b][color=NAVY]([/color][/b]lambda [b][color=MAROON]([/color][/b] bnm / e enx typ L [b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]setq e [b][color=BLUE]([/color][/b]tblobjname [color=#2f4f4f]"BLOCK"[/color] bnm[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]= 2 [b][color=BLUE]([/color][/b]logand 2 [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 70 [b][color=TEAL]([/color][/b]setq enx [b][color=OLIVE]([/color][/b]entget e[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq e [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc -2 enx[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]while [b][color=BLUE]([/color][/b]and e [b][color=RED]([/color][/b]setq enx [b][color=PURPLE]([/color][/b]entget e[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]/= [color=#2f4f4f]"SEQEND"[/color] [b][color=PURPLE]([/color][/b]setq typ [b][color=TEAL]([/color][/b]cdr [b][color=OLIVE]([/color][/b]assoc 0 enx[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]= [color=#2f4f4f]"ATTDEF"[/color] typ[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setq L [b][color=PURPLE]([/color][/b]cons [b][color=TEAL]([/color][/b]vl-remove-if-not [b][color=OLIVE]([/color][/b]function [b][color=GRAY]([/color][/b]lambda [b][color=AQUA]([/color][/b]x[b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]member [b][color=LIME]([/color][/b]car x[b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b]1 2 3 7 10 11 40[b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] enx[b][color=TEAL])[/color][/b] L[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq e [b][color=RED]([/color][/b]entnext e[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=GREEN])[/color][/b][color=#8b4513]; while[/color] [b][color=MAROON])[/color][/b][color=#8b4513]; and[/color] [b][color=MAROON]([/color][/b]reverse L[b][color=MAROON])[/color][/b] [b][color=NAVY])[/color][/b][color=#8b4513]; lambda[/color] [b][color=FUCHSIA])[/color][/b][color=#8b4513]; setq GetBlkAttDefProps[/color] [b][color=FUCHSIA]([/color][/b]cond [b][color=NAVY]([/color][/b] [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] nm[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq atts [b][color=GREEN]([/color][/b]GetBlkAttDefProps nm[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]setq r [b][color=BLUE]([/color][/b]mapcar 'entmake [b][color=RED]([/color][/b]append [b][color=PURPLE]([/color][/b]list [b][color=TEAL]([/color][/b]append '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]0 . [color=#2f4f4f]"INSERT"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]67 . 0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 410 spc[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 8 [b][color=AQUA]([/color][/b]getvar 'clayer[b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbBlockReference"[/color][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 66 [b][color=AQUA]([/color][/b]if atts 1 0[b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b] [b][color=GRAY]([/color][/b]cons 2 nm[b][color=GRAY])[/color][/b] [b][color=GRAY]([/color][/b]cons 10 p[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]41 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]42 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]43 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]50 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]70 . 0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]71 . 0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]44 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]45 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]210 0.0 0.0 1.0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=TEAL])[/color][/b][color=#8b4513]; append[/color] [b][color=PURPLE])[/color][/b][color=#8b4513]; list[/color] [b][color=PURPLE]([/color][/b]if atts [b][color=TEAL]([/color][/b]mapcar [b][color=OLIVE]([/color][/b]function [b][color=GRAY]([/color][/b]lambda [b][color=AQUA]([/color][/b]x / pt10 pt11 [b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]setq pt10 [b][color=LIME]([/color][/b]mapcar '+ p [b][color=SILVER]([/color][/b]cdr [b][color=YELLOW]([/color][/b]assoc 10 x[b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]setq pt11 [b][color=LIME]([/color][/b]mapcar '+ p [b][color=SILVER]([/color][/b]cdr [b][color=YELLOW]([/color][/b]assoc 11 x[b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]append '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]0 . [color=#2f4f4f]"ATTRIB"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]67 . 0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 410 spc[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]8 . [color=#2f4f4f]"0"[/color][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbText"[/color][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 10 pt10[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 40 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 1 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]50 . 0.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]41 . 1.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]51 . 0.0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 7 [b][color=YELLOW]([/color][/b]cond [b][color=WHITE]([/color][/b][b][color=BLACK]([/color][/b]cdr [b][color=FUCHSIA]([/color][/b]assoc 7 x[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b][b][color=WHITE])[/color][/b] [b][color=WHITE]([/color][/b][color=#2f4f4f]"Standard"[/color][b][color=WHITE])[/color][/b][b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]71 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]72 . 1[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 11 pt11[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]210 0.0 0.0 1.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbAttribute"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]280 . 0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 2 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]70 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]73 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]74 . 2[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]280 . 1[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=AQUA])[/color][/b][color=#8b4513]; append[/color] [b][color=GRAY])[/color][/b][color=#8b4513]; lambda [b][color=GRAY]([/color][/b]x[b][color=GRAY])[/color][/b][/color] [b][color=OLIVE])[/color][/b][color=#8b4513]; function[/color] atts [b][color=TEAL])[/color][/b][color=#8b4513]; mapcar[/color] [b][color=PURPLE])[/color][/b][color=#8b4513]; if atts[/color] [b][color=PURPLE]([/color][/b]list [b][color=TEAL]([/color][/b]append '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]0 . [color=#2f4f4f]"SEQEND"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]67 . 0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 410 spc[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]8 . [color=#2f4f4f]"0"[/color][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=RED])[/color][/b][color=#8b4513]; append[/color] [b][color=BLUE])[/color][/b][color=#8b4513]; mapcar[/color] [b][color=GREEN])[/color][/b][color=#8b4513]; setq r[/color] [b][color=GREEN]([/color][/b] [b][color=BLUE]([/color][/b]lambda [b][color=RED]([/color][/b] c / [b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setvar 'cmdecho 0[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]if acet-attsync [b][color=PURPLE]([/color][/b]acet-attsync nm[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]vl-cmdf [color=#2f4f4f]"_.ATTSYNC"[/color] [color=#2f4f4f]"_N"[/color] nm[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setvar 'cmdecho c[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]getvar 'cmdecho[b][color=BLUE])[/color][/b] [b][color=GREEN])[/color][/b] [b][color=MAROON])[/color][/b][color=#8b4513]; if[/color] r [b][color=NAVY])[/color][/b][color=#8b4513]; [b][color=NAVY]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] nm[b][color=NAVY])[/color][/b][/color] [b][color=FUCHSIA])[/color][/b][color=#8b4513]; cond[/color] [b][color=BLACK])[/color][/b][color=#8b4513]; defun VanillaINSERT[/color] Might be handy for the guys without activex. Quote
devitg Posted November 17, 2017 Posted November 17, 2017 The OP dwg , has 2 lines at the upper horizontal line Quote
structo Posted November 17, 2017 Author Posted November 17, 2017 I'm feeling generous today so:*I've created an attributed block rather than inserting separate text & circle. very Nice stuff ronjonp. Thankyou for preparing. small doubt, if i change circle radius to "0.24" and text height to "0.2" (For "meters units" drawing) how to edit your code? please guide me:) Thank you!! Quote
structo Posted November 17, 2017 Author Posted November 17, 2017 BTW your entmaking BLOCK reminded me that I wanted to finish a generic entmake INSERT, so here it is: Might be handy for the guys without activex. Hi Grrr friend...thank you for making. how to use your code? what is the command to operate? sorry for asking:) Thank you!! Quote
structo Posted November 17, 2017 Author Posted November 17, 2017 The OP dwg , has 2 lines at the upper horizontal line Yeah!! sorry for that..corrected file uploaded Quote
ronjonp Posted November 17, 2017 Posted November 17, 2017 BTW your entmaking BLOCK reminded me that I wanted to finish a generic entmake INSERT, so here it is: [color=#8b4513]; [b][color=BLACK]([/color][/b]VanillaINSERT [b][color=FUCHSIA]([/color][/b]getpoint[b][color=FUCHSIA])[/color][/b] [color=#2f4f4f]"VLD_Tag"[/color] [b][color=FUCHSIA]([/color][/b]getvar 'ctab[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b][/color] [b][color=BLACK]([/color][/b]defun VanillaINSERT [b][color=FUCHSIA]([/color][/b] p nm spc / GetBlkAttDefProps atts r [b][color=FUCHSIA])[/color][/b] [color=#8b4513]; '[b][color=FUCHSIA]([/color][/b]87 114 105 116 116 101 110 32 66 121 32 71 114 114 114[b][color=FUCHSIA])[/color][/b][/color] [b][color=FUCHSIA]([/color][/b]setq GetBlkAttDefProps [b][color=NAVY]([/color][/b]lambda [b][color=MAROON]([/color][/b] bnm / e enx typ L [b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]setq e [b][color=BLUE]([/color][/b]tblobjname [color=#2f4f4f]"BLOCK"[/color] bnm[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]= 2 [b][color=BLUE]([/color][/b]logand 2 [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 70 [b][color=TEAL]([/color][/b]setq enx [b][color=OLIVE]([/color][/b]entget e[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq e [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc -2 enx[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]while [b][color=BLUE]([/color][/b]and e [b][color=RED]([/color][/b]setq enx [b][color=PURPLE]([/color][/b]entget e[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]/= [color=#2f4f4f]"SEQEND"[/color] [b][color=PURPLE]([/color][/b]setq typ [b][color=TEAL]([/color][/b]cdr [b][color=OLIVE]([/color][/b]assoc 0 enx[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]= [color=#2f4f4f]"ATTDEF"[/color] typ[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setq L [b][color=PURPLE]([/color][/b]cons [b][color=TEAL]([/color][/b]vl-remove-if-not [b][color=OLIVE]([/color][/b]function [b][color=GRAY]([/color][/b]lambda [b][color=AQUA]([/color][/b]x[b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]member [b][color=LIME]([/color][/b]car x[b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b]1 2 3 7 10 11 40[b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] enx[b][color=TEAL])[/color][/b] L[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq e [b][color=RED]([/color][/b]entnext e[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=GREEN])[/color][/b][color=#8b4513]; while[/color] [b][color=MAROON])[/color][/b][color=#8b4513]; and[/color] [b][color=MAROON]([/color][/b]reverse L[b][color=MAROON])[/color][/b] [b][color=NAVY])[/color][/b][color=#8b4513]; lambda[/color] [b][color=FUCHSIA])[/color][/b][color=#8b4513]; setq GetBlkAttDefProps[/color] [b][color=FUCHSIA]([/color][/b]cond [b][color=NAVY]([/color][/b] [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] nm[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq atts [b][color=GREEN]([/color][/b]GetBlkAttDefProps nm[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]setq r [b][color=BLUE]([/color][/b]mapcar 'entmake [b][color=RED]([/color][/b]append [b][color=PURPLE]([/color][/b]list [b][color=TEAL]([/color][/b]append '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]0 . [color=#2f4f4f]"INSERT"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]67 . 0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 410 spc[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 8 [b][color=AQUA]([/color][/b]getvar 'clayer[b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbBlockReference"[/color][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 66 [b][color=AQUA]([/color][/b]if atts 1 0[b][color=AQUA])[/color][/b][b][color=GRAY])[/color][/b] [b][color=GRAY]([/color][/b]cons 2 nm[b][color=GRAY])[/color][/b] [b][color=GRAY]([/color][/b]cons 10 p[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]41 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]42 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]43 . 1.[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]50 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]70 . 0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]71 . 0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]44 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]45 . 0.0[b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]210 0.0 0.0 1.0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=TEAL])[/color][/b][color=#8b4513]; append[/color] [b][color=PURPLE])[/color][/b][color=#8b4513]; list[/color] [b][color=PURPLE]([/color][/b]if atts [b][color=TEAL]([/color][/b]mapcar [b][color=OLIVE]([/color][/b]function [b][color=GRAY]([/color][/b]lambda [b][color=AQUA]([/color][/b]x / pt10 pt11 [b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]setq pt10 [b][color=LIME]([/color][/b]mapcar '+ p [b][color=SILVER]([/color][/b]cdr [b][color=YELLOW]([/color][/b]assoc 10 x[b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]setq pt11 [b][color=LIME]([/color][/b]mapcar '+ p [b][color=SILVER]([/color][/b]cdr [b][color=YELLOW]([/color][/b]assoc 11 x[b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b][b][color=AQUA])[/color][/b] [b][color=AQUA]([/color][/b]append '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]0 . [color=#2f4f4f]"ATTRIB"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]67 . 0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 410 spc[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]8 . [color=#2f4f4f]"0"[/color][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbText"[/color][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 10 pt10[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 40 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 1 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]50 . 0.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]41 . 1.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]51 . 0.0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 7 [b][color=YELLOW]([/color][/b]cond [b][color=WHITE]([/color][/b][b][color=BLACK]([/color][/b]cdr [b][color=FUCHSIA]([/color][/b]assoc 7 x[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b][b][color=WHITE])[/color][/b] [b][color=WHITE]([/color][/b][color=#2f4f4f]"Standard"[/color][b][color=WHITE])[/color][/b][b][color=YELLOW])[/color][/b][b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]71 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]72 . 1[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]cons 11 pt11[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]210 0.0 0.0 1.0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]100 . [color=#2f4f4f]"AcDbAttribute"[/color][b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]280 . 0[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=LIME]([/color][/b]list [b][color=SILVER]([/color][/b]assoc 2 x[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] '[b][color=LIME]([/color][/b][b][color=SILVER]([/color][/b]70 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]73 . 0[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]74 . 2[b][color=SILVER])[/color][/b][b][color=SILVER]([/color][/b]280 . 1[b][color=SILVER])[/color][/b][b][color=LIME])[/color][/b] [b][color=AQUA])[/color][/b][color=#8b4513]; append[/color] [b][color=GRAY])[/color][/b][color=#8b4513]; lambda [b][color=GRAY]([/color][/b]x[b][color=GRAY])[/color][/b][/color] [b][color=OLIVE])[/color][/b][color=#8b4513]; function[/color] atts [b][color=TEAL])[/color][/b][color=#8b4513]; mapcar[/color] [b][color=PURPLE])[/color][/b][color=#8b4513]; if atts[/color] [b][color=PURPLE]([/color][/b]list [b][color=TEAL]([/color][/b]append '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]0 . [color=#2f4f4f]"SEQEND"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]100 . [color=#2f4f4f]"AcDbEntity"[/color][b][color=GRAY])[/color][/b][b][color=GRAY]([/color][/b]67 . 0[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]list [b][color=GRAY]([/color][/b]cons 410 spc[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] '[b][color=OLIVE]([/color][/b][b][color=GRAY]([/color][/b]8 . [color=#2f4f4f]"0"[/color][b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b] [b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=RED])[/color][/b][color=#8b4513]; append[/color] [b][color=BLUE])[/color][/b][color=#8b4513]; mapcar[/color] [b][color=GREEN])[/color][/b][color=#8b4513]; setq r[/color] [b][color=GREEN]([/color][/b] [b][color=BLUE]([/color][/b]lambda [b][color=RED]([/color][/b] c / [b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setvar 'cmdecho 0[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]if acet-attsync [b][color=PURPLE]([/color][/b]acet-attsync nm[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]vl-cmdf [color=#2f4f4f]"_.ATTSYNC"[/color] [color=#2f4f4f]"_N"[/color] nm[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setvar 'cmdecho c[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]getvar 'cmdecho[b][color=BLUE])[/color][/b] [b][color=GREEN])[/color][/b] [b][color=MAROON])[/color][/b][color=#8b4513]; if[/color] r [b][color=NAVY])[/color][/b][color=#8b4513]; [b][color=NAVY]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] nm[b][color=NAVY])[/color][/b][/color] [b][color=FUCHSIA])[/color][/b][color=#8b4513]; cond[/color] [b][color=BLACK])[/color][/b][color=#8b4513]; defun VanillaINSERT[/color] Might be handy for the guys without activex. Nice job! Quote
ronjonp Posted November 17, 2017 Posted November 17, 2017 very Nice stuff ronjonp. Thankyou for preparing. small doubt, if i change circle radius to "0.24" and text height to "0.2" (For "meters units" drawing) how to edit your code? please guide me:) Thank you!! Updated the code above .. will scale correctly assuming the measurement variable is set correctly. 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.