[great-users] export an image of a system structure

Belschner, Tim tim.belschner at ils.uni-stuttgart.de
Wed Jul 15 07:48:08 CDT 2015


Hello everybody,

 
we would like to export an image of a system structure based on our metamodel, similar to the GME “Print to Metafile” function. Since we weren’t able to use the underlying functions of “Print to Metafile” in a transformation, we would like to draw all icons on a canvas and save it to a file. For this, we need to access the icon names of each object.

The issue is, that in our code the icon name is returned correctly for the first element, e.g. “module.gif” but not for the following ones. Beginning from the second object resp. loop, an error is returned and the value of “icon_value” is always “Aspect”. Following the code:

 
##################### CODE START ##########################

 
BSTR icon_path;                              // "icon"

BSTR icon_value;                            // e.g. "module.gif"

std::string str_name, str_icon_name;

CComPtr<IUnknown> pUnk;

                

set<Udm_VS10::Object> objs = ModelMain.GetChildObjects();

 
for (set<Udm_VS10::Object>::const_iterator it = objs.begin(); it != objs.end(); it++) 

{

                icon_path = L"/icon";

                SysFreeString(icon_value);

                

                pUnk.Attach(UdmGme::Udm2Gme( *it ));

                CComQIPtr<IMgaFCO> pFCO = pUnk;

                HRESULT hr = pFCO->get_RegistryValue( icon_path, &icon_value);

                

                _com_error err(hr);

                LPCTSTR errMsg = err.ErrorMessage();

                

                std::string str = BstrToStdString(icon_value);

                std::cout << green << "the icon name is " << str << "error message ::" << errMsg << white << endl;

                

                pUnk.Release();

};

                

##################### CODE END ##########################

 
Could someone please give us a hint or provide a code snippet about how to access the name of the icon resp. use “CComPtr<IUnknown> pUnk” in a correct way?

And if there is a more simple way of exporting a selection of objects, please let me know too.

 
Thanks in advance and best regards

 
Tim

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/great-users/attachments/20150715/ceb3ebd7/attachment.html>


More information about the great-users mailing list