vanowm Posted March 23, 2015 Posted March 23, 2015 Hello. Some entities have duplicate item association in it's list (sorry don't know the proper term). i.e. a ruled surface is: ((-1 . <Entity name: 4008eaa0>) (0 . "POLYLINE") (330 . <Entity name: 4008ccd0>) (5 . "E7A4") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "MESH") (100 . "AcDbPolygonMesh") (66 . 1) (10 0.0 0.0 0.0) (70 . 16) ... ) [0] (-1 . <Entity name: 4008eaa0>) [1] (0 . "POLYLINE") [2] (330 . <Entity name: 4008ccd0>) [3] (5 . "E7A4") [4] ([color=red][b]100[/b][/color] . "AcDbEntity") [5] (67 . 0) [6] (410 . "Model") [7] (8 . "MESH") [8] ([color=red][b]100[/b][/color] . "AcDbPolygonMesh") [9] (66 . 1) [10] (10 0.0 0.0 0.0) [11] (70 . 16) [12] (40 . 0.0) [13] (41 . 0.0) [14] (210 0.0 0.0 1.0) [15] (71 . 2) [16] (72 . 13) [17] (73 . 0) [18] (74 . 0) [19] (75 . 0) Using assoc command returns only the first found association item. i.e. (print (assoc 100 (ENTGET (CAR (ENTSEL))))) Would return ([color=red][b]100[/b][/color] . "AcDbEntity") but not ([color=red][b]100[/b][/color] . "AcDbPolygonMesh") Two questions: 1) Is there a command that would return a list of all matched associations or we we have to go through entire list and search each item individually? 2) is there a way filter entities by such duplicate associations in (ssget), i.e. this doesn't work: (SSGET '((100 . "AcDbPolygonMesh"))) It allows select anything instead of only surfaces/meshes. Thank you. Quote
hanhphuc Posted March 23, 2015 Posted March 23, 2015 hi have a look dxf reference here (ssget'((0 . "POLYLINE")(70 . [color="red"]16[/color]))) Quote
Lee Mac Posted March 23, 2015 Posted March 23, 2015 1) Is there a command that would return a list of all matched associations or we we have to go through entire list and search each item individually? Consider a 'massoc' function to retrieve all items with a given key in an association list. 2) is there a way filter entities by such duplicate associations in (ssget), i.e. this doesn't work: (SSGET '((100 . "AcDbPolygonMesh"))) It allows select anything instead of only surfaces/meshes. hi have a look dxf reference here (ssget'((0 . "POLYLINE")(70 . [color="red"]16[/color]))) A good suggestion, however, since DXF group 70 is bit-coded, I would suggest using a Bitwise Masked Equals operator (reference), e.g.: (ssget '((0 . "POLYLINE") (-4 . "&=") (70 . 16))) Quote
hanhphuc Posted March 23, 2015 Posted March 23, 2015 Consider a 'massoc' function to retrieve all items with a given key in an association list. A good suggestion, however, since DXF group 70 is bit-coded, I would suggest using a Bitwise Masked Equals operator (reference), e.g.: (ssget '((0 . "POLYLINE") (-4 . "&=") (70 . 16))) Thank you Lee for the bonus guide! Noted! 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.