HOW TO INSERT A SID IMAGE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following command:
it is failing at the line importer.Init("SID", "C:\\Users\\xxx\\Documents\\Work Files\\_tst\\RIDG-A-1003.sid");
can you please help me?
[CommandMethod("InsertSIDImage")]
public void InsertSIDImage()
{
// Get the active document and database
Document ThisDrawing = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database Database1 = ThisDrawing.Database;
using (DocumentLock lock1 = ThisDrawing.LockDocument())
{
// Start a transaction
using (Transaction Trans1 = Database1.TransactionManager.StartTransaction())
{
BlockTableRecord BTrecord = Trans1.GetObject(ThisDrawing.Database.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
try
{
MapApplication Acmap = HostMapApplicationServices.Application;
Importer importer = Acmap.Importer;
importer.Init("SID", "C:\\Users\\xxx\\Documents\\Work Files\\_tst\\RIDG-A-1003.sid");
ImportResults results;
results = importer.Import(true);
}
catch (Autodesk.Gis.Map.MapImportExportException ex)
{
// Check if ex has more specific properties related to the error
MessageBox.Show(ex.Message);
if (ex.InnerException != null)
{
MessageBox.Show("Inner Exception: " + ex.InnerException.Message);
}
MessageBox.Show("Stack Trace: " + ex.StackTrace);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
if (ex.InnerException != null)
{
MessageBox.Show("Inner Exception: " + ex.InnerException.Message);
}
MessageBox.Show("Stack Trace: " + ex.StackTrace);
}
Trans1.Commit();
}
}
}