.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I copy or clone a BlockRef from an xref into the topmost parent?

3 REPLIES 3
Reply
Message 1 of 4
McSwiller
631 Views, 3 Replies

How do I copy or clone a BlockRef from an xref into the topmost parent?

I'd like to copy some blockreferences from an xref into the uppermost parent drawing. I've tried using DeepCloneObjects and gotten an eWrongDatabase message, and I've tried WblockCloneObjects and gotten an eInvalidOwnerObject error.

In this instance, I've tried getting a handle to the xref db (sourceDb) through the XrefGraphNode object. The objId collection was built by enumerating through the host drawing block table however, and drilling into the xref from there, is that what I'm doing wrong?:
Dim mapping As IdMapping = sourceDb.WblockCloneObjects(oidColl, hostDb.BlockTableId, DuplicateRecordCloning.Replace, False)
Any other suggestions?
Thanks for the time,

Mike
3 REPLIES 3
Message 2 of 4
chiefbraincloud
in reply to: McSwiller


If you haven't seen it, you should check out the post here: //through-the-interface.typepad.com/through_the_interface/2006/08/import_blocks_f.html



I took the http: off the front because this forum always screws up and adds a %20 character where it doesn't belong when you paste a link, so just copy it to your address bar and put the http: back on.



What it should show you is the proper way to set up the WBlockClone. When I got the eWrongDatabase error, it just about drove me crazy until I looked closer at the example and found that the TransactionManager used to create the transaction for the WblockClone had to come from the Source Database, where the objects are being cloned from.



My code is like the post, using a "side database" , not an Xref, so I'm not sure about any complications there.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 4
Anonymous
in reply to: McSwiller




Unless you want to offer a prize to the first person
that

can correctly guess what the relevant code you didn't

show is doing, include it in your post and someone
can

then give you some help.

 


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I'd
like to copy some blockreferences from an xref into the uppermost parent
drawing. I've tried using DeepCloneObjects and gotten an eWrongDatabase
message, and I've tried WblockCloneObjects and gotten an eInvalidOwnerObject
error. In this instance, I've tried getting a handle to the xref db (sourceDb)
through the XrefGraphNode object. The objId collection was built by
enumerating through the host drawing block table however, and drilling into
the xref from there, is that what I'm doing wrong?: Dim mapping As IdMapping =
sourceDb.WblockCloneObjects(oidColl, hostDb.BlockTableId,
DuplicateRecordCloning.Replace, False) Any other suggestions? Thanks for the
time, Mike
Message 4 of 4
McSwiller
in reply to: McSwiller

Thank you chiefbraincloud - It looks like I'm going to have to pursue a method more like Kean's after all. That is, to read in an external file (the xref), and then get my objectIdCollection from there.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost