Results 1 to 3 of 3

Thread: Change transparency of a layer on Autocad using vba

  1. #1
    Member
    Join Date
    2018-03
    Posts
    4
    Login to Give a bone
    0

    Default Change transparency of a layer on Autocad using vba

    Hello,

    I am trying to change the transparency percentage of a layer using VBA.

    tHIS IS my code:

    Code:
    Sub Access_Autocad() 'nom de ma procédure
    Dim AutoCAD As Object 'Autocad est la variable ici
    Set AutoCAD = CreateObject("Autocad.Application") 'ouvre AutoCad
    AutoCAD.Visible = True
    Set AutoCAD = AutoCAD.Documents.Open("P:\Plannif_VBA_AutoCAD\PLA_TEN_C18_406_RONDES.dwg") 'ouvre fichier ronde
    Dim layer_ronde As AcadLayer
    Set layer_ronde = AutoCAD.Layers.Add("99103") 'attribuer à la ronde le nom du calque correspondant
    layer_ronde.Color = acRed 'cahanger la couleur du calque
    Dim layer_ronde1 As AcadLayer
    Set layer_ronde1 = AutoCAD.Layers.Add("99103")
    layer_ronde1.Color = 12
    Dim layer_ronde2 As AcadLayer
    Set layer_ronde2 = AutoCAD.Layers.Add("99105")
    layer_ronde2.Color = 16
    Dim layer_ronde3 As AcadLayer
    Set layer_ronde3 = AutoCAD.Layers.Add("99106")
    layer_ronde3.Color = 5
    I thought abput using layer_ronde3.Transparency and then equal that to the percentage of transparency needed.

    However....Transparency only works for Image. At least, that what i understood.

    I think there is a method to convert it but i been looking and can't find it.
    cOULD SOMEONE HELP ME?

    I began Learning vba 2 days ago so i have a lot to learn.
    Last edited by Ed Jobe; 2018-03-15 at 08:50 PM.

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Change transparency of a layer on Autocad using vba

    Sorry, its not available to the vba api. You need to use .net. See this help topic. To use vba, you would need to work with the layer command using the ThisDrawing.SendCommand method.

    Here is a thread about using lisp to access the AcCmTransparency table directly to get the Transparency property of a layer. I haven't examined the possibility to translate it to vba.
    Last edited by Ed Jobe; 2018-03-15 at 09:50 PM.
    C:> ED WORKING....

  3. #3
    Woo! Hoo! my 1st post
    Join Date
    2011-12
    Posts
    1
    Login to Give a bone
    0

    Default Re: Change transparency of a layer on Autocad using vba

    You can get it through XData, but not set it.

    http://adndevblog.typepad.com/autoca...sing-lisp.html

Similar Threads

  1. Replies: 8
    Last Post: 2014-11-07, 12:11 PM
  2. 2012: Layer transparency
    By depth3d in forum AutoCAD General
    Replies: 1
    Last Post: 2011-10-03, 11:14 AM
  3. Presenter materials DO NOT change transparency in Animator
    By WT-09 in forum NavisWorks - General
    Replies: 0
    Last Post: 2010-10-28, 07:27 PM
  4. Change transparency behaviour back to as it was in Revit 2008
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 3
    Last Post: 2008-07-22, 02:07 PM
  5. Replies: 7
    Last Post: 2006-05-05, 01:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •