Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extract Assoc 341?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
535 Views, 4 Replies

Extract Assoc 341?

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))

4 REPLIES 4
Message 2 of 5
Shneuph
in reply to: Anonymous

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))))

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 5
Anonymous
in reply to: Shneuph

Thanks for your reply.  It worked.  I didn't see the first 341 that you pointed out.

Message 4 of 5
Kent1Cooper
in reply to: Anonymous

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....]

Kent Cooper, AIA
Message 5 of 5
Anonymous
in reply to: Kent1Cooper

You say you ain't Da' Man but in some instances you are Da' Man.  Have a good weekend.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost