HOW TO INSERT A SID IMAGE

HOW TO INSERT A SID IMAGE

dancalgary
Enthusiast Enthusiast
985 Views
2 Replies
Message 1 of 3

HOW TO INSERT A SID IMAGE

dancalgary
Enthusiast
Enthusiast

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();
}
}
}

0 Likes
986 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor

Are you sure Map 3D can import *.sid file? 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 3

norman.yuan
Mentor
Mentor

*.sid file is kind of image file, not data file (the data as geometries), thus, you do not use Map's ImportExport API to import it, you insert the image into map drawing. This discussion in the C3D forum would be of help:

https://forums.autodesk.com/t5/civil-3d-forum/importing-sid-from-gis-to-autocad/td-p/7638421 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes