See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: CopyObjects method for Views?

  1. #1
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Default CopyObjects method for Views?

    Hi Gang,

    Can the CopyObjects method be used to copy Views from one drawing "database" to another? The help file refers: "The array of primary objects to be copied." Primary? Wassat?

    Related subject - copying views from drawing to drawing. What's the best way to do it - if CopyObjects cannot be used? Have you ever noticed that DesignCenter cannot copy views from drawing to drawing? Plus.. if you insert a drawing into another drawing - the views are not inserted (if the insert dwg has views). Plus... the Sheet Set Manager also does not appear to provide this facility, even though views are the corner stone of its methods (unless , that is, I just havent found it yet).

    Thx & Cheers,

    Kevin.

  2. #2
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: CopyObjects method for Views?

    Quote Originally Posted by kevin.barnett
    Hi Gang,

    Can the CopyObjects method be used to copy Views from one drawing "database" to another? The help file refers: "The array of primary objects to be copied." Primary? Wassat?
    Thx & Cheers,

    Kevin.
    Short answer, Yes, the CopyObjects is used to do this.

    Long answer, here is a llink to a lisp routine that does exactly what you want. You can either use it or you could translate it to VBA.

    http://www.cadvault.com/forums/showt...9173#post79173

  3. #3
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Default Re: CopyObjects method for Views?

    Grrrroooowwwlll...

    ***Scream*** AAAAAaaaaHHHhhhhhh!!!

    Jumps into ice bath to cool down.

    Thanks, the code you linked to is brilliant. I just cant see how to translate it to VBA and I am trying to break clean away from lisp. Why is AutoCAD's lisp always far ahead of it's VBA? Why cant its VBA be a complete instruction set handling all Acad drawing database objects (like lisp does)?

    Oh Well... Hmpf!

    Thanks again.

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    1

    Exclamation Re: CopyObjects method for Views?

    Quote Originally Posted by kevin.barnett
    Thanks, the code you linked to is brilliant. I just cant see how to translate it to VBA and I am trying to break clean away from lisp. Why is AutoCAD's lisp always far ahead of it's VBA? Why cant its VBA be a complete instruction set handling all Acad drawing database objects (like lisp does)?


    Actually, most of that code is using the ActiveX interface, so it is more VBA-like than it is traditional AutoLISP-like.

    All those (vla-*) functions are direct translations of the VBA methods and properties of the object model.

    Also, if you are using AutoCAD 2004 or 2005, you can ignore the registration portion of the code, as the .dll is automatically registered in those versions. FWIW, you wouldn't be able to do what the code shows without VBA support.

    It would be a great exercise for you to translate that code into VBA. That would give you a far better understanding of the similarities when using the ActiveX interface.

  5. #5
    100 Club KevinBarnett's Avatar
    Join Date
    2001-10
    Location
    Pretoria, South Africa
    Posts
    119
    Login to Give a bone
    0

    Default Re: CopyObjects method for Views?

    Hi Robert,

    I cant find the vla- subrs in the developers help file. It would be great if I could get a list of available vla's and the required arguments.

    Lets look at the lisp that performs the core action required:

    (vla-copyobjects oDBX vimport (vla-get-views doc))

    odbx = the source acaddocument object containing the views to be copied from
    vimport = list of view objects in the source dwg
    (vla-get-views doc) = this appears to get the collection of views in the current (or active) acaddocument

    So nice and simple. It makes you glow inside. WoW!


    Now lets look at the VBA version:

    RetVal = object.CopyObjects(Objects[, Owner][, IDPairs])


    It works!!!! Thanks Guys!!!

    retObjects = DwgVF.CopyObjects(CPObj, DwgVT.Views)

    dwgvf = the source acaddocument object containing the views to be copied from
    cpobj = array off view objects in the source dwg
    dwgvt = the current (or active) acaddocument

    That was also simple. ***causes another glow*** Wow!

    But I would still like a list of vla's. Does it exist?

    Have a great day!

    Cheers,

    Kevin.

  6. #6
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: CopyObjects method for Views?

    Quote Originally Posted by kevin.barnett
    But I would still like a list of vla's. Does it exist?
    Yes.
    1. Open the Autocad Developer Documentation ActiveX and VBA Reference
    2. For every item listed under "Methods" add a vla- to the begining. eg - vla-copyobjects
    3. For every item listed under 'Properties" add a vla-get- or vla-put to the beginning eg - vla-get-activedocument
    4. The required arguments are just as they are listed, although the way they are passed in vlisp sometimes takes a bit of trial and error to get it to work. And unlike VBA, if an argument is optional you still must pass something to it, even if it's nil.

    HTH
    Last edited by Jeff_M; 2004-07-01 at 11:10 PM.

Similar Threads

  1. VLA-Copyobjects
    By ccowgill in forum AutoLISP
    Replies: 4
    Last Post: 2010-11-21, 08:21 PM
  2. Method for Displaying Views
    By ARev-jkc in forum Revit Architecture - General
    Replies: 1
    Last Post: 2010-06-11, 09:05 AM
  3. Help with CopyObjects
    By singh.robbie in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-12-08, 09:59 PM
  4. use copyobjects method with xrefs?
    By KevinBarnett in forum VBA/COM Interop
    Replies: 1
    Last Post: 2005-03-01, 05:27 PM
  5. 2002 best method for generating 2d views
    By COLESF in forum AutoCAD 3D (2006 or below)
    Replies: 16
    Last Post: 2005-02-25, 04:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •