I can modify rasters using "Opendesignfile". Does anyone kow how to do it with "Opendesignfileforprogram"? I'm using Microstation V8i SS2.
For Each file In Files Set oFile = oApplication.OpenDesignFile(file, False) For Each oRaster In oApplication.RasterManager.Rasters
. . . Manipulate Raster here . . .
next oRaster oFile.Closenext file
Sincerely,
Christmas May
You can not. All you can do is to manipulate its element. What you need to do with it?
We have software that renames our attachments when they become obsolete. Then when you open the Microstation drawing the attachment fails to load properly because the filename of the attachment has changed. Therefore to answer you question we need to change the filename of the attachment.
How about Raster.SetAttachName? VBA Help has this:
Sets the current raster attachment file name and reload the raster
Regards, Jon Summers LA Solutions
Unknown said: How about Raster.SetAttachName? VBA Help has this: SetAttachName Method Sets the current raster attachment file name and reload the raster
Jon, they use model opened for program, so they do not have RasterManager initialised, that means, Raster interfaces are not usable...
Dan
Unknown said: they do not have RasterManager initialised
Oops!
Unknown said:Therefore to answer you question we need to change the filename of the attachment.
Renaming and so on is only possible in model opened normally. Fortunately, MicroStation is a COM object, so we are able to use it in hidden mode. ComplexWay is just example of working with new MicroStation that has a custom address space, so all objects need to be created in it using special function. SimplerWay is example of doing it without use of elements. Note that GetRasterFromElement works only if design file is opened not for program.
Both methods seem to work. Is there any advantage to doing it the "complex way"? Is there supposedly some speed advantage? I only did it on a few files for testing purposes.