Jump to content

Recommended Posts

Posted (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 by aridzv
Posted

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

 

  • Like 1
Posted (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 by aridzv
Posted (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 by Lee Mac
  • Like 1
Posted (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 by aridzv
Posted

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?

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

  • Thanks 1
Posted (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 by GLAVCVS
  • Thanks 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...