aridzv Posted April 27 Posted April 27 (edited) Hi. I want to select: lwpolylines 4 vertices layer "Layout_Frame" DXF code 70 greater then "0". I want to use (-4 . ">") to get lwploylines with DXF code 70 greater than "0". can I use the code this way (as with "OR" & "AND"): (ssget '((0 . "LWPOLYLINE") (90 . 4) (8 . "Layout_Frame") (-4 . ">") (70 . 0))) or should I "close" the (-4 . ">") this way: (ssget '((0 . "LWPOLYLINE") (90 . 4) (8 . "Layout_Frame") (-4 . ">") (70 . 0) (-4 . ">"))) thanks, aridzv. Edited April 27 by aridzv Quote
marko_ribar Posted April 27 Posted April 27 If you want to select LWPOLYLINE entities that are closed (not DXF70 = 0/128), I'd suggest something like this... (ssget (list (cons 0 "LWPOLYLINE") (cons 90 4) (cons 8 "Layout_Frame") (cons -4 "<or") (cons 70 1) (cons 70 129) (cons -4 "or>"))) Or just little simplyfied... (ssget (list (cons 0 "LWPOLYLINE") (cons 90 4) (cons 8 "Layout_Frame") (cons -4 "&=") (cons 70 1))) 1 Quote
aridzv Posted April 27 Author Posted April 27 (edited) thanks @marko_ribar I use this (which is your first line actually...): (ssget '((0 . "LWPOLYLINE") (90 . 4) (8 . "Layout_Frame") (-4 . "<OR") (70 . 1) (70 . 129) (-4 . "OR>"))) I have tow questions: 1. when using (-4 . ">") when the condition stop, or is it refering just to the first DXF code that is next to it ? 2. how this code: (cons -4 "&=") (cons 70 1) get both (70 . 1) and (70 . 129)? What does "&=" sign do to make it different from just "=" ? thanks, aridzv. Edited April 27 by aridzv Quote
Lee Mac Posted April 27 Posted April 27 (edited) DXF group 70 always holds a bit-coded integer value (i.e. an integer for which each bit (power of 2) encodes a setting); given this, you should use the bitwise relational operators ("&" and "&=") when filtering bit coded values. Here: The "&" operator is equivalent to the AutoLISP expression (/= 0 (logand bit filter)) and means all of the filter bits must be set. The "&=" operator is equivalent to the AutoLISP expression (= filter (logand bit filter)) and means any of the filter bits can be set. For your example, you state: Quote DXF code 70 greater then [sic] "0". This implies that you want to select either closed polylines, or polylines with linetype generation enabled, or both - and so the filter would be: (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "&") (70 . 129))) If instead, you mean to select only closed polylines, you should use: (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))) Edited April 27 by Lee Mac 1 Quote
aridzv Posted April 27 Author Posted April 27 (edited) Hi @Lee Mac and thanks for the reply. in this case I wanted to select closed polylines regardless of thier linetype generation conditions. when I used: (ssget '((0 . "LWPOLYLINE") (90 . 4) (8 . "Layout_Frame") (70 . 1))) it ommited lwpolylines that was closed and had thier linetype generation enabled => (70 . 129). Edited April 27 by aridzv Quote
aridzv Posted April 27 Author Posted April 27 other question is about the use of (-4 . ">"). dose it refer only to the elemnt next to it or will it refer to all the elements after it? Quote
Lee Mac Posted April 27 Posted April 27 4 hours ago, aridzv said: Hi @Lee Mac and thanks for the reply. in this case I wanted to select closed polylines regardless of thier linetype generation conditions. when I used: (ssget '((0 . "LWPOLYLINE") (90 . 4) (8 . "Layout_Frame") (70 . 1))) it ommited lwpolylines that was closed and had thier linetype generation enabled => (70 . 129). You should use the bitwise equals operator ("&="), as I have explained above. 1 Quote
GLAVCVS Posted April 28 Posted April 28 (edited) Regarding your question about additional filters after (-4 . ">") The answer is that you must repeat the filter (-4 . ">") as many times as necessary to achieve the expected result. For example: .... (-4 . ">") (62 . 1) (90 . 3)... will not return the expected result. But... (-4 . ">") (62 . 1) (-4 . ">") (90 . 3)... YES This is true at least in AutoCAD. I don't know if this works the same way in BricsCAD. Edited April 28 by GLAVCVS 1 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.