PDA

View Full Version : CopyObjects method for Views?



KevinBarnett
2004-06-25, 09:39 AM
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.

Jeff_M
2004-06-29, 10:55 PM
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/showthread.php?p=79173#post79173

KevinBarnett
2004-06-30, 01:25 PM
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.

RobertB
2004-06-30, 04:20 PM
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)?

:shock:

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.

KevinBarnett
2004-07-01, 06:19 AM
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.

Jeff_M
2004-07-01, 11:07 PM
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 :D