Importing a named view

Jason Piercey

Usenet Archive
Joined
Jun 30, 2003
Messages
868
Reaction score
0
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,
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)))
 
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
)
)
)
 
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
 

Latest threads

Back
Top