I'm using V8i SS4, SS10 or Connect, and I'm wondering if there's a way to get an image of an object, or an image of an area of a drawing? Or can the View object provide an image output? so if i zoom into an area that it can provide an image of what's being displayed.
Thanks.
Hi Viktor,
Viktor_Kulik said:I'm wondering
Did you try to search available (e.g. VBA) documentation and this forum? I remember it was discussed many times in different contexts and for APIs.
Viktor_Kulik said:to get an image of an object
In VBA, look at DrawToEnhancedMetafile and GetPicture methods.
Viktor_Kulik said:or an image of an area of a drawing?
Both in V8i and CE C API there are available functions mdlImage_captureScreen and mdlWindow_capture that you can call from VBA using wrappers. But it requires an extra processing, because they return raw image data.
There is also mdlImage_saveView function available that saves a view content to disk similarly to View Capture tool.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Viktor_Kulik said:if i zoom into an area that it can provide an image of what's being displayed
In addition to Jan's ideas there is also printing & plotting. MicroStation offers a large range of print formats, ranging from images to vector. The easiest way to drive the printer output with V8i is to queue key-ins, and you can continue to use key-ins with CONNECT.
Look, here's an article about printing with VBA!
Regards, Jon Summers LA Solutions
Thanks Jan, I'll have to give this a shot. I did search but wasn't getting anything related, but this should give me more info to look into.
Printing seems to be the simple approach, just create fences around objects I want to output. This could equal a couple hundred images per file, so we'll see how efficient it runs. I'll definitely compare between this and Jan's suggestions.
Viktor_Kulik said:Printing seems to be the simple approach, just create fences around objects
You can do that and more. Investigate Print Organizer: it has a lot of functionality directed at managing multiple prints. It reduces the need to write VBA macros to control printing.
Well, the images would be needed within another application, not as individual printing files. So I'm not interested in doing this via another GUI such as Print Organizer, which in my opinion is too complex to be useful (but that's another topic), and too buggy to trust consistently (also another topic).
You may want to load and review this MicroStation VBA example:
C:\ProgramData\Bentley\CONNECT Edition\Configuration\WorkSpaces\Example\WorkSets\MetroStation\Standards\Macros\PictureExample.mvba
This example uses an MSForm and GetPicture method to generate the image for display using all elements or selected ones.
As Jan recommended, these MicroStation VBA Help file topics are also relevant and helpful:
HTH,Bob
GetPicture (Help Topic Notes):
Viktor_Kulik said:the images would be needed within another application, not as individual printing files
You can print a a large range of formats, including raster images. Look at the print drivers in ..\WorkSpace\System\Plotdrv
..\WorkSpace\System\Plotdrv
The VBA functions that create metafiles create vector picture (EMF) files.