Processing between 2 drawings?

Discussion in 'AutoCAD' started by RaghuMN, Mar 23, 2005.

  1. One could just as easily ask what practical applications are
    there in being able to concurrently access multiple files of any
    type (ASCII text files, word documents, spreadsheets, etc.).

    If you'd like a concrete example, I've done applications that
    propagate data from a single 'source' drawing, to multiple target
    drawings. The source drawing stays open in an AxDbDocument,
    and each target drawing is sequentially opened; updated by
    copying objects into it from the source drawing; and then saved.

    Another example that is somewhat the inverse of that, is an
    application that works like AutoCAD MAP, where you can execute
    a 'query' of sorts, against many .DWG files on disk, and have the
    resulting entities that match the query copied into a single
    document (which can be either an open drawing in the editor,
    or DWG file on disk).
     
    Tony Tanzillo, Apr 4, 2005
    #21
  2. RaghuMN

    Joe Burke Guest

    Tony,

    I guess my question to Jeff wasn't clear. I'm not questioning the idea of using
    ObjectDBX to operate on multiple files. Rather the idea you might have all of them
    open at the same time.

    I think your second paragraph below suggests each document is opened, updated, saved
    and released in sequence.

    Joe Burke
     
    Joe Burke, Apr 4, 2005
    #22
  3. RaghuMN

    RaghuMN Guest

    Thanks Alan,

    This is a good idea. I'll try and get back.
    Ideally, this SHOULD work.

    Thanks,

    MNRaghu
     
    RaghuMN, Apr 5, 2005
    #23
  4. Joe - I read 'multiple concurrent ODBX files' as meaning more
    than one, but not necessarily 'all of them'.

    For processing multiple drawing files, I can't think of any reason
    why they should all be open concurrently, and that's not a wise
    thing to do.
    Yes, while another AxDbDocument remained open, hence the
    example had two AxDbDocuments open concurrently.
     
    Tony Tanzillo, Apr 5, 2005
    #24
  5. RaghuMN

    LUCAS Guest

    ;;BY LUCAS
    ;;Make sure the other dwg not opened
    (defun C:COPY_2_OTHER_DWG (/ DOC LST N NEWDWG SS NAME)
    (vl-load-com)
    (if (and (setq SS (ssget (list (cons 410 (getvar "ctab"))
    (cons 0 (strcat "~" "VIEWPORT"))
    )
    )
    )
    (setq NAME (getfiled "Select Dwg" (getvar "ACADPREFIX") "dwg" 8))
    (setq NAME (findfile NAME))
    )
    (progn
    (setq N -1
    DOC (vla-get-activedocument (vlax-get-acad-object))
    NEWDWG (vla-open (vla-get-documents (vlax-get-acad-object))
    NAME
    )
    )
    (repeat (sslength SS)
    (setq LST
    (cons (vlax-ename->vla-object (ssname SS (setq N (1+ N))))
    LST
    )
    )
    )
    (vla-copyobjects
    DOC
    (vlax-safearray-fill
    (vlax-make-safearray
    vlax-vbobject
    (cons 0 (1- (length LST)))
    )
    LST
    )
    (if (equal (getvar "ctab") "Model")
    (vla-get-modelspace NEWDWG)
    (vla-get-paperspace NEWDWG)
    )
    )
    (vla-saveas NEWDWG NAME acnative)
    (vla-close NEWDWG)
    (vlax-release-object DOC)
    (vlax-release-object NEWDWG)
    )
    )
    (princ)
    )
     
    LUCAS, Apr 6, 2005
    #25
  6. RaghuMN

    Joe Burke Guest

    Tony,

    Thanks for the clarification. Also for your input on this topic. It is appreciated.

    Joe Burke
     
    Joe Burke, Apr 6, 2005
    #26
  7. RaghuMN

    RaghuMN Guest

    LUCAS,

    Very useful, nice and appreciated.
    Thanks for the help.

    MNRaghu
     
    RaghuMN, Apr 7, 2005
    #27
  8. RaghuMN

    Joe Burke Guest

    MNRaghu,

    I have tested code based on the methods I suggested previously. I'll post if you care
    to take a look.

    The copy to (target) documents may be open or closed.

    It has an option I often find useful. Copy the objects as a group to target
    documents. That allows easy selection of the copied objects when they were placed on
    existing crowded layers.

    Joe Burke
     
    Joe Burke, Apr 7, 2005
    #28
  9. RaghuMN

    RaghuMN Guest

    Joe Burke,

    Many Thanks for the offer.

    I am curious to know the method that you have adopted and I request you to share the code that you have written.

    Sorry that I could not work much (due to changed job priorities) on your guidelines that you gave me earlier, though they were meaningful.

    Thanks,

    MNRaghu
     
    RaghuMN, Apr 8, 2005
    #29
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.