dropping file into drawing

Discussion in 'AutoCAD' started by lorier, Aug 22, 2004.

  1. lorier

    lorier Guest

    Is it possible to define a reactor for dropping a file type into a drawing. For example, I'd like to drop bldg.pgn into a drawing and have my macro begin and use that file.

    tia
     
    lorier, Aug 22, 2004
    #1
  2. lorier

    bcoward Guest

    Wouldn't it be simpler and have better dynamic adaptability if you stick some code in an event handler. You of course are the judge of what you want to do so try this exercise and see what bubbles the boil.

    Put this code here:

    Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)

    MsgBox "AcadDocument_BeginCommand"

    End Sub

    And this

    Private Sub AcadDocument_ObjectAdded(ByVal Object As Object)

    MsgBox "AcadDocument_ObjectAdded"

    End Sub

    And this:

    Private Sub AcadDocument_EndCommand(ByVal CommandName As String)

    MsgBox "AcadDocument_EndCommand"

    End Sub

    Then drop a small file onto the drawing editor. Make sure it is a small file....you'll see why.

    Then...what do you think your possibilities are?? Still want to use a reactor?

    Good luck,

    Bob Coward
    CADS, Inc

    800-366-0946
     
    bcoward, Aug 23, 2004
    #2
  3. lorier

    lorier Guest

    That's a good idea. Where can I find the properties for this type of object? And what type of object is it?
     
    lorier, Aug 23, 2004
    #3
  4. lorier

    bcoward Guest

    They are events in the VBA IDE.

    Within the drawing editor Press Atl+F11

    Double click ThisDrawing

    In the code window combo (General), see and select AcadDocument.

    See and review what you see on the right (Declarations) combo. These are your event handlers. Click, begin, end, yada yada.

    Paste the code from previous post.

    Drop "small" file onto the drawing editor window. See how it works. Decide if you want to play here.

    Return past Go but do not collect $100 unless your boss rewards you for going beyond what you knew on Friday.

    Feel the power....

    Good luck,

    Bob Coward
    CADS, Inc

    800-366-0946
     
    bcoward, Aug 23, 2004
    #4
  5. lorier

    lorier Guest

    Try this: create a text file with a line or two of text. Save it as text.cad. What would I need to do, after dropping the file into autocad, to read that text and display it in a message box, for example?
     
    lorier, Aug 23, 2004
    #5
  6. lorier

    bcoward Guest

    So... if you did the recommended exercise which event do you think you would put the code into?

    Good luck,

    Bob Coward
    CADS, Inc

    800-366-0946
     
    bcoward, Aug 23, 2004
    #6
  7. lorier

    lorier Guest

    Private Sub AcadDocument_ObjectAdded(ByVal Object As Object)

    MsgBox "AcadDocument_ObjectAdded"

    End Sub
     
    lorier, Aug 23, 2004
    #7
  8. There appears to be some confusion here.

    First, you can't use 'reactors' directly in VB.

    Second, ActiveX Events are just wrappers around
    reactors.

    So, the example code you posted _is_ using reactors,
    you just don't know it.
     
    Tony Tanzillo, Aug 23, 2004
    #8
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.