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

how to create collection of xref objects into new drawing file.

1 REPLY 1
Reply
Message 1 of 2
varadan01
349 Views, 1 Reply

how to create collection of xref objects into new drawing file.

idsObjEntity-->collection of xref objects
                private void CloneObjectIds(ObjectIdCollection idsObjEntity, String strFileName)
        {
            try
            {
                Database dbNew = new Database(true, false);
                Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = dbNew.TransactionManager;
                ObjectId idModelSpace;
                using (Transaction mTy = tm.StartTransaction())
                {
                    BlockTable bt = (BlockTable)tm.GetObject(dbNew.BlockTableId, OpenMode.ForRead, false);
                    BlockTableRecord Btr = (BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead, false);
                    //idModelSpace = bt[BlockTableRecord.ModelSpace];
                    idModelSpace = Btr.Id;
                }
                IdMapping Mappin = new IdMapping();
                RTA_ApplicationData.Db.WblockCloneObjects(idsObjEntity, idModelSpace, Mappin, DuplicateRecordCloning.Ignore, false);
                

                String strFolderName = strFileName;
                strFileName = strFileName + ".dwg";
                String strPathName;
                String pathName = Assembly.GetExecutingAssembly().Location;
                pathName = pathName.Replace("LayerFilter.dll", "Drawing");
                DirectoryInfo dirInfo = Directory.CreateDirectory(pathName + "\\" + strFolderName);
                if (System.IO.File.Exists(pathName + "\\" + strFolderName))
                {
                    return;
                }
                dbNew.SaveAs(pathName + "\\" + strFolderName + "\\" + strFileName, DwgVersion.Newest);
                strPathName = pathName + "\\Temp\\" + strFileName;                           
            }

}

 

 

 

here i take the objectid collection as xref filter by its layer name.i tried to clone the object in new dwg its shows eWrongdatabase.

 

With Regards,
GVaradarajan
1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: varadan01

Hi Varadarajan,

 

Replied to the other thread on the same topic :

http://forums.autodesk.com/t5/NET/How-to-create-objIds-collectns-of-specified-xref-layer-entity/td-p...



Balaji
Developer Technical Services
Autodesk Developer Network

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