VPlayer

Hi all,
Is there a way to get the vplayer information (frozen or thawed) form a viewport?
Thanks, jojo (AutoCAD 2006)

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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
<positive value > = 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.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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. ___

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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 ... Grald
--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PowerClic: http://www.g-eaux.com/powerclic/explorer/english.html
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
This is a multi-part message in MIME format. --------------040300090908050206010108 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit
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-libr/**/ /**/fen/**/ /**/courante/**/ /**/d'un/**/ /**/viewport/**/ /**/et/**/ /**/gnere/**/ /**/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-libr/**/ /**/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"*)
)
--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PowerClic: http://www.g-eaux.com/powerclic/explorer/english.html
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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?
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
This is a multi-part message in MIME format. --------------090009080200030203050604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit
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 *'("*")*)
Gg
--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PowerClic: http://www.g-eaux.com/powerclic/explorer/english.html
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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 '("<AppName>")) or (entget ent (list "<AppName")) is required.
For AutoCAD, the usual <AppName> is "acad"; For applications other than AutoCAD, you would use the AppName used by that app in place of "acad". ___

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.