I am trying to extract assoc 41 (shown in red) on following entity list: I tried to extract the assoc 341 first, thinking this is the entity name but I get <Entity name: 0> and not <Entity name: 7ee38f30> which is what I expect. I am missing something here. What? Thanks for any help you can give.
Command: (setq hrhl (entget hrh))
((-1 . <Entity name: 7ee410d8>) (0 . "MULTILEADER") (330 . <Entity name:
7ee38fb8>) (5 . "93") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0")
(100 . "AcDbMLeader") (270 . 2) (300 . "CONTEXT_DATA{") (40 . 1.0) (10 3.11928
4.12382 0.0) (41 . 0.18) (140 . 0.18) (145 . 0.09) (174 . 1) (175 . 6) (176 .
0) (177 . 0) (290 . 0) (296 . 0) (110 2.44763 2.52259 0.0) (111 1.0 0.0 0.0)
(112 0.0 1.0 0.0) (297 . 0) (302 . "LEADER{") (290 . 1) (291 . 1) (10 3.11928
4.12382 0.0) (11 1.0 0.0 0.0) (90 . 0) (40 . 0.36) (304 . "LEADER_LINE{") (10
2.44763 2.52259 0.0) (91 . 0) (170 . 1) (92 . -1056964608) (340 . <Entity name:
0>) (171 . -2) (40 . 0.0) (341 . <Entity name: 0>) (93 . 0) (305 . "}") (271 .
0) (303 . "}") (272 . 9) (273 . 9) (301 . "}") (340 . <Entity name: 7ee38f90>)
(90 . 1024) (170 . 1) (91 . -1056964608) (341 . <Entity name: 7ee38f30>) (171 .
-2) (290 . 1) (291 . 1) (41 . 0.36) (42 . 0.18) (172 . 0) (343 . <Entity name:
7ee38f00>) (173 . 1) (95 . 6) (174 . 1) (175 . 0) (92 . -1056964608) (292 . 0)
(93 . -1056964608) (10 1.0 1.0 1.0) (43 . 0.0) (176 . 0) (293 . 0) (294 . 0)
(178 . 0) (179 . 1) (45 . 1.0) (271 . 0) (272 . 9) (273 . 9))
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
I don't think you need to entity name of the 341 assoc list first. It's returning the first 341 list in the mleader entity which is ename 0 insinde the (304 . LEADER_LINE{) list. The one you're looking at is the 2nd 341 list. Regardless... you shoudln't need it.
You COULD reverse the list and use assoc 41.. I wouldn't count on this working consistently though with many different mleaders...
Try:
(setq yourvariable (assoc 41 (reverse (entget hrh))))
Another way to get the second entry under a particular DXF code, for example if there might be more than two [meaning that getting the first one in the reversed list would get you the last such entry, not the second one], is this [using your DXF code and entity data variable name]:
(cdr (assoc 41 (cdr (member (assoc 41 hrhl) hrhl))))
It makes a new list of everything after the first such entry, and then gets the information from the first one in that new list.
I use that approach to get entity types sometimes, if I want to be able to distinguish "heavy" 2D Polylines from 3D Polylines. You can't tell them apart from their basic entity-type (assoc 1) values [they're both "POLYLINE"], so I go for the second (assoc 100) value, which does distinguish them. And likewise to distinguish different varieties of Dimensions, or similarly with (assoc 10) if you have a reason to want the second vertex of a Polyline, etc. [There are also other ways to such information....]
You say you ain't Da' Man but in some instances you are Da' Man. Have a good weekend.