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

Plot Transparency option in PLOT dialog box

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
MetroVancouverDrafting
4631 Views, 12 Replies

Plot Transparency option in PLOT dialog box

Hi,

 

Is anybody knows where else do they keep this setting?

I only have found it in Active Layout in extended dada

 

(entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*"))

 

The last pice of extended data is:

 ("PLOTTRANSPARENCY" (1071 . 0))

 

When i change it to 1

 

(setq layout(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object))))

(vla-getXdata layout "PLOTTRANSPARENCY" 'type 'data)

(vlax-safearray-fill data  '("PLOTTRANSPARENCY" 1))

(vla-setXdata layout  type data)

 

it stays there (extended data), but the setting in Plot dialog box doesn't change!!! And it still prints no transparency.

It takes to save the drawing and reopen it again to see the change.

 

Where else could it be??

 

The command -PLOT does not have this setting as well, so my options back to VBA or Lisp, but HOW??

 

 

 

Tags (1)
12 REPLIES 12
Message 2 of 13

Hi,

take a look to acad-system-variable PLOTTRANSPARENCYOVERRIDE.

 

Maybe this would be a easier way and helpful for you.

 

kind regards,

Franz

www.gfm.at
Message 3 of 13

 

This variable is ACAD depended, it is not stored in the drawing and makes changes in all opened drawings. Additionally it overrides setting of all layouts.

 

Message 4 of 13

OK,

now i am curious about this ...

 

I am not so familar with VLAX-..., but i try it with similar lisp ... and it works!

 

Here is my pure lisp code for testing:

Note: Entity-list elist_modellayout the applist '(-3 ("ACAD_PSEXT" ...)'  must exist.

 

(defun c:tplot ()

  ;----- Dictionary lesen
  (setq elist_dict (dictsearch (namedobjdict) "ACAD_LAYOUT")) (setq elist_modellayout (entget (cdr (car (cdr (member (cons 3 "Model") elist_dict)))) '("*"))) (setq list_psext (assoc -3 elist_modellayout)) ;----- Plot transparent (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 1)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext)) (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout)) (entmod elist_modellayout-neu) ;;; ;----- Plot wieder ohne transparent Option ;;; (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 0)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext)) ;;; (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout)) ;;; (entmod elist_modellayout-neu) );enddefun

 Last part is to set plot option back to normal (without transp.)

www.gfm.at
Message 5 of 13

Of course, how did i missed it , it has to be (entmod...

 

 (entmod(entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*"))) 


I guess my excuse is that I wrote in VBA first and then translated it to VLisp.
I would assume that it is a bug of VBA and automation. There is no such a thing as (entmod in VBA
 
Thanks kefer

Message 6 of 13

In some layouts is no "PLOTTRANSPARENCY"...

 

This script (princ (entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*"))) prompts:

((-1 . <Entity name: 7ffff633e30>) (0 . LAYOUT) (5 . 15503) (102 .
{ACAD_XDICTIONARY) (360 . <Entity name: 7ffff634d30>) (102 . }) (102 .
{ACAD_REACTORS) (330 . <Entity name: 7ffff6090d0>) (102 . }) (330 . <Entity
name: 7ffff6090d0>) (100 . AcDbPlotSettings) (1 . ) (2 . Albert hp5200tn.pc3)
(4 . A3) (40 . 6.01133) (41 . 4.23334) (42 . 6.01135) (43 . 4.23334) (44 .
296.968) (45 . 419.989) (46 . -6.02718) (47 . -4.23885) (48 . -1.13687e-013)
(49 . -5.68434e-014) (140 . 420.0) (141 . 297.0) (142 . 1.0) (143 . 1.0) (70 .
694) (72 . 1) (73 . 1) (74 . 4) (7 . Dunne lijnen.ctb) (75 . 16) (147 . 1.0)
(76 . 1) (77 . 2) (78 . 150) (148 . 1.13687e-013) (149 . 5.68434e-014) (100 .
AcDbLayout) (1 . Winkel op A3) (70 . 0) (71 . 2) (10 0.00550842 0.0158482 0.0)
(11 419.994 296.984 0.0) (12 0.0 0.0 0.0) (14 -1.13687e-013 -5.68434e-014 0.0)
(15 420.0 297.0 0.0) (146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0) (17 0.0 1.0
0.0) (76 . 0) (330 . <Entity name: 7ffff633da0>) (331 . <Entity name:
7ffff633dc0>) (-3 (ACAD_PSEXT (1000 . Albert hp5200tn.pc3) (1000 . HP Universal
Printing PCL 6) (1000 . Renswoude) (1000 . formulemanagement_hp5200tn) (1070 .
0))))

 

My script doesn't work!!!:

(defun tplot ()

  (vl-load-com)
  (setq elist_modellayout (entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*")))
  (setq list_psext (assoc -3 elist_modellayout))

  (if (/= (assoc "PLOTTRANSPARENCY" (cdr (assoc -3 elist_modellayout))) nil)
    (progn
      (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 1)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext))
      (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
      (entmod elist_modellayout-neu)
    )

 (setq list_psext-neu (append (list -3) (list (assoc "ACAD_PSEXT" (cdr (assoc -3 elist_modellayout)))) (list (list "PLOTTRANSPARENCY" '(1071 . 1))) ))
  )

 )

 

Message 7 of 13

I’m searching for a lisp that turns on the plottransparency in all my layouts. Note: in some of my layout tabs is no ("PLOTTRANSPARENCY"  (1071 . 0)). How do i modify the definition data of a layout with entmod?

 

Can i change the definition data of a layout from:

 

(
   (-1 . <Entity name: 7fffea60d20>)
   (0 . "LAYOUT")
   ……..
   (331 . <Entity name: 7fffea60df0>)
   (-3
      ("ACAD_PSEXT"
         (1000 . "Microsoft XPS Document Writer")
         (1000 . "Microsoft XPS Document Writer")
         (1000 . "XPSPort:")
         (1000 . "")
         (1070 . 0)
      )
   )
)

 

To: ???

 

(
   (-1 . <Entity name: 7fffea60d20>)
   (0 . "LAYOUT")
   ……..
   (331 . <Entity name: 7fffea60df0>)
   (-3
      ("ACAD_PSEXT"
         (1000 . "Microsoft XPS Document Writer")
         (1000 . "Microsoft XPS Document Writer")
         (1000 . "XPSPort:")
         (1000 . "")
         (1070 . 0)
      )
      ("PLOTTRANSPARENCY"  (1071 . 1))
   )
)

 

 

I think the lisp is something like this:

(defun tplot ()
  (vl-load-com)
  (setq elist_modellayout (entget (vlax-vla-object->ename(vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*")))
  (setq list_psext (assoc -3 elist_modellayout))
  (if (/= (assoc "PLOTTRANSPARENCY" (cdr (assoc -3 elist_modellayout))) nil)
    (progn
      (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 1)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext))
      (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
      (entmod elist_modellayout-neu)
    )
    (progn
      (setq list_psext-neu (append (list -3) (list (assoc "ACAD_PSEXT" (cdr (assoc -3 elist_modellayout)))) (list (list "PLOTTRANSPARENCY" '(1071 . 1))) ))
      (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
      (entmod elist_modellayout-neu)
    )
  )
)

 

 

Thanks

Message 8 of 13

I think you have forgotten the tird option, no extended data at all.

 

Message 9 of 13

(defun tplot ()
  (princ "(TPLOT) ")
  (vl-load-com)
  (setq elist_modellayout (entget (vlax-vla-object->ename (vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object)))) '("*")))
  (setq list_psext (assoc -3 elist_modellayout))
  (if (/= (assoc "PLOTTRANSPARENCY" (cdr (assoc -3 elist_modellayout))) nil)
    (progn
      (setq list_psext-neu (subst 
        '("PLOTTRANSPARENCY" (1071 . 1))
        (assoc "PLOTTRANSPARENCY" (cdr list_psext))
        list_psext
      ))
      (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
      (entmod elist_modellayout-neu)
    )
    (progn
      (setq elist_modellayout-neu (subst 
        (list -3 (cadr list_psext) '("PLOTTRANSPARENCY" (1071 . 1)))
        (list -3 (cadr list_psext))
        elist_modellayout
      ))
      (entmod elist_modellayout-neu)
    )
  )
)

 

(Defun c:pp ()
  (if (not (tplot))
    (prompt "WARNING: PLOTTRANPARANCY NOT SET")
  )
)

 

I can not get it working... In some drawings i can not set de plottranparency with lisp!! Who can help?

Message 10 of 13

Well, i couldn't make it any simpler. You don't have to check if the "PLOTTRANSPARENCY" is there, just dump it in.

 

;;; arg1 - any layout

;;; arg2 - torn on/off 0 or 1

;;; return - Extended Entity Data
;;; call - (LayoutTransparensy (vla-get-activelayout (vla-get-activedocument(vlax-get-acad-object))) 1)
(defun LayoutTransparensy (layout ON / xType xData )
  (setq xData (vlax-make-safearray vlax-vbVariant '(0 . 1)))
  (setq xType (vlax-make-safearray vlax-vbInteger '(0 . 1)))
  (vlax-safearray-fill xData (list(vlax-make-variant "PLOTTRANSPARENCY")(vlax-make-variant ON)))
  (vlax-safearray-fill xType (list 1001 1071))
  (vla-setXdata layout  xType xData)
  (entmod(entget (vlax-vla-object->ename layout) '("*")))
)

Message 11 of 13

Perfect!! This works great!!
Message 12 of 13
3dwannab
in reply to: Azijtveld

Here's one for All layouts including model should you wish in one go here.

 

http://www.cadforum.cz/cadforum_en/how-to-set-plot-transparency-for-all-layouts-in-a-dwg-tip11604

Message 13 of 13
chriswade
in reply to: kefer_kb

I know this is a really old thread, but it helped me figure out an issue, although I did find a problem with the code in the solution. The solution only set the transparency to the model tab. I have quickly adjusted the code to set it for all layouts.

 

NOTE: I stopped reading at the solution; however, it appears that others had the issue as well.

 

 

;Code for Transparency adapted from: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/plot-transparency-option-in-plot-dialog-box/m-p/3618244/highlight/true#M306428 by kefer.kb
(defun LispTransparency (UseTransparency / elist_dict elist_modellayout list_psext list_psext-neu elist_modellayout-neu elist_modellayout-neu)

  ;----- Dictionary lesen
  (setq elist_dict (dictsearch (namedobjdict) "ACAD_LAYOUT"))
  
  (setq list_psext (assoc -3 elist_modellayout))

  (if UseTransprancy
    (progn
      ;----- Plot transparent
      (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 1)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext))
      (foreach pair (dictsearch (namedobjdict) "ACAD_LAYOUT")
        (if (= 3 (car pair))
          (progn
            (setq elist_modellayout (entget (cdr (car (cdr (member (cons 3 (cdr pair)) elist_dict)))) '("*")))
            (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
            (entmod elist_modellayout-neu)
          )
        )
      )
    )
    (progn
      ;----- Plot transparent
      (setq list_psext-neu (subst (list "PLOTTRANSPARENCY" '(1071 . 0)) (assoc "PLOTTRANSPARENCY" (cdr list_psext)) list_psext))
      (foreach pair (dictsearch (namedobjdict) "ACAD_LAYOUT")
        (if (= 3 (car pair))
          (progn
            (setq elist_modellayout (entget (cdr (car (cdr (member (cons 3 (cdr pair)) elist_dict)))) '("*")))
            (setq elist_modellayout-neu (subst list_psext-neu list_psext elist_modellayout))
            (entmod elist_modellayout-neu)
          )
        )
      )
    )
  )

);enddefun

 

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

Post to forums  

Autodesk Design & Make Report

”Boost