Is is possible to WblockCloneobjects styles from a different database?
using (Database db = new Database(false, true))
{
try
{
ListBoxItem lItem = (ListBoxItem)lstStyles.SelectedItem;
db.ReadDwgFile(lItem.Tag.ToString().Replace("xml", "dwg"), FileShare.ReadWrite, false, string.Empty);
}
catch (System.Exception ex)
{
throw ex;
}
ObjectIdCollection oidCollection = new ObjectIdCollection();
using (Transaction tr = db.TransactionManager.StartTransaction())
{
foreach (long handle in lHandles)
{
Handle hn = new Handle(handle);
ObjectId oid = db.GetObjectId(false, hn, 0);
DBObject dod = (DBObject)tr.GetObject(oid, OpenMode.ForRead);
oidCollection.Add(oid);
}
tr.Commit();
}
if (oidCollection.Count > 0)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
using (Database destDb = doc.Database)
{
IdMapping mapping = new IdMapping();
db.WblockCloneObjects(oidCollection, destDb.BlockTableId, mapping, DuplicateRecordCloning.Replace, false);
}
}
I am trying to deepclone objects from another dwg file, those objects are styles. But the problem is that those (i think) entity have different owner i guess it is not own by the blocktable.
Is there any way to deepclone styles from 1 dwg to another dwg.
Thanks
makoy