VPlayer

Hi all,

Is there a way to get the vplayer information (frozen or thawed) form a viewport?

Thanks, jojo (AutoCAD 2006)

Reply to
jojo
Loading thread data ...

Try this at the command prompt:

(cdr(assoc 68(entget(car(entsel)))))

then pick the port. From what you get:

1 = On,

but is fully off screen, or is one of the viewports that is not active because the $MAXACTVP count is currently being exceeded.

0 = Off

= On and active.

The value indicates the order of stacking for the viewports, where 1 is the active viewport, 2 is the next, and so forth.

Reply to
Michael Bulatovich

Michael,

I got the impression that the OP was asking about the layer status of a viewport, rather than its on/off status. The layers that are frozen in a particular viewport are listed in the viewport's *extended* data (DXF code -3). It's there, but it takes a bit of drilling down to get to it:

(setq v2 (car (entsel))) ;;pick the viewport (setq frz (cdadr (assoc -3 (entget v2 (list "acad")))))

...and frz will contain the viewport's extended data, with each frozen viewport as the argument of a different "1003" code group.

To get a comma-delimited list of the frozen viewports, use:

(setq flist "") (foreach n frz (if (= (car n) 1003) (setq L1 (cdr n) flist (strcat flist L1 ", ")) ) ;;if ) ;;flist

Any layer not contained in flist is thawed in the selected viewport. ___

Reply to
Paul Turvill

Great ! i've been searching for this during last week ! They are many things that don't work around this viewports : You can restore this from the layer state manager, but only from the dialog : if you try using the command line, it doesn't work.

So i finaly read a *.las file, using the 90 code :

off : 1 frozen : 2 locked: 4 unprintable : 8 frozen in new : 16 frozen in current : 32

but reading it directly from a viewport is better ... Gérald

Reply to
gegematic

Here two commands to apply a vieport layer state to another viewport :

*PickReferenceViewport* : to read layer state from a viewport

*PickTargetViewport *: to apply layer state to an other viewport.

Layer list is stored in a public string: *layer-string-state* It is propagated to every openend drawing

*/;/**/;**************************************************************************/* */;/**/§/calques//**/ /**/lit/**/ /**/l'état/**/ /**/gelé-libéré/**/ /**/fen/**/ /**/courante/**/ /**/d'un/**/ /**/viewport/**/ /**/et/**/ /**/génere/**/ /**/la/**/ /**/chaine/**/ /**/layer-string-state/none/* */;/**/;inspired/**/ from /**/Paul/**/ /**/Turvill/*

(*defun* c:PickReferenceViewport (/ v2 frz flist l1 n is-viewport) (*command* *"**_pspace"*) (*while* (*not* is-viewport) (*setq* v2 (*car* (*entsel* *"**\nSelect** **the** **reference** **viewport** **for** **layer**

**state"* ) ) ) */;/**/;pick/**/ /**/the/**/ /**/viewport/* (*if* (= *"**VIEWPORT"* (*cdr* (*assoc* *0* (*entget* v2)))) (*setq* is-viewport T) (*prompt* *"**\nNot** **a** **viewport,** **please** **select** **a** **viewport"*) ) ) (*setq* frz (cdadr (*assoc* -3 (*entget* v2 (*list* *"**acad"*)))))

*/;/**/;...and/**/ /**/frz/**/ /**/will/**/ /**/contain/**/ /**/the/**/ /**/viewport's/**/ /**/extended/**/ /**/data,/**/ /**/with/**/ /**/each/**/ /**/frozen/*

*/;/**/;viewport/**/ /**/as/**/ /**/the/**/ /**/argument/**/ /**/of/**/ /**/a/**/ /**/different/**/ /**/"1003"/**/ /**/code/**/ /**/group./* */;/**/;To/**/ /**/get/**/ /**/a/**/ /**/comma-delimited/**/ /**/list/**/ /**/of/**/ /**/the/**/ /**/frozen/**/ /**/viewports,/**/ /**/use:/*

(*setq* flist *"**"*) (*foreach* n frz (*if* (= (*car* n) *1003*) (*setq* L1 (*cdr* n) flist (*strcat* flist L1 *"**,"*) ) )

*/;/**/;if/* ) */;/**/;flist/* */;/**/;Any/**/ /**/layer/**/ /**/not/**/ /**/contained/**/ /**/in/**/ /**/flist/**/ /**/is/**/ /**/thawed/**/ /**/in/**/ /**/the/**/ /**/selected/**/ /**/viewport./* (*setq* layer-string-state flist) (*vl-propagate* 'layer-string-state) )

*/;/**/;**************************************************************************/*

*/;/**/§/calques//**/ /**/restaure/**/ /**/l'état/**/ /**/gelé-libéré/**/ /**/fen/**/ /**/courante/**/ /**/à/**/ /**/un/**/ /**/autre/**/ /**/viewport/**/ /**/à/**/ /**/partir/**/ /**/de/**/ /**/la/**/ /**/chaine/**/ /**/layer-string-state/none/*

(*defun* c:PickTargetViewport (/ v2 nvport is-viewport)

(*while* (*not* is-viewport) (*setq* v2 (*car* (*entsel* *"**\nSelect** **the** **target** **viewport** **for** **layer**

**state"* ) ) ) */;/**/;pick/**/ /**/the/**/ /**/viewport/* (*if* (= *"**VIEWPORT"* (*cdr* (*assoc* *0* (*setq* eg (*entget* v2))))) (*setq* is-viewport T) (*prompt* *"**\nNot** **a** **viewport,** **please** **select** **a** **viewport"*) ) ) (*setq* nvport (*cdr* (*assoc* *69* eg))) (*command* *"**_mspace"*) (*setvar* *"**cvport"* nvport) (*command* *"**_VPLAYER"* *"**_thaw"* *"***"* *"**"* *"**"*) (*command* *"**_VPLAYER"* *"**_freeze"* layer-string-state *"**"* *"**"*) (*command* *"**_pspace"*) )
Reply to
gegematic

Upon further review....it appears you may be right.

Now I have a question. What's the relationship of this extended data to the usual ent data? A simple call to (entget(car(entsel))) reveals no list member associated with -3, yet your code below reveals what you say it will. How's that work?

Reply to
Michael Bulatovich

Michael Bulatovich a écrit :

hello,

(assoc -3 (entget v2 *(list "acad")*))

'("acad") is the name of the aplication that registred the xdata.

if you don't want a specific xdata, you can only write : (entget v2 *'("*")*)

Gégé

Reply to
gegematic

Extended data is applied to a number of objects (like viewports) by using one or more "application" fields in the -3 code group. In this case, it's added by AutoCAD itself, hence (list "acad"). Third-party apps may also add extended data, however it isn't common.

The standard (entget ent) function gets only the basic data. To read extended data, if any, the form (entget ent '("")) or (entget ent (list "

Reply to
Paul Turvill

Thank you all so much.... I think I have some work to do to understand what you have provided, but I've put it all in a file to work on.

jojo

Reply to
jojo

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.