Set transparency of all entities in the drawing to "ByLayer" issue

Set transparency of all entities in the drawing to "ByLayer" issue

danglar
Advocate Advocate
1,854 Views
5 Replies
Message 1 of 6

Set transparency of all entities in the drawing to "ByLayer" issue

danglar
Advocate
Advocate

This routine, modified by me, can set transparency of all entities in the drawing to 0 (see attached lisp)
but I need to set it to "ByLayer".
I tryed to change this string

 

(setq n 0) 
 

to somethihg like this..

 
(setq n "ByLayer")
 

but in this case autocad session crashed...
Can somebody help me to solve this problem?

0 Likes
1,855 Views
5 Replies
Replies (5)
Message 2 of 6

ВeekeeCZ
Consultant
Consultant

This is another approach...

 

(defun c:TS0 ( / ss)
  (if (setq ss (ssget "_A"))
    (command "_.CHPROP" ss "" "_TR" "BYLAYER" ""))
  (princ)
)
0 Likes
Message 3 of 6

phanaem
Collaborator
Collaborator

@apelbaum2014 wrote:

This routine, modified by me, can set transparency of all entities in the drawing to 0 (see attached lisp)
but I need to set it to "ByLayer".
I tryed to change this string

 

(setq n 0) 
 

to somethihg like this..

 
(setq n "ByLayer")
 

but in this case autocad session crashed...
Can somebody help me to solve this problem?


Looks verry similat to this one...

"ByLayer" transparency correspond to DXF code (440 . 0), which is different than what my lisp does for n = 0.
If you want a lisp solution, please check this code:

 

(defun c:ts0 ( / ss i)
  (if
    (setq ss (ssget "_A"))
    (repeat (setq i (sslength ss))
      (entmod
        (append
          (entget (ssname ss (setq i (1- i))))
	  '((440 . 0))
          )
        )
      )
    )
  (princ)
  )
0 Likes
Message 4 of 6

cwilczak
Explorer
Explorer

Looking for a way to set a user selected specific entity layer (lets say its an nested hatch object in an xref), and i want to set the layer transparency to a user entered value. Is there a way to modify this code to do so?

0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

@cwilczak wrote:

Looking for a way to set a user selected specific entity layer (lets say its an nested hatch object in an xref), and i want to set the layer transparency to a user entered value. Is there a way to modify this code to do so?


Setting the transparency of a Layer is a rather different thing than of drawing entities, as well as doing one Layer vs. all drawing entities, so modifying the earlier routines here doesn't seem like the best approach.  This will do it:

 

(defun C:TSL () ; = Transparency of Selected [can be nested] Layer

  (command "_.layer" "_transparency" pause (cdr (assoc 8 (entget (car (nentsel))))) "")

  (princ)

)

Kent Cooper, AIA
0 Likes
Message 6 of 6

cwilczak
Explorer
Explorer

WORKS GREAT!! thank you @Kent1Cooper 

0 Likes