Jump to content

Recommended Posts

Posted

Hi all.

im stuck at something very 'simple'... i tought...

I want to make a ssget of all closed polylines, therefore i need to use the DXF group 70.

 

This doesnt work.... how can i assign both value 1 and 129 for the cons 70?

(setq ssvalid (ssget "_X" (list (cons 8 validlistlayers) (cons 0 validlisttype) (cons 70 1) (cons 70 129))))

 

Since i use a symbol for cons 8 and 0, i cannot use the format with the 'dots'... so i cant get the -4 AND functions to work. 😞

 

What is the correct was for this?

 

 

Posted

Hi.

For exemple, the following will only select polylines (heavy/light) that are closed in the current space (object/paper).

 

(while
  (null
    (setq ss
      (ssget
        (list
          '(0 . "*POLYLINE")
          '(-4 . "<AND")
            '(-4 . "<NOT")
              '(-4 . "&")
              '(70 . 120)
            '(-4 . "NOT>")
            '(-4 . "&")
            '(70 . 1)
          '(-4 . "AND>")
          (cons 67 (if (eq (getvar "CVPORT") 1) 1 0))
          (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model"))
        )
      )
    )
  )
)

 

  • Like 1
Posted

You should be able to use a dotted list item in there, 

 

In your ssget you are looking for anything that has a dxf 70 of 1 AND 129, would you want this to be OR ? Lee Mac has a good reference, http://lee-mac.com/ssget.html looking at both the AND and OR descriptions should show the syntax to use.

  • Like 1
Posted (edited)

Since DXF group 70 is bit coded, you should use a bitwise filter for the test, e.g.:

(setq ssvalid (ssget "_X" (list (cons 8 validlistlayers) (cons 0 validlisttype) '(-4 . "&=") '(70 . 1))))

 

The use of the bitwise filter &= is equivalent to:

(= 1 (logand 1 (cdr (assoc 70 <dxf data>))))

 

You can find more information about the bitwise masked equals operator in my ssget reference here.

 

The reason that your original code is failing is because you have included two values for DXF group 70 in your filter list, and all items in the filter list have an implied AND logic - as such,  this filter will never select any objects, as DXF group 70 cannot be both 1 and 129.

Edited by Lee Mac
  • Like 1
  • Thanks 1
Posted

Thanks all!

@Lee Mac your solution works perfect. I've read your website 100 times, but never understood the "&=" function.

Now it makes sense. And is actualy quite simple. 🙂

 

Thanks again.

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