Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
i need to convert multiline text to multiline attributes, Refer Attached Drawing
Solved! Go to Solution.
Hi,
i need to convert multiline text to multiline attributes, Refer Attached Drawing
Solved! Go to Solution.
Bonjour @shil143
You write in AutoLisp forum so I undertand you need a program to do this work
is it OK ? .
You do not want to know how make attributes in a block, that's right ?
Following your responses to these remarks we will respond differently
Amicalement
@shil143 Do you mean to be att at each block all text related to it? could you , please, make , at least , one such block .
I wonder how do you want it to be seen at screen.
An option could be, make mleader with a block to show the values.
Please clear it.
Or please make on block , with the need attributes.
Hi,
With your exemple drawing, it's seem to work's...
(vl-load-com)
(defun make_blk ( / )
(entmake
'((0 . "BLOCK") (8 . "0") (2 . "TAG_LUMINAIRE") (70 . 2) (4 . "") (8 . "0") (62 . 0) (6 . "ByBlock") (370 . -2) (10 0.0 0.0 0.0))
)
(entmake
'(
(0 . "LWPOLYLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbPolyline")
(90 . 4)
(70 . 129)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 0.0 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 0.0 8.95)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 15.45 8.95)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 15.45 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(210 0.0 0.0 1.0)
)
)
(entmake
'(
(0 . "LWPOLYLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbPolyline")
(90 . 2)
(70 . 128)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 0.0 5.1)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 15.45 5.1)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(210 0.0 0.0 1.0)
)
)
(entmake
'(
(0 . "LWPOLYLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbPolyline")
(90 . 2)
(70 . 128)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 0.0 2.65)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 15.45 2.65)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(210 0.0 0.0 1.0)
)
)
(entmake
'(
(0 . "LWPOLYLINE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbPolyline")
(90 . 2)
(70 . 128)
(43 . 0.0)
(38 . -4.31512e-07)
(39 . 0.0)
(10 2.05 5.1)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 2.05 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(210 0.0 0.0 1.0)
)
)
(entmake
'(
(0 . "TEXT")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbText")
(10 0.9 3.15 0.0)
(40 . 1.25)
(1 . "E")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "ISOCP")
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 4.50556e-12 -1.10979e-08 1.0)
(100 . "AcDbText")
(73 . 0)
)
)
(entmake
'(
(0 . "TEXT")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbText")
(10 0.95 0.95 0.0)
(40 . 1.25)
(1 . "N")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "ISOCP")
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 4.50556e-12 -1.10979e-08 1.0)
(100 . "AcDbText")
(73 . 0)
)
)
(entmake
'(
(0 . "ATTDEF")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbText")
(10 2.95 6.3 0.0)
(40 . 1.25)
(1 . "")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "ISOCP")
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbAttributeDefinition")
(3 . "Luminaire")
(2 . "ID")
(70 . 0)
(73 . 0)
(74 . 0)
(280 . 1)
)
)
(entmake
'(
(0 . "ATTDEF")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbText")
(10 3.0 3.25 0.0)
(40 . 1.25)
(1 . "")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "ISOCP")
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbAttributeDefinition")
(3 . "Coordinate Easting")
(2 . "EASTING")
(70 . 0)
(73 . 0)
(74 . 0)
(280 . 1)
)
)
(entmake
'(
(0 . "ATTDEF")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(62 . 0)
(6 . "ByBlock")
(370 . -2)
(100 . "AcDbText")
(10 3.0 0.95 0.0)
(40 . 1.25)
(1 . "")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "ISOCP")
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbAttributeDefinition")
(3 . "Coordinate Northing")
(2 . "NORTHING")
(70 . 0)
(73 . 0)
(74 . 0)
(280 . 1)
)
)
(entmake '((0 . "ENDBLK") (8 . "0") (62 . 0) (6 . "ByBlock") (370 . -2)))
)
(defun c:AUTOSEL2BLK ( / js delta nw_js n ent obj perim n pt_lst pt_ins val_txt nb ent_sel dxf_ent)
(setq js (ssget "_X" '((0 . "LWPOLYLINE") (8 . "RD_EX_ST_TEXT"))))
(cond
(js
(setq delta 48.78995 nw_js (ssadd))
(repeat (setq n (sslength js))
(setq
ent (ssname js (setq n (1- n)))
obj (vlax-ename->vla-object ent)
perim (vlax-curve-getDistAtParam obj (vlax-curve-getEndParam obj))
)
(if (equal perim delta 1E-04)
(ssadd ent nw_js)
)
)
(cond
(nw_js
(repeat (setq n (sslength nw_js))
(setq
ent (ssname nw_js (setq n (1- n)))
pt_lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))
pt_ins (assoc (apply 'min (mapcar 'car pt_lst)) pt_lst)
js (ssget "_CP" pt_lst '((8 . "RD_EX_ST_TEXT")))
val_txt nil
)
(cond
(js
(if (not (tblsearch "BLOCK" "TAG_LUMINAIRE")) (make_blk))
(repeat (setq nb (sslength js))
(setq
ent_sel (ssname js (setq nb (1- nb)))
dxf_ent (entget ent_sel)
)
(if (eq (cdr (assoc 0 dxf_ent)) "TEXT")
(setq val_txt (cons (cdr (assoc 1 dxf_ent)) val_txt) ang (cdr (assoc 50 dxf_ent)))
)
(entdel ent_sel)
)
(entmake
(list
(cons 0 "INSERT")
(cons 100 "AcDbEntity")
(assoc 67 dxf_ent)
(assoc 410 dxf_ent)
(assoc 8 dxf_ent)
(cons 100 "AcDbBlockReference")
(cons 66 1)
(cons 2 "TAG_LUMINAIRE")
(cons 10 pt_ins)
(cons 41 1.0)
(cons 42 1.0)
(cons 43 1.0)
(cons 50 ang)
(cons 210 '(0.0 0.0 1.0))
)
)
(entmake
(list
(cons 0 "ATTRIB")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 8 "RD_EX_ST_TEXT")
(cons 100 "AcDbText")
(cons 10 (mapcar '+ pt_ins (list (- (* 2.95 (cos ang)) (* 6.3 (sin ang))) (+ (* 2.95 (sin ang)) (* 6.3 (cos ang))))))
(cons 40 1.25)
(cons 1 (last val_txt))
(cons 50 ang)
(cons 41 1.0)
(cons 51 0.0)
(cons 7 "ISOCP")
(cons 71 0)
(cons 72 0)
(cons 11 '(0.0 0.0 0.0))
(cons 210 '(0.0 0.0 1.0))
(cons 100 "AcDbAttribute")
(cons 2 "ID")
(cons 70 0)
(cons 73 0)
(cons 74 0)
(cons 280 1)
)
)
(entmake
(list
(cons 0 "ATTRIB")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 8 "RD_EX_ST_TEXT")
(cons 100 "AcDbText")
(cons 10 (mapcar '+ pt_ins (list (- (* 3.0 (cos ang)) (* 3.25 (sin ang))) (+ (* 3.0 (sin ang)) (* 3.25 (cos ang))))))
(cons 40 1.25)
(cons 1 (cadddr val_txt))
(cons 50 ang)
(cons 41 1.0)
(cons 51 0.0)
(cons 7 "ISOCP")
(cons 71 0)
(cons 72 0)
(cons 11 '(0.0 0.0 0.0))
(cons 210 '(0.0 0.0 1.0))
(cons 100 "AcDbAttribute")
(cons 2 "EASTING")
(cons 70 0)
(cons 73 0)
(cons 74 0)
(cons 280 1)
)
)
(entmake
(list
(cons 0 "ATTRIB")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 8 "RD_EX_ST_TEXT")
(cons 100 "AcDbText")
(cons 10 (mapcar '+ pt_ins (list (- (* 3.0 (cos ang)) (* 0.95 (sin ang))) (+ (* 3.0 (sin ang)) (* 0.95 (cos ang))))))
(cons 40 1.25)
(cons 1 (caddr val_txt))
(cons 50 ang)
(cons 41 1.0)
(cons 51 0.0)
(cons 7 "ISOCP")
(cons 71 0)
(cons 72 0)
(cons 11 '(0.0 0.0 0.0))
(cons 210 '(0.0 0.0 1.0))
(cons 100 "AcDbAttribute")
(cons 2 "NORTHING")
(cons 70 0)
(cons 73 0)
(cons 74 0)
(cons 280 1)
)
)
(entmake (list (cons 0 "SEQEND") (cons 8 "RD_EX_ST_TEXT") (cons 62 0) (cons 6 "ByBlock") (cons 370 -2)))
)
)
)
)
)
)
)
(prin1)
)