How to find layer with vport drawn?

How to find layer with vport drawn?

Anonymous
Not applicable
500 Views
5 Replies
Message 1 of 6

How to find layer with vport drawn?

Anonymous
Not applicable

Usually I receive drawings with frozen layer when drawn vports. The names of layer not make sense and it was difficult to turn this layer ON. In most cases I need to select all layers turn it On and only after that possible to select this layer and receive it name..

How to search this layer via lisp?

Any help will be appreciated 

0 Likes
Accepted solutions (1)
501 Views
5 Replies
Replies (5)
Message 2 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

Usually I receive drawings with frozen layer when drawn vports. The names of layer not make sense and it was difficult to turn this layer ON. In most cases I need to select all layers turn it On and only after that possible to select this layer and receive it name..

How to search this layer via lisp?

Any help will be appreciated 


In most cases its just targetting the "Viewport" entity, but there are others out there that uses Polygonal vports. 

 

Are you just wanting to know the name? or Turn it on as well ? 

0 Likes
Message 3 of 6

pbejse
Mentor
Mentor
Accepted solution
(defun c:vpl (/ vplst ss)
  (if (setq vplst nil
	    ss
	     (ssget "_X"
		    '((-4 . "<OR")
		      (-4 . "<AND")
		      (0 . "LWPOLYLINE")
		      (102 . "{ACAD_REACTORS")
		      (-4 . "AND>")
		      (0 . "VIEWPORT")
		      (-4 . "OR>")
		     )
	     )
      )
    (progn
      (repeat (setq i (sslength ss))
	(if (and (not (member (setq vpl
				(cdr (assoc 8 (entget (ssname ss (setq i (1- i))))))
			 ) vplst )
		 )
		 (/= vpl "0")
	    )
	  (setq vplst (cons vpl vplst))
	)
      )
      (textscr)
      (princ"\n<<< Viewports are on the following layer(s) >>>")
      (foreach itm vplst (print itm))
    )
  )
  (princ)
)

 

HTH

 

Message 4 of 6

stevor
Collaborator
Collaborator

Start with:

(setq ss (ssget "x"(list (cons 0 "VIEWPORT") )))

S
0 Likes
Message 5 of 6

Anonymous
Not applicable

Thank you pbejse!

This is what i need:)

0 Likes
Message 6 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

Thank you pbejse!

This is what i need:)


You are welcome igal1971. Glad it works for you

Cheers

0 Likes