Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

[Mstn CE U16 C#] Attaching ECW raster georeferenced

$
0
0

Hello,

I am trying to attach an ECW raster file (example attached) which is in a different coordinat system than my active model, and would therefore like to attach it georeferenced. I have tried in 3 different ways:

  1. Using a keyin: Raster Attach Fixed "filePath" as surgested her by Maury: Previous post
  2. Using the Interop API with Raster Manager
  3. Using the .NET API with DgnDocumentMoniker and RasterFrameElement

No matter how i attach the file, i get the same result - the ECW file is attched with Inherite GCS from model true, and the file is positioned in the wrong place. Does anyone know how this should be done?

My Interop code is:

String filnavn = @"C:\temp\1km_6050_692.ecw";
String description = "ECW Raster";

byte views = 255; // 0 = view 1, 2 = view 1+2, 4 = view 1+2+3, 8 = view 1+2+3+4
BCOM.Raster ras = App.RasterManager.Rasters.Attach(filnavn, views, BCOM.MsdAttachMode.Reference, BCOM.MsdFileAccessMode.Read, description, description);

My .NET code is:

// Set base transform and extents
BG.DTransform3d transform = BG.DTransform3d.Identity;
BG.DPoint2d extentInUOR = new BG.DPoint2d(1000000.0, 1000000.0);

// Set document and properties
BDPN.DgnFile DgnFile = BM.Session.Instance.GetActiveDgnFile();
BDPN.DgnModel Model = BM.Session.Instance.GetActiveDgnModel();
BDPN.DgnDocumentMoniker moniker = BDPN.DgnDocumentMoniker.CreateFromFileName(Path.GetFullPath(filnavn), Path.GetFileName(filnavn));
BDE.RasterFrameElement rfe = new BDE.RasterFrameElement(Model, null, moniker, transform, extentInUOR);

rfe.GeoreferencePriority = BDPN.GeoreferencePriority.RasterFile;
rfe.GCSInheritedFromModelState = false;
rfe.AttachDescription = description;
rfe.LogicalName = description;
rfe.OpenReadWrite = false;
rfe.AddToModel();

communities.bentley.com/.../1km_5F00_6050_5F00_692.ecw

Kind Regards
Peter Norvin


Viewing all articles
Browse latest Browse all 4331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>