Importing a named view

Discussion in 'AutoCAD' started by Jason Piercey, Feb 5, 2004.

  1. I know that Tony has a objectDbx application to do this,
    (which it blinding fast and super handy) but I only need a
    particlar view imported rather than every view in a source
    document.

    I can get the view imported ok, but the associated data
    doesn't come along for the ride.

    A view does not have any xdata (at least by "acad")
    A view does not have an extension dictionary,

    Must I 'get' each property from the source and 'put' to
    the target?
     
    Jason Piercey, Feb 5, 2004
    #1
  2. Jason Piercey

    Doug Broad Guest

    Jason,
    Have you considered the copyobjects method?

    I haven't tested this but it should work.


    (vl-load-com)
    ;;Format: (copyview <vla-doc-object> <vla-doc-object><string>)
    (defun copyview (fromdoc todoc name)
    ;;D. C. Broad, Jr. 2/5/2004
    (vlax-invoke
    fromdoc
    'copyobjects
    (list
    (vla-item
    (vla-get-views fromdoc)
    name))
    (vla-get-modelspace todoc)))
     
    Doug Broad, Feb 5, 2004
    #2
  3. I assumed you were using CopyObjects to copy the view
    from one document to the other. Is that what you're
    doing?

    If not, then try something like this:

    (setq dbxdoc
    (vla-GetInterfaceObject *acad* "ObjectDBX.AxDbDocument")
    )

    (setq ThisDwg
    (vla-get-ActiveDocument *acad*)
    )

    (setq SourceView
    (vla-item
    (vla-get-Views dbxdoc)
    "MyView"
    )
    )



    (vla-CopyObjects
    dbxDoc
    (list->Variant (list sourceView))
    (vla-get-Views ThisDwg)
    )



    (defun List->Variant (vartype lst)
    (vlax-Make-Variant
    (vlax-SafeArray-Fill
    (vlax-Make-SafeArray vartype
    (cons 0 (1- (length lst)))
    )
    lst
    )
    )
    )
     
    Tony Tanzillo, Feb 5, 2004
    #3
  4. Thanks gents. I was not using copyObjects.
     
    Jason Piercey, Feb 6, 2004
    #4
  5. Jason Piercey

    James Buzbee Guest

    Jason,

    I just posted a little routine in the CF NG which Imports a selected saved
    UCS. With a little tweaking you can make it work for views as well. (and
    blocks, layers, dimstyles . . ..) It uses ObjectDCL as the interface - just
    because I don't use dcl anymore. You could certainly pen a dcl dialog for
    it.

    Check it out. jb
     
    James Buzbee, Feb 6, 2004
    #5
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.