Message 1 of 6
API save a view from Robot on desktop in PNG format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello!
I looked through a few topics that are connected with the topic here but nothing seems to work for me.
I would like to save a view in png format on desktop. I am using Robot API 2024. My code is like this:
IRobotView3 view = _viewMngr.GetView(1) as IRobotView3;
view.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_OTHER_HIDE_NODES, !showMesh);
view.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_FE_FINITE_ELEMENTS, showMesh);
view.Selection.Get(IRobotObjectType.I_OT_CASE).FromText("1");
view.Redraw(1);
view.Projection = IRobotViewProjection.I_VP_3DXYZ;
view.Window.Activate();
string filePath = "myPathToFolderOnDesktop";
string directory = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directory)) Directory.CreateDirectory(directory);
view.Redraw(1);
var exported = view.Printable.SaveToFile(filePath, IRobotOutputFileFormat.I_OFF_PNG);
even though exported is true, my exported file in png is 0kb. Did somebody get similar problem?
When I am exporting to .rtf or other extension everything works. Though the quality of rft is not very good.
When I am exporting to .rtf or other extension everything works. Though the quality of rft is not very good.