Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vport Overrides

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
916 Views, 12 Replies

Vport Overrides

I'm familiar with Vport overrides and have had success using them. I was wondering if this can be done via the command line so I can write a lisp routine for it? I'd like the lisp to set a layer to color #9 as a vp override based on the selection of an object. Any suggestions would be greatly appreciated. Thanks!

 
12 REPLIES 12
Message 2 of 13
dbroad
in reply to: Anonymous

Vplayer

Architect, Registered NC, VA, SC, & GA.
Message 3 of 13
Anonymous
in reply to: Anonymous

Thanks all! Very Helpful!

 

I am a novice at best when it comes to writing lisp routines. I have wrote the following in an effort to accomplish my goal:

 

(defun c:vw ()
    (princ "select objects to change to color 9\n")
    (command "vplayer" "c" "9")
          (princ)
  );close defun

 

I realize there should be more after "9", but the lisp seems to bypass a step and ask again for an option (color, LT, LW, etc...). There seems to be an issue when asked to provide a layer name or select objects (I'd prefer the option to select objects, but I know you can also pull the layer name from a getvar or ssget within the routine).

 

If someone could finish off or improve upon lisp routine I would be very greatful.

 

Thanks.

Message 4 of 13
dbroad
in reply to: Anonymous

Vplayer works with the current viewport.  If you use command methods (vl-cmdf or command functions), then you should practice with the prompts until you get the script you want.  If you want to apply settings to multiple viewports, then you need to use something besides vplayer.  I personally don't like scripting viewport layer settings but I believe they are stored on xdata on the viewport.  I don't believe the xdata on viewports can be manipulated.

 

Use this to learn about the xdata.  Just select the viewport.

 

(entget (car(entsel)) '("*"))

 

If you want to script multiple viewports, then you could select them and then cycle through them making each one current.  Given you are in a layout, select each layout.  Set mspace current.  Cycle through the selection set by using the activepviewport property of the document.  Use the vplayer in each viewport.

 

(vla-put-activepviewport DocumentObject PaperspaceViewportObject)

 

Architect, Registered NC, VA, SC, & GA.
Message 5 of 13
Anonymous
in reply to: dbroad

Thanks for the insight!

 

I'm not intending to select viewports, but rather select objects within the viewport. I don't mind having to run this seperately for various layers, but being able to select multiple objects, as the command allows, would be nice too.

Message 6 of 13
dbroad
in reply to: Anonymous

Viewport layer overrides don't work with object inside viewports.  So what are you trying to do?  Viewports only control layer overrides.   You can't make an object blue in one viewport and red in another without using viewport layer overrides AFAIK.

Architect, Registered NC, VA, SC, & GA.
Message 7 of 13
Anonymous
in reply to: dbroad

Viewport layer overrides is exactly what I'm doing (using the vplayer command). Now I just want to create a lisp routine for it, but the one I wrote doesn't cut the mustard.

Message 8 of 13
dbroad
in reply to: Anonymous

Your program listing is: 

(defun c:vw ()
    (princ "select objects to change to color 9\n")
    (command "vplayer" "c" "9")
          (princ)
  );close defun

 Since vplayer does not take a selection and since you start the vplayer command right away, I assume that you are merely selecting layers to get the names of the layers they occupy.  Probably the simplest approach would be to use a loop after the princ statement.  Might also be worth turning the cmdecho off.

(command "vplayer")
(while (setq e (car(entsel)))
  ;change the layer of the selected object 
  ;to color 9 in the current viewport.
  (command "c" "9" (cdr(assoc 8 (entget e)))"c")
  )
(command "")

 

 

 

  

 

Architect, Registered NC, VA, SC, & GA.
Message 9 of 13
Ian_Bryant
in reply to: Anonymous

Hi,

I think the following does what you are trying to achieve

{defun c:vw ( / ss)
    (princ "select objects to change to color 9\n")
    (setq ss (ssget))
    (initcommandversion 2)
    (command "vplayer" "C" "9" "" ss "" "Current" "")
    (princ)
);close defun

 

Ian

Message 10 of 13
Anonymous
in reply to: Ian_Bryant

Thanks Ian! Works great. Now if I can figure out what's going on within the lisp, I might learn something!

Message 11 of 13
dbroad
in reply to: Anonymous

Thanks Ian,

 

I missed the select object prompt in vplayer.

Architect, Registered NC, VA, SC, & GA.
Message 12 of 13
Anonymous
in reply to: Ian_Bryant

I've been using the lisp provided and it works wonderfully.

Any chance you could write one that removes the viewport layer override by selecting the object?

 

Thanks again!

Message 13 of 13
Ian_Bryant
in reply to: Anonymous

Hi,

using the Reset option in the VPLAYER command only resets the layer visibility,

not the colour override.

To reset the colour override of  a selected object's layer,

you have to fiddle with the layer's extension dictionary.

Try the attached vplr.lsp file, there are 2 functions defined in it.

c:vplr-cur resets the layer colour override for a selected object

in the current viewport only.

c:vplr-all resets the layer colour override for a selected object

in all viewports.

 

Ian

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost