API C# Help Create view and screen Capture

API C# Help Create view and screen Capture

chjpcoi
Advocate Advocate
685 Views
2 Replies
Message 1 of 3

API C# Help Create view and screen Capture

chjpcoi
Advocate
Advocate

Hello Everyone,

I have automatic view creation by API and view capture (code below), I have some following problems:

Code:

rbApp = new RobotApplication();
struc = rbApp.Project.Structure;
rbSelectPanels = struc.Selections.Get(IRobotObjectType.I_OT_OBJECT);
rbSelectPanels.FromText(dicStories[item]);
IRobotView3 viewRobot = (IRobotView3)rbApp.Project.ViewMngr.CreateView(IRobotViewType.I_VT_STANDARD);
viewRobot.Selection.Set(IRobotObjectType.I_OT_PANEL, rbSelectPanels);
viewRobot.Visible = 1;
viewRobot.Redraw(0);
viewRobot.Title = item;

viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_FE_PANEL_CONTOURS, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_OTHER_GRID, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_OTHER_STRUCTURAL_AXIS, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_OTHER_STRUCTURAL_AXIS_DESCRIPTION, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_VALUES, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_SYMBOLS_UNIFORM_SIZE, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_SYMBOLS_PLANAR, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_SYMBOLS_LINEAR, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_SYMBOLS_CONCENTRATED, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_AUTOMATICALLY, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_DISTRIBUTION_REGIONS, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_STRUCTURE_SUPPORT_SYMBOLS, false);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_DISTRIBUTION_REGIONS, true);
viewRobot.ParamsDisplay.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_VALUES, true);

rbSelectPanels.Clear();
rbApp.Project.ViewMngr.Refresh();
RobotViewScreenCaptureParams scPar = rbApp.CmpntFactory.Create(IRobotComponentType.I_CT_VIEW_SCREEN_CAPTURE_PARAMS);
scPar.Name = item;
scPar.UpdateType = IRobotViewScreenCaptureUpdateType.I_SCUT_CURRENT_VIEW;
scPar.Resolution = IRobotViewScreenCaptureResolution.I_VSCR_4096;
viewRobot.MakeScreenCapture(scPar);

rbApp.Project.PrintEngine.AddScToReport(item);
rbApp.Project.PrintEngine.SaveReportToOrganizer();

rbApp.Project.PrintEngine.SaveReportToFile(@"D:\2.API\API Robot\All\Pic tesst\" + item + nameCas[1] + ".rtf",
 IRobotOutputFileFormat.I_OFF_RTF_JPEG);

1. is there any way i can select the Maximize box of the newly created view ? (Pic 1)

Pic1Pic1

2. when i create auto view and use photo capture function the photo is black, is there any way to fix it using API?

(Pic 2)

Pic2Pic2

Thanks for your help.

0 Likes
Accepted solutions (1)
686 Views
2 Replies
Replies (2)
Message 2 of 3

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @chjpcoi 

First

viewRobot.Window.State = IRobotWindowState.I_WS_MAXIMIZE;

second

Have you tried with I_VSCR_3072, to put a 1 second sleep for current thread ?
if the case is to transform a bmp into jpeg and save it in a file, it is possible to do so without having to save it in the report.

Best regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 3 of 3

chjpcoi
Advocate
Advocate

Hi @Stephane.kapetanovic 

Once again for me thank you very much for your help.

Have a nice day

0 Likes