.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
WblockClon eObjects Layout of Inventor DWG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
I'm trying to WblockCloneObjects an Inventor2012 dwg in Autocad 2012.
In this file there is just 1 layout called "Blad"
I get the objectIDs (23 in my case) but I can't see them in Autocad displayed.
I only see the new Layout!
My routine works well for WblockCloneObjects Autocad2012 dwg!
What am I missing? or isn't this possible at all because its an Inventor dwg?
Geert
Code:
public static Database WblockCloneFromExternalDWGfile(string filename, bool isinventorfile)
{
Database targetDatabase = Active.WorkingDatabase;
Database sourchDatabase = new Database(false, true);
sourchDatabase.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, true, "");
targetDatabase.Dimscale = sourchDatabase.Dimscale;
using (Transaction sourchTransaction = sourchDatabase.TransactionManager.StartTransaction
{
BlockTable sourchBlockTable = (BlockTable)sourchDatabase.BlockTableId.GetObject(
BlockTableRecord sourchSpace;
if (isinventorfile) { sourchSpace = (BlockTableRecord)sourchBlockTable
else { sourchSpace = (BlockTableRecord)sourchBlockTable[BlockTableRecor
(OpenMode.ForRead); }
ObjectIdCollection objectIDCollection = new ObjectIdCollection();
foreach (ObjectId objectID in sourchSpace) { objectIDCollection.Add(objectID); }
using (Transaction targetTransaction = targetDatabase.TransactionManager.StartTransaction
{
BlockTable targetBlockTable = (BlockTable)targetDatabase.BlockTableId.GetObject(
if (isinventorfile)
{
ObjectId newLayoutId = LayoutManager.Current.CreateLayout("Blad");
Layout newLayout = (Layout)newLayoutId.GetObject(OpenMode.ForWrite);
LayoutManager.Current.CurrentLayout = newLayout.LayoutName;
//targetSpace = (BlockTableRecord)targetBlockTable[BlockTableRecor
(OpenMode.ForWrite);
targetDatabase.WblockCloneObjects(objectIDCollecti
}
else //Autocad DWG
{
targetSpace = (BlockTableRecord)targetBlockTable[BlockTableRecor
(OpenMode.ForWrite);
targetDatabase.WblockCloneObjects(objectIDCollecti
}
targetTransaction.Commit();
}
}
return targetDatabase;
}
