Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 1 of 11 (1,243 Views)
Accepted Solution

Plot Transparency option in PLOT dialog box

1243 Views, 10 Replies
09-11-2012 03:07 PM

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??

 

 

 

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.)

Active Contributor
kefer.kb
Posts: 27
Registered: ‎08-17-2011
Message 2 of 11 (1,230 Views)

Re: Plot Transparency option in PLOT dialog box

09-11-2012 11:40 PM in reply to: MetroVancouverDrafting

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
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 3 of 11 (1,216 Views)

Re: Plot Transparency option in PLOT dialog box

09-12-2012 07:37 AM in reply to: kefer.kb

 

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.

 

Active Contributor
kefer.kb
Posts: 27
Registered: ‎08-17-2011
Message 4 of 11 (1,200 Views)

Re: Plot Transparency option in PLOT dialog box

09-13-2012 01:01 AM in reply to: MetroVancouverDrafting

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
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 5 of 11 (1,193 Views)

Re: Plot Transparency option in PLOT dialog box

09-13-2012 07:57 AM in reply to: kefer.kb

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

Member
Alberttvz
Posts: 5
Registered: ‎10-30-2012
Message 6 of 11 (1,112 Views)

Re: Plot Transparency option in PLOT dialog box

10-30-2012 01:05 AM in reply to: MetroVancouverDrafting

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))) ))
  )

 )

 

Member
Alberttvz
Posts: 5
Registered: ‎10-30-2012
Message 7 of 11 (1,071 Views)

Re: Plot Transparency option in PLOT dialog box

11-09-2012 04:12 AM in reply to: MetroVancouverDrafting

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

Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 8 of 11 (1,016 Views)

Re: Plot Transparency option in PLOT dialog box

11-26-2012 11:31 AM in reply to: Alberttvz

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

 

Member
Alberttvz
Posts: 5
Registered: ‎10-30-2012
Message 9 of 11 (936 Views)

Re: Plot Transparency option in PLOT dialog box

01-25-2013 01:08 AM in reply to: MetroVancouverDrafting
(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?

Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 10 of 11 (910 Views)

Re: Plot Transparency option in PLOT dialog box

01-29-2013 09:53 AM in reply to: MetroVancouverDrafting

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) '("*")))
)

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.