Set Transparency on a new Layer

Set Transparency on a new Layer

mmP3TWV
Participant Participant
983 Views
8 Replies
Message 1 of 9

Set Transparency on a new Layer

mmP3TWV
Participant
Participant

Is it possible, tat I can not directly Set the property Transparency when I generate new layers but have to create my layer first and change  the Transparency later? 

 

Tried with 

(CREATE-LAYER "Gebäude_Schraffur" '((COLOR . 253) (DESCRIPTION . "01211F") (LINETYPE . "Continuous") (LINEWEIGHT . "20") (TRANSPARENCY . "50")))

And got a Message that Transparency was unknown  

mmP3TWV_1-1703069875381.png

 

0 Likes
Accepted solutions (3)
984 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant

Post CREATE-LAYER function to take a look

0 Likes
Message 3 of 9

komondormrex
Mentor
Mentor
Accepted solution

layer transparency has to be set via extended data.

komondormrex_0-1703073265962.png

 

 

 

 

Message 4 of 9

paullimapa
Mentor
Mentor
Accepted solution

Thoroughly discussed here 

https://www.theswamp.org/index.php?topic=52473.0


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

If you just use an ordinary LAYER command in an AutoLisp (command) function, instead of a specialty routine, it's easy, and does not require going into extended data:

(command "_.layer" "_make" "Gebäude_Schraffur" "_color" 253 "" "_description" "01211F" "Gebäude_Schraffur" "_lweight" 20 "" "_transparency" 50 "" "")

 

Oddly, the default-on-Enter Layer application in the Description option is not to just the current Layer as with most options, but to all Layers, so it's necessary to spell out the Layer name again for that.

 

The numerical entries do not need to be as text strings.

 

It is not necessary to assign Continuous linetype to a new Layer -- that is the default.

 

[Also, I spelled out the option names in full, but if you use the abbreviations, it takes less code than the specialty (CREATE-LAYER) function needs.]

Kent Cooper, AIA
Message 6 of 9

mmP3TWV
Participant
Participant

Thank You all for the great support on this topic. I will give the extended data a try as I need to build a ton of new layers and like the tidiness of the specialty routine. But the command function is a welcome backup.

0 Likes
Message 7 of 9

mmP3TWV
Participant
Participant

I work with  the basic solution from autolisp.info with subfunctions.

 

; Erzeugt einen neuen Layer
(defun create-layer(name props / newlayer)
  (setq newlayer
    (vla-add (document-layers) name)
  )
  (foreach prop props
    (vlax-put-property
      newlayer (car prop)(cdr prop)
    )
  )
  newlayer
)
        

 

https://activex.autolisp.info/layreactor.html

 

 

0 Likes
Message 8 of 9

komondormrex
Mentor
Mentor

funny thing, but the layer transparency could be set beyond 90% limit using xdata.

komondormrex_0-1703490375417.pngkomondormrex_1-1703490465889.png

 

Message 9 of 9

Sea-Haven
Mentor
Mentor

"I need to build a ton of new layers" for me make Kents solution a (defun and pass it name, color, linetype, transparency. For a 100 layers I would use a csv file hence the hint. Just read the file. You can save all the info in Excel and make the csv file. Even using command will still be fast. I would do a (princ layname) as you read a line so you can see something happening. 

0 Likes