Inserting a block

Discussion in 'AutoCAD' started by thenrich, Oct 14, 2004.

  1. thenrich

    thenrich Guest

    Is there something I can implement that would allow a block that's being inserted to switch the current layer of the drawing it's being inserted on?
     
    thenrich, Oct 14, 2004
    #1
  2. thenrich

    jtaylor Guest

    If you know some vba you could use the autocad document reactor named
    BeginCommand to trap the insert command and change the current layer or
    possibley grab the block handle to manipulate it.
    Jim Taylor
    inserted to switch the current layer of the drawing it's being inserted on?
     
    jtaylor, Oct 14, 2004
    #2
  3. If you are inserting the block using VBA then it would be easy.

    inserted to switch the current layer of the drawing it's being inserted on?
     
    Mark Johnston, Oct 15, 2004
    #3
  4. thenrich

    thenrich Guest

    If it were that easy I wouldn't be here. As mentioned above the block is being inserted from several different application. I don't want to have to change the code in every app.
     
    thenrich, Oct 15, 2004
    #4
  5. thenrich

    thenrich Guest

    Yup I know VBA, VB, .NET and C. I think the event handler approach will be the avenue I go down if nothing better comes along. I was just hoping there was something I was missing.
     
    thenrich, Oct 15, 2004
    #5
  6. thenrich

    Michael Barb Guest

    Just remember that with VBA there is only one task per application. If you
    have an event handler running in the background you could not run another
    VBA program. (There might be a way but it would be messy)

    Michael
     
    Michael Barb, Oct 15, 2004
    #6
  7. You can have event handlers in VBA and run other VBA programs.
    Regards - Nathan
     
    Nathan Taylor, Oct 18, 2004
    #7
  8. thenrich

    Michael Barb Guest

    In VB you can and it works well. In VBA, good luck. I have never seen
    anyone get this to work properly with unreated threads.

    Michael
     
    Michael Barb, Oct 19, 2004
    #8
  9. thenrich

    AKS Guest

    If your layer rules are such that the block is supposed to exist on only one layer and if the reasons for doing so are for display control purposes only, then define the block so that its elements are on that special layer instead of layer 0. You will have side-stepped the entire issue. Otherwise, you might be better off creating a cleanup routine triggered by beforesave and beforeprint. You would then gain the flexibility to throw in all the other cleanup items that might also be needed.
     
    AKS, Oct 19, 2004
    #9
  10. I know you can not have a VBA application constantly running and run others. What you seem to be saying though is that you can not have event handlers and run other VBA programs. If this is what you are saying you are incorrect.
    Regards - Nathan
     
    Nathan Taylor, Oct 19, 2004
    #10
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.