Change active drawing with visual lisp in Autocad 2005?

Discussion in 'AutoCAD' started by Ted Kyte, Feb 26, 2005.

  1. Ted Kyte

    Ted Kyte Guest

    Any help with this little problem would be appreciated...

    I am trying to copy with a base point from one drawing to another.
    The copybase works fine and the _pasteclip works fine but I can't get the
    pasteclip to happen in the drawing that I load. It pastes it back in the
    original. Yet the loaded drawing appears to be the current or active
    drawing.

    Here is what I have so far.

    (
    Command
    "copybase"
    "0,0"
    "w"
    "-1000',-1000'"
    "1000',1000'" ""

    "vbastmt" "AcadApplication.Documents.Open \"C:/drawings/testblank.dwg\""

    ;;; I want this following paste to be in testblank.dwg not back in the
    original it was copied from...
    "_pasteclip"
    "0,0"
    )

    Thanks in advance....

    Ted
     
    Ted Kyte, Feb 26, 2005
    #1
  2. The clipboard is not the correct way to copy objects from
    one document or space, to another. The clipboard is for the
    user to do things like that manually.

    When you're copying via a script or program, there are better
    ways to do it, that don't interfere with the user (technically,
    the user 'owns' the clipboard - scripts and programs are not
    supposed to alter its contents).

    You can use the ActiveX API to do what you need, more
    specifically the CopyObjects method of the AcadDocument
    object.

    My first suggestion would be to search this newsgroup
    using the keyword 'CopyObjects', or 'vla-copyobjects',
    and see what you come up with. Then, if you're still
    unsure about how to go about it, post another query.

    The problem your approach has, is that your code runs
    in one document only, and as soon as another document
    is activated, your code's execution is suspended until
    the document it was started in is current again. There is
    no simple way around this, and the easiest way to do
    what you need is to use ObjectDBX to access the drawing
    that you want to copy the objects into.
     
    Tony Tanzillo, Feb 26, 2005
    #2
  3. Ted Kyte

    Nirmal Guest

    I have also got same problem in the past. I foud that it is very difficult to do with LISp. You can do it easily using VBA. his can be done in batch process also.
     
    Nirmal, Mar 14, 2005
    #3
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.