VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

layer transparant

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
208 Views, 4 Replies

layer transparant

I would like to insert block on the picked layer and then go back to the
active layer in my drawing ( a sort of transparant command).
Can sambody please help me?
Here is the code with layers i got so far.....

Private Sub ComboBox2_Click()
Dim PickLayer As String
Dim NewLayer As AcadLayer

PickLayer = ComboBox2.Text
Set NewLayer = ThisDrawing.Layers(PickLayer)
Unload Me
ThisDrawing.ActiveLayer = NewLayer
End Sub

Private Sub UserForm_Initialize()
Dim entry As AcadLayer
For Each entry In ThisDrawing.Layers
ComboBox2.AddItem entry.Name
Next
End Sub

Thanx in advance!
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Hi Suky,

Don't bother to change layers.

Simply assign the new layer to the block reference.

"suky" wrote in message
news:87D48A569203F085B02C00A11550553B@in.WebX.maYIadrTaRb...
> I would like to insert block on the picked layer and then go back to the
> active layer in my drawing ( a sort of transparant command).
> Can sambody please help me?
> Here is the code with layers i got so far.....
>
> Private Sub ComboBox2_Click()
> Dim PickLayer As String
> Dim NewLayer As AcadLayer
>
> PickLayer = ComboBox2.Text
> Set NewLayer = ThisDrawing.Layers(PickLayer)
> Unload Me
******************
> ThisDrawing.ActiveLayer = NewLayer ** Not needed
Somewhere use:
blockreference.layer = NewLayer
*******************
> End Sub
>
> Private Sub UserForm_Initialize()
> Dim entry As AcadLayer
> For Each entry In ThisDrawing.Layers
> ComboBox2.AddItem entry.Name
> Next
> End Sub
>
> Thanx in advance!
>
>
>
>
Message 3 of 5
Anonymous
in reply to: Anonymous

Thanx Laurie 🙂
"Laurie Comerford" schreef in bericht
news:A83F2701562A7D91A901FB4EF054CBE1@in.WebX.maYIadrTaRb...
> Hi Suky,
>
> Don't bother to change layers.
>
> Simply assign the new layer to the block reference.
>
> "suky" wrote in message
> news:87D48A569203F085B02C00A11550553B@in.WebX.maYIadrTaRb...
> > I would like to insert block on the picked layer and then go back to the
> > active layer in my drawing ( a sort of transparant command).
> > Can sambody please help me?
> > Here is the code with layers i got so far.....
> >
> > Private Sub ComboBox2_Click()
> > Dim PickLayer As String
> > Dim NewLayer As AcadLayer
> >
> > PickLayer = ComboBox2.Text
> > Set NewLayer = ThisDrawing.Layers(PickLayer)
> > Unload Me
> ******************
> > ThisDrawing.ActiveLayer = NewLayer ** Not needed
> Somewhere use:
> blockreference.layer = NewLayer
> *******************
> > End Sub
> >
> > Private Sub UserForm_Initialize()
> > Dim entry As AcadLayer
> > For Each entry In ThisDrawing.Layers
> > ComboBox2.AddItem entry.Name
> > Next
> > End Sub
> >
> > Thanx in advance!
> >
> >
> >
> >
>
>
Message 4 of 5
Anonymous
in reply to: Anonymous

What happens when the original block has more than 1 layer? And, what if the
layer names of the original block are not present in the drawing?

Laurie Comerford ha escrito:

> Hi Suky,
>
> Don't bother to change layers.
>
> Simply assign the new layer to the block reference.
>
> "suky" wrote in message
> news:87D48A569203F085B02C00A11550553B@in.WebX.maYIadrTaRb...
> > I would like to insert block on the picked layer and then go back to the
> > active layer in my drawing ( a sort of transparant command).
> > Can sambody please help me?
> > Here is the code with layers i got so far.....
> >
> > Private Sub ComboBox2_Click()
> > Dim PickLayer As String
> > Dim NewLayer As AcadLayer
> >
> > PickLayer = ComboBox2.Text
> > Set NewLayer = ThisDrawing.Layers(PickLayer)
> > Unload Me
> ******************
> > ThisDrawing.ActiveLayer = NewLayer ** Not needed
> Somewhere use:
> blockreference.layer = NewLayer
> *******************
> > End Sub
> >
> > Private Sub UserForm_Initialize()
> > Dim entry As AcadLayer
> > For Each entry In ThisDrawing.Layers
> > ComboBox2.AddItem entry.Name
> > Next
> > End Sub
> >
> > Thanx in advance!
> >
> >
> >
> >
Message 5 of 5
Anonymous
in reply to: Anonymous

jarodriguez@jet.es says...
> What happens when the original block has more than 1 layer?
Only the blockreference, itself, gets placed on the layer. It is the
same as if you inserted the block manually and then changed its layer
property.

> And, what if the layer names of the original block are not
> present in the drawing?
They get created just as if you inserted the block manually.

===============================
Mike Tuersley
PhD @ CADalyst's AutoCAD Clinic
http://www.cadonline.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost