ThisDrawing.SendCommand

Discussion in 'AutoCAD' started by Matt W, Sep 10, 2004.

  1. Matt W

    Matt W Guest

    I thought I read somewhere that the SendCommand method was supposedly
    fixed??
    In other words, you could open multiple drawings, send a command to the
    command line, such as one that would load and run a LSP and it wouldn't
    "hiccup" and run the LSP multiple times on the last drawing that was opened.

    Did I get some bad information along the way, or is there something more to
    it than just typing ThisDrawing.SendCommand (blah blah blah)??

    Thanks in advance
     
    Matt W, Sep 10, 2004
    #1
  2. Matt W

    Ed Jobe Guest

    I havn't tried what you are suggesting, but might "ThisDrawing" be your
    problem. If I understand you correctly, you should use the
    AcadApplication.Documents collection to avoid using SendCommand in the same
    doc.
     
    Ed Jobe, Sep 10, 2004
    #2
  3. Matt W

    Matt W Guest

    I've got SDI set to 1 so I'm opening 1 drawing at a time and changing it to
    AcadApplication.... made it worse!
    It seems to run the LSP as many times as there are drawings being processed.
    In other words, if I'm processing 3 drawings, it runs the LSP 3 times per
    drawing.

    I'm starting to think that wherever I read that, it was wrong.

    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | I havn't tried what you are suggesting, but might "ThisDrawing" be your
    | problem. If I understand you correctly, you should use the
    | AcadApplication.Documents collection to avoid using SendCommand in the
    same
    | doc.
    |
    | --
    | ----
    | Ed
    | ----
    | | > I thought I read somewhere that the SendCommand method was supposedly
    | > fixed??
    | > In other words, you could open multiple drawings, send a command to the
    | > command line, such as one that would load and run a LSP and it wouldn't
    | > "hiccup" and run the LSP multiple times on the last drawing that was
    | opened.
    | >
    | > Did I get some bad information along the way, or is there something more
    | to
    | > it than just typing ThisDrawing.SendCommand (blah blah blah)??
    | >
    | > Thanks in advance
    | >
    | > --
    | > Matt W
    | >
    | > I love deadlines
    | > I like the whooshing sound they make as they fly by.
    | >
    | >
    | >
    |
    |
     
    Matt W, Sep 10, 2004
    #3
  4. Matt W

    Eugene Guest

    I heard it was fixed in that it isn't always the last part of code
    processed. You could use sendcommand then continue in VBA.
    I'm still on 2002, so I haven't tested it.

    Eugene
     
    Eugene, Sep 10, 2004
    #4
  5. Matt W

    Matt W Guest

    That's what I read but that doesn't seem to be the case here.

    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | I heard it was fixed in that it isn't always the last part of code
    | processed. You could use sendcommand then continue in VBA.
    | I'm still on 2002, so I haven't tested it.
    |
    | Eugene
    |
    |
    | | > I've got SDI set to 1 so I'm opening 1 drawing at a time and changing it
    | to
    | > AcadApplication.... made it worse!
    | > It seems to run the LSP as many times as there are drawings being
    | processed.
    | > In other words, if I'm processing 3 drawings, it runs the LSP 3 times
    per
    | > drawing.
    | >
    | > I'm starting to think that wherever I read that, it was wrong.
    | >
    | > --
    | > Matt W
    | >
    | > I love deadlines
    | > I like the whooshing sound they make as they fly by.
    | >
    | > | > | I havn't tried what you are suggesting, but might "ThisDrawing" be
    your
    | > | problem. If I understand you correctly, you should use the
    | > | AcadApplication.Documents collection to avoid using SendCommand in the
    | > same
    | > | doc.
    | > |
    | > | --
    | > | ----
    | > | Ed
    | > | ----
    | > | | > | > I thought I read somewhere that the SendCommand method was
    supposedly
    | > | > fixed??
    | > | > In other words, you could open multiple drawings, send a command to
    | the
    | > | > command line, such as one that would load and run a LSP and it
    | wouldn't
    | > | > "hiccup" and run the LSP multiple times on the last drawing that was
    | > | opened.
    | > | >
    | > | > Did I get some bad information along the way, or is there something
    | more
    | > | to
    | > | > it than just typing ThisDrawing.SendCommand (blah blah blah)??
    | > | >
    | > | > Thanks in advance
    | > | >
    | > | > --
    | > | > Matt W
    | > | >
    | > | > I love deadlines
    | > | > I like the whooshing sound they make as they fly by.
    | > | >
    | > | >
    | > | >
    | > |
    | > |
    | >
    | >
    |
    |
     
    Matt W, Sep 10, 2004
    #5
  6. It depends upon what you are doing. Reality is it'll never be *fixed* in
    all cases. If you are doing something simple and not very process
    intensive, it should wait for the return. If you are doing something like
    calling a lisp routine that calls other routines, shells out, opens other
    docs, etc., it'll never wait.

    As always, the best fix is to not use the sendcommand at all - but I'm sure
    you've heard that before =)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 10, 2004
    #6
  7. Matt W

    Matt W Guest

    Really all it's doing is loading a LSP file that cleans up the drawing.
    It performs R Bell's layer filter delete, then a purge, then an audit, then
    another purge and audit just for good measure.

    The reason for it is simple. A client's drawings are never clean. At least
    not clean enough that I would be willing to use them.
    It seems that 9 times out of 10, their drawings are in some way, FUBAR,
    which in turn, has an uncanny way of FUBAR'ing *my* drawings.

    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | It depends upon what you are doing. Reality is it'll never be *fixed* in
    | all cases. If you are doing something simple and not very process
    | intensive, it should wait for the return. If you are doing something like
    | calling a lisp routine that calls other routines, shells out, opens other
    | docs, etc., it'll never wait.
    |
    | As always, the best fix is to not use the sendcommand at all - but I'm
    sure
    | you've heard that before =)
    |
    | -- Mike
    | ___________________________
    | Mike Tuersley
    | CADalyst's CAD Clinic
    | Rand IMAGINiT Technologies
    | ___________________________
    | the trick is to realize that there is no spoon...
     
    Matt W, Sep 10, 2004
    #7
  8. Matt W

    Jeff Mishler Guest

    So why not just convert the lisp to VBA? In fact, I think that RRB posted
    the LFD conversion not too long ago.......
     
    Jeff Mishler, Sep 10, 2004
    #8
  9. Matt W

    Matt W Guest

    I didn't know there was a VBA equal to his LSP. Do know which thread?
    So if that's the case, then....


    Thanks!
    You've been quite helpful the last two days.
    Can I buy you a beer??!?

    --
    Matt W

    I love deadlines
    I like the whooshing sound they make as they fly by.

    | So why not just convert the lisp to VBA? In fact, I think that RRB posted
    | the LFD conversion not too long ago.......
    |
    | --
    | Jeff
    | check out www.cadvault.com
    | | > Really all it's doing is loading a LSP file that cleans up the drawing.
    | > It performs R Bell's layer filter delete, then a purge, then an audit,
    | > then
    | > another purge and audit just for good measure.
    | >
    | > The reason for it is simple. A client's drawings are never clean. At
    | > least
    | > not clean enough that I would be willing to use them.
    | > It seems that 9 times out of 10, their drawings are in some way, FUBAR,
    | > which in turn, has an uncanny way of FUBAR'ing *my* drawings.
    | >
    | >
    |
    |
     
    Matt W, Sep 10, 2004
    #9
  10. Tell you what Matt, if you can't find it, email the lsp to me and I'll
    convert it for you and use it in my column as a LISP->VBA exercise [with
    Bob's approval of course - I *know* you're out there!]

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 10, 2004
    #10
  11. That could get expensive to buy a beer for everyone. But I'm not one to
    pass on a free beer so I will gladly take one. ;)

    --

    Thanks,

    David M. Gardner
    Change the DOT to reply.
     
    David M. Gardner, Sep 10, 2004
    #11
  12. Matt W

    Jeff Mishler Guest

    This isn't a translation, but it will remove ALL layerfilters, both pre-2005
    and post-2005.

    Sub LayerFilterDelete()
    Dim objDict As AcadDictionary
    Dim objRec As AcadObject
    If ThisDrawing.Layers.HasExtensionDictionary Then
    Set objDict = ThisDrawing.Layers.GetExtensionDictionary
    For Each objRec In objDict
    If (objRec.Name = "ACAD_LAYERFILTERS") Or _
    (objRec.Name = "AcLyDictionary") Then objDict.Remove objRec.Name
    Next
    End If

    End Sub
     
    Jeff Mishler, Sep 10, 2004
    #12
  13. Yup, it's not all that complicated is it. ;^)

    --
    R. Robert Bell


    This isn't a translation, but it will remove ALL layerfilters, both pre-2005
    and post-2005.

    Sub LayerFilterDelete()
    Dim objDict As AcadDictionary
    Dim objRec As AcadObject
    If ThisDrawing.Layers.HasExtensionDictionary Then
    Set objDict = ThisDrawing.Layers.GetExtensionDictionary
    For Each objRec In objDict
    If (objRec.Name = "ACAD_LAYERFILTERS") Or _
    (objRec.Name = "AcLyDictionary") Then objDict.Remove objRec.Name
    Next
    End If

    End Sub
     
    R. Robert Bell, Sep 10, 2004
    #13
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.