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

RE: Issue Attaching Raster image in Microstation MDL V.8.05-2004

$
0
0

Hi Mohammad,

[quote user="Mohammad Aryafar"]but I'm not sure what I'm doing is correct or not.[/quote]

Use existing knowledge base: Search discussions in this forum for mdlRaster and read found posts. There are plenty of discussions about how to use MDL Raster API.

[quote user="Mohammad Aryafar"]This works fine but there is something that I noticed is that I need to open raster manager then run my app to attach the image.[/quote]

It means your code is wrong, because the code should not relay on anything in GUI.

[quote user="Mohammad Aryafar"]Do I need to change any part of this code so that I don't need to open raster manager and then run the app?[/quote]

Yes:

  • You have to initialize RasterManager engine before you will use any raster API function. Use mdlRaster_initialize, usually at a beginning of your code (in main).
  • You have to close (stop) RasterManager engine when your application is unloaded. Use mdlRaster_terminate.
  • It does not relate to the "raster topic", but is about "good coding style": To call mdlRaster_fileOpen inside if condition is bad style, regardless such construction is used often. Every line of your code should do one thing without any side effect, but your condition does two. Your construction does not bring any benefit but is harder to read, which means harder to debug.

[quote user="Mohammad Aryafar"]I will then tried to attach raster image to another file that is not open but I'm failing to do so.[/quote]

I have not been able to find any relevant discussion, but I remember vaguely that it's not possible to use raster API with work DGN, because RasterManager engine can be initialized only for active file and attached reference. I hope somebody else will confirm or reject this information.

[quote user="Mohammad Aryafar"]Ideally, I want to be able to attach raster to multiple files without having to do it one by one. [/quote]

Hmmm ... in my opinion ideally you should use MDL API as it was designed.

[quote user="Mohammad Aryafar"]Is element descriptor a fine approach for this task? [/quote]

I am not sure. Element descriptor is used to hold graphical element in memory and I don't recall any information if it can be used to represent also non graphical object(s) like raster attachment information. I guess you should try to attach a raster and check what was added to the active file and if you are able to read it.

With regards,

 Jan


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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