VP transparency

VP transparency

jeremye86
Advocate Advocate
1,018 Views
2 Replies
Message 1 of 3

VP transparency

jeremye86
Advocate
Advocate

Is it possible to change the VP transparency of a layer?  LISP, vba or whatever code?

 

jeremye86_0-1609247841434.png

 

 

 

0 Likes
1,019 Views
2 Replies
Replies (2)
Message 2 of 3

stefanveurink68AXD
Advocate
Advocate

Don't think this is possible in vba, but in .net api it must be possible.

 

reason i say this is with .net api is also possible to change vplineweight, vpcolor, so surely vptransparency must be there too. 

 

only possible way i see in vba is by maybe using a dictionary. but dont know anything about this. 

 

0 Likes
Message 3 of 3

norman.yuan
Mentor
Mentor

As @stefanveurink68AXD pointed out, with AutoCAD .NET API, you can write code to do it via LayerViewportProperties class. 

 

While there is no direct API support with AutoCAD COM API/VBA, if you really have to do it in VBA, you have to dig into undocumented ExtensionDictionary of AcadLayer object. Something like:

 

1. Test if an AcadLayer has ExtensionDictionary or not;

2. If it has, test if the dictionary has key "ADSK_XREC_LAYER_ALPHA_OVR" (the other 2 keys for layer's viewport overrides are "ADSK_XREC_LAYER_LINETYPE_OVR" and "ADSK_XREC_LAYER_LINEWT_OVR");

3. If the key exists, get the value of the dictionary item (Xrecord) form that key;

4. Parse the Xrecord to find the Alpha value (0-255) of the transparency applied to specific viewport;

5. Change the Alpha value in the Xrecord as needed

 

Again, since it is not exposed via API/not documented, it is up to you to investigate how the data are stored in ExtensionDictionary and parse/change it correctly.

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes