Layer transparency and blocks

Layer transparency and blocks

svucic
Advocate Advocate
21,273 Views
6 Replies
Message 1 of 7

Layer transparency and blocks

svucic
Advocate
Advocate

Hi everyone,

 

i'm trying to set the transparency of objects via autolisp. I'm using the following code:

 

(setq flag (tblsearch "LAYER" "Uklonjeno"))

				(if (= flag nil)
					(progn
					(command "Layer" "M" "Uklonjeno" "c" "red" "" "")
					(command "_LAYER" "_TR" 80 "Uklonjeno" "")
					(command "laymch" selnosacea "" "n" "Uklonjeno")
					)
					(progn
					(command "laymch" selnosacea "" "n" "Uklonjeno")
					)
				)

It creates the new layer and sets its transparency to 80 %. However the blocks thaht are moved to the new layer are not transparent. 

 

Due to compatibility reasons i'm working in 2000 version of dwg. 

[Edit] The blocks are saved as 2000 version dwg. The dwg I'm working in is no saved. The default save option is 2000.

0 Likes
Accepted solutions (2)
21,274 Views
6 Replies
Replies (6)
Message 2 of 7

krzysztof.psujek
Advocate
Advocate
...

It creates the new layer and sets its transparency to 80 %. However the blocks thaht are moved to the new layer are not transparent. 

 

 


Hi,

it seems you have problem with blocks.

Check transparency of objects within block definition. 

Set it to ByLayer and then should work.

 

If it's not the reason post your drawing it will be easier to diagnose. 

 

Chris

 

0 Likes
Message 3 of 7

svucic
Advocate
Advocate

It's allready set to "ByLayer". Some blocks behave normal and some just wont show transparent. I can't find any difference between them. 

Here is the dwg and the  AutoCAD Block Reference Interface retrieved by VLAX-DUMP-OBJECT. I tried to compare the block that is showing transparent and the one that is not.

 

 

0 Likes
Message 4 of 7

dbroad
Mentor
Mentor
Accepted solution

Edit the block definitions and change the internal objects from layer znak to layer 0.  Then they will inherit the layer properties of the block.

Architect, Registered NC, VA, SC, & GA.
Message 5 of 7

svucic
Advocate
Advocate

That worked. Thank you!

 

Would it be possible to that trough autolisp or visual lisp instead trough block editor?

0 Likes
Message 6 of 7

krzysztof.psujek
Advocate
Advocate
Accepted solution

Hi,

first read this or some similar articles http://www.ellenfinkelstein.com/acadblog/on-which-layers-should-you-create-blocks/.

 

There are a lot of routines that move object within block to 0 layer, and for sure you could find at least few of them on this forum.

You can also check this LeeMac's great function http://lee-mac.com/applytoblockobjects.html 

and look at example usage of it.

 

Chris

Message 7 of 7

svucic
Advocate
Advocate

Actually I didn't create the blocks, I got them from other source. And I just found Lee Mac's function and implemented it.  

 

Thanks to all! 

0 Likes