dbx Copy Layer
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
dbx Copy Layer

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
rgood
Guest





Posted: Tue Jan 04, 2005 7:41 pm    Post subject: dbx Copy Layer Reply with quote

I am writing a routine that will copy layers to the active dwg from another dwg.

Is there a method that will copy a layer object from one drawing layers dictionary to the current drawing layers dictionary

I have rulled out:
vla-copyfrom (dimstyles and plot configs)
vla-copyobjects
vla-copy

vla-add
Im thinking I will have to use vla-add and just set the new layer properties per the original layer properties.
(which 'I feel' is the long way to get there)

there must be a method that can copy a layer object.
mustn't there??

Robert Good.

Back to top
Kent Cooper, AIA
Guest





Posted: Tue Jan 04, 2005 8:11 pm    Post subject: Re: dbx Copy Layer Reply with quote

If you're writing a routine to do this, I assume maybe you're copying some
standard known set of layers from some standard base/source drawing. If so,
you could just have the routine make those layers in the active drawing,
instead of copying them from another. That can be as simple as a script, or
a macro routine, much more direct and obvious than vla-whatever. Or you
could just insert an empty drawing that contains those layers.

If it's not something as standardized as that, and requires some kind of
user input or selection or something, does importing layers through the
Design Center not do what you want?
--
Kent Cooper, AIA


"rgood" wrote...
Quote:
I am writing a routine that will copy layers to the active dwg from another
dwg.

Is there a method that will copy a layer object from one drawing layers
dictionary to the current drawing layers dictionary

I have rulled out:
vla-copyfrom (dimstyles and plot configs)
vla-copyobjects
vla-copy

vla-add
Im thinking I will have to use vla-add and just set the new layer
properties per the original layer properties.
(which 'I feel' is the long way to get there)

there must be a method that can copy a layer object.
mustn't there??

Robert Good.
Back to top
rgood
Guest





Posted: Tue Jan 04, 2005 8:35 pm    Post subject: Re: dbx Copy Layer Reply with quote

kent,
I already have a routine that creates layers with vla functions.
I just want to tinker with the possiblity of copying the layers from another dwg.

Thanks for the repy.
Robert Good.

Back to top
R. Robert Bell
Guest





Posted: Tue Jan 04, 2005 10:12 pm    Post subject: Re: dbx Copy Layer Reply with quote

Why did you rule out CopyObjects?

(The sample below does not include my DBX class.)

Sub Test()
Dim iDBX As MWObjectDBX.DBX
Set iDBX = MWObjectDBX.Init
iDBX.OpenDocument "C:\Temp\Original.dwg"

Dim orgLayers(0) As Object
Set orgLayers(0) = iDBX.Document.Layers.Item("Sample")
iDBX.Document.CopyObjects orgLayers, ThisDrawing.Layers
End Sub


--
R. Robert Bell


"rgood" <nospam@address.withheld> wrote in message
news:9139268.1104849732251.JavaMail.jive@jiveforum1.autodesk.com...
I am writing a routine that will copy layers to the active dwg from another
dwg.

Is there a method that will copy a layer object from one drawing layers
dictionary to the current drawing layers dictionary

I have rulled out:
vla-copyfrom (dimstyles and plot configs)
vla-copyobjects
vla-copy

vla-add
Im thinking I will have to use vla-add and just set the new layer properties
per the original layer properties.
(which 'I feel' is the long way to get there)

there must be a method that can copy a layer object.
mustn't there??

Robert Good.
Back to top
j buzbee
Guest





Posted: Tue Jan 04, 2005 10:23 pm    Post subject: Re: dbx Copy Layer Reply with quote

Hey r,

I think I posted my jbImportLayers routine awhile back in the CF NG. It
does exactly what you want. It was an ObjectDCL programing example for
everyone but I also included Vlisp Source code similar to what R. Robert
posted.

Let me know if you can't find it.

jb
Back to top
Tony Tanzillo
Guest





Posted: Tue Jan 04, 2005 10:38 pm    Post subject: Re: dbx Copy Layer Reply with quote

"R. Robert Bell" <NOT.RobertB@MWEngineers.com> wrote

Quote:
(The sample below does not include my DBX class.)

What's the purpose of posting code that uses
'(your) DBX class' (whatever the #&*@ that is) ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
Back to top
R. Robert Bell
Guest





Posted: Tue Jan 04, 2005 11:34 pm    Post subject: Re: dbx Copy Layer Reply with quote

<shrug> Why bother posting the support code that eventually opens a
ObjectDBX document? I simply posted the test procedure that, given a valid
ObjectDBX document, copied a layer from said document into the current one.
Anyone with the talent to open an ObjectDBX document in the first place can
see that the important bit of code is this:

Dim orgLayers(0) As Object
Set orgLayers(0) = iDBX.Document.Layers.Item("Sample")
iDBX.Document.CopyObjects orgLayers, ThisDrawing.Layers

--
R. Robert Bell


"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:41dad482$1_1@newsprd01...
"R. Robert Bell" <NOT.RobertB@MWEngineers.com> wrote

Quote:
(The sample below does not include my DBX class.)

What's the purpose of posting code that uses
'(your) DBX class' (whatever the #&*@ that is) ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
Back to top
rgood
Guest





Posted: Wed Jan 05, 2005 12:16 am    Post subject: Re: dbx Copy Layer Reply with quote

jb,
I have been thru the Autodesk ng's with no luck finding the jbImportLayers lisp. (what is the CF ng?)

Robert Good.
Back to top
j buzbee
Guest





Posted: Wed Jan 05, 2005 12:27 am    Post subject: Re: dbx Copy Layer Reply with quote

Did a google search and found it here:

http://discussion.autodesk.com/thread.jspa?threadID=352499

jb
Back to top
rgood
Guest





Posted: Wed Jan 05, 2005 1:14 am    Post subject: Re: dbx Copy Layer Reply with quote

thanks again, jb.
Back to top
rgood
Guest





Posted: Wed Jan 05, 2005 1:43 am    Post subject: Re: dbx Copy Layer Reply with quote

I got it. Thanks JB.

This is what I ended up with:

;; Global Variables
;; gActiveDoc - defined in acad.lsp
;; gDocLayers - defined in acad.lsp



(defun c:copylayers (/ dbxDoc vDBXLayers)
(setq dbxDoc (vla-getinterfaceobject gAcadObject "ObjectDBX.AxDbDocument.16"))

;;Open File
(vla-open dbxDoc (findfile "Layers_Master.dwg"));_open file
(setq vDBXLayers (vla-get-layers dbxDoc))
(vlax-for vLayer vDBXLayers
(if (not (g:Exist gDocLayers (vla-get-name vLayer)))
(vla-copyobjects
dbxDoc
(vlax-safearray-fill
(vlax-make-safearray vlax-vbobject '(0 . 0))
(list (vla-item vDBXLayers (vla-get-name vLayer)))
) ;_ end of vlax-safearray-fill
gDocLayers
) ;_end copyobjects

) ;_end if
) ;_ end of vlax-for
(vlax-release-object dbxDoc)

(princ)
(princ);_end clean
) ;_end defun

(defun g:exist (collection item / rslt)
(if
(not (vl-catch-all-error-p (setq rslt (vl-catch-all-apply 'vla-item (list collection item)))))
rslt
) ;_ end of if
) ;_ end of defun


Robert Good.
Back to top
Anne Brown
Guest





Posted: Wed Jan 05, 2005 2:38 am    Post subject: Re: dbx Copy Layer Reply with quote

Robert -

Customer Files (CF) is an area for upload of problem files for
review or sharing. Users are asked to zip any files prior to
uploading to conserve download time and server space.

The File Attachments discussion group can be accessed in either
of the
following ways:
By NNTP discussion group reader at
news://discussion.autodesk.com/autodesk.autocad.customer-files
By HTTP (web-based) interface at
http://discussion.autodesk.com/forum.jspa?forumID=126
---
Anne Brown
Discussion Groups Administrator
Autodesk, Inc.

rgood wrote:
Quote:

jb,
I have been thru the Autodesk ng's with no luck finding the jbImportLayers lisp. (what is the CF ng?)
Back to top
rgood
Guest





Posted: Wed Jan 05, 2005 2:47 am    Post subject: Re: dbx Copy Layer Reply with quote

Thanks Ann.
Back to top
Tony Tanzillo
Guest





Posted: Wed Jan 05, 2005 8:38 am    Post subject: Re: dbx Copy Layer Reply with quote

"R. Robert Bell" wrote

Quote:
shrug> Why bother posting the support code that eventually opens a
ObjectDBX document?

I don't know why. I've posted plenty of examples that
show the usage of an AxDbDocument, without the code
that creates it, and opens a drawing with it.

But _WHAT_ does that have to do with 'your DBX class' ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB