CONS 281 Does not work

CONS 281 Does not work

kpennell
Collaborator Collaborator
557 Views
4 Replies
Message 1 of 5

CONS 281 Does not work

kpennell
Collaborator
Collaborator

When I check for viewport with the following:

 

(setq Get (ssget "x" (list (cons 0 "VIEWPORT")(cons 281 0))))

 

The seearch comes up empty, when I know the 281 value for the viewport is indeed set to 0.  I'm not trying to modify the viewport, I'm just looking for viewports that have a particular visual style applied.

 

If I use:

 

(setq Get (ssget "x" (list (cons 0 "VIEWPORT")(cons 68 2))))

 

works fine.

 

So whats so special about "281"?

0 Likes
558 Views
4 Replies
Replies (4)
Message 2 of 5

Jason.Piercey
Advisor
Advisor

You could iterate the selection set, testing for the value of 281, then add those entities which pass the test to a new selection set.

 

One way:

 

(if (setq ss (ssget '((0 . "viewport"))))
  (progn
    (setq i 0)
    (repeat (sslength ss)
      (setq name (ssname ss i))
      (setq data (entget name))
      (setq code (cdr (assoc 281 data)))
      (if (zerop code)
	(setq s (ssadd name))
	)
      (setq i (1+ i))
      )
    )  
  )
0 Likes
Message 3 of 5

kpennell
Collaborator
Collaborator

Is there a way to check, without having to pick two points?  I was thing ssget "x" but it's not getting the same results.

 

Also, I'm guessing I'll have to review each layout?  As there are multiple layouts in each drawing as well.

 

The root of the problem, is that when the visual setting is set to something other than wireframe, it screws up the plot for the client.  Even though the shadeplot is set to legacy hidden.  I saw with my own eyes, and I couldn't believe it.  So I'd like to do a check on each drawing before it goes to the client, and check for any viewports that does not have a 281 value of "0".

 

Thanks JP, for the attention.

0 Likes
Message 4 of 5

Jason.Piercey
Advisor
Advisor

You could use "X" in ssget, but you'll have consider the layout itself.  A layout is a viewport.

0 Likes
Message 5 of 5

dbroad
Mentor
Mentor

Great question @kpennell. If I had to guess, it would be because the visual styles were added much later and not linked in well to the selection process.

To work around the problem, select all the viewports and then loop through them looking for the visual style settings. You could delete them from the selection set in the loop. If you do so, start from the last selection object.  See below for a possible function:

;;returns a selection set of viewports that have certain dxf values
;;for the given problem (setq ss (ssvdxf 281 0)) (defun ssvdxf (key val / ss i e) (if (setq ss (ssget "x" '((0 . "VIEWPORT")))) (repeat (setq i (sslength ss)) (setq i (1- i) e (ssname ss i) ) (if (/= (cdr (assoc key (entget e))) val) (ssdel e ss) ) ) ) ss ;return filtered selection set. )
Architect, Registered NC, VA, SC, & GA.
0 Likes