Return Layer that Block is inserted on

Discussion in 'AutoCAD' started by mgray, Jan 9, 2004.

  1. mgray

    mgray Guest

    Does someone have a snipit of code that will show me how to return the layer name that a block is inserted on.

    Thanks
     
    mgray, Jan 9, 2004
    #1
  2. Look in the help file. Every object has a layer property which holds the name of its host layer In your case, grab the AcadBlockReference and access its layer.

    Dim oBlkRef As AcadBlockReference
    Dim basePnt As Variant
    ThisDrawing.Utility.GetEntity oBlkRef, basePnt, "Select an object"
    Msgbox oBlkRef.Layer

    Now, there is no error handling and this *assumes* you select a blockreference otherwise it willl fail - but it should get you started.

    Mike
    ______________________________________________
    Mike Tuersley
    Author - CADalyst's AutoCAD Clinic
    Lead AE/Consultant - RAND IMAGINiT Technologies
     
    Mike Tuersley, Jan 10, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.