Hi,I have .DGN file with attached raster image (for example .PNG) and want to save it into .DWG file. During saving something going wrong and as a result when I open .DWG file in DWG TrueView 2016 I have an empty area (just a frame) instead of raster image (see attachment). But when I open this .DWG in MicroStation everything works correctly and image is displayed on its place. Otherwise when I save this .DGN file manually from UI everything works correctly, no matter where I open it.I try to do this with the following code, is it correct or not? Or maybe I miss something?
var connector = new ApplicationObjectConnector();
var app = connector.Application;app.Visible = true;
try
{
//MS_DWG_REFERENCE_EXTERNAL app.ActiveWorkspace.AddConfigurationVariable("MS_DWG_REFERENCE_EXTERNAL", "Retain");
//MS_DWG_REFERENCE_SELF app.ActiveWorkspace.AddConfigurationVariable("MS_DWG_REFERENCE_SELF", "Merge To Cell");
//MS_DWG_NONDEF_DESIGNMODEL_ATTACHMENTS app.ActiveWorkspace.AddConfigurationVariable("MS_DWG_NONDEF_DESIGNMODEL_ATTACHMENTS", "Merge To Cell");
//MS_DWG_REFERENCE_MASKED app.ActiveWorkspace.AddConfigurationVariable("MS_DWG_REFERENCE_MASKED", "Retain");
}catch (Exception){}
var doc = app.OpenDesignFile(dgnFilePath, true);doc.SaveAs(dgnFilePath, true, MsdDesignFileFormat.msdDesignFileFormatDWG);app.Quit();
Thanks.
Regards
Frank
since 1985: GIS, CAD, Engineering (Civil) Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads, HHK Geograf, IBr DAVID] : Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML][direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)
What do you mean? If you talk about image file, I can't see it's name. If you talk about .DWG's filename, it's specified in title of trueview on attachment (smb.dwg).