(API) PrintEngine

(API) PrintEngine

klavs
Contributor Contributor
1,323 Views
4 Replies
Message 1 of 5

(API) PrintEngine

klavs
Contributor
Contributor

My questions are:

1. How do i add a screenshot to the report? 

2. How do i clear all screenshots, so each time i run my function it does not ask to overwrite screenshots with the same name

3. How do i add nodes and element tables to the report with the API?

 

 

My code for creating a view and screenshot it: The "AddScToReport" doesn't work for me

 

RobotViewScreenCaptureParams ScPar;
ScPar = robApp.CmpntFactory.Create(IRobotComponentType.I_CT_VIEW_SCREEN_CAPTURE_PARAMS);
ScPar.UpdateType = IRobotViewScreenCaptureUpdateType.I_SCUT_UPDATED_UPON_PRINTING;
IRobotView3 robotView = (IRobotView3)robApp.Project.ViewMngr.CreateView(IRobotViewType.I_VT_STANDARD);
RobotGeoPoint3D point1 = (RobotGeoPoint3D)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_GEO_POINT_3D);
RobotGeoPoint3D point2 = (RobotGeoPoint3D)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_GEO_POINT_3D);
RobotGeoPoint3D point3 = (RobotGeoPoint3D)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_GEO_POINT_3D);
point1.Set(22.5, 0, 0);
point2.Set(29.5, 0, 0);
point3.Set(22.5, 0, 6.7);
robotView.SetLocal(point1, point2, point3);

robotView.Selection.Get(IRobotObjectType.I_OT_CASE).FromText("5");
robotView.ParamsDiagram.Set(IRobotViewDiagramResultType.I_VDRT_NTM_MY, true);
robotView.ParamsDiagram.Descriptions = IRobotViewDiagramDescriptionType.I_VDDT_TEXT;
robotView.ParamsDiagram.PositiveNegative = IRobotViewDiagramSignDifferType.I_VDSDT_DIFFERENTIATED;
robotView.ParamsDiagram.Filling = IRobotViewDiagramFillingType.I_VDFT_FILLED;
robotView.ParamsDiagram.Values = IRobotViewDiagramValueType.I_VDVT_LOCAL_EXTREMES;
robotView.Redraw(1);

ScPar.Name = "Moment";
robotView.MakeScreenCapture(ScPar);


robApp.Project.ViewMngr.Refresh();
robApp.Project.PrintEngine.AddScToReport(ScPar.Name);      //<-------------------- This does not work

 

 

0 Likes
Accepted solutions (2)
1,324 Views
4 Replies
Replies (4)
Message 2 of 5

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Hi @klavs 

 

Add after your last line:

robapp.Project.PrintEngine.SaveReportToOrganizer


Rafal Gaweda
0 Likes
Message 3 of 5

klavs
Contributor
Contributor

Thanks that worked for it to be added to the report.

 

But how do i add tables and how do i get past the promt when the screenshot name allready exists?

0 Likes
Message 4 of 5

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Hi @klavs 

 

Example code

 

Private Sub CommandButton2_Click()

Set robapp = New RobotApplication

Dim Rtable As RobotTable
Dim ScPar As RobotTableScreenCaptureParams
Set ScPar = robapp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)

ScPar.Name = "Rtable"

Set Rtable = robapp.Project.ViewMngr.CreateTable(I_TT_BARS, I_TDT_BAR)
' You can also GetTable
' Rtable.AddColumn 1  -  modify tables if you want by adding or removing columns
Rtable.MakeScreenCapture ScPar

End Sub

 

To play with screen captures

robapp.Project.PrintEngine.ScreenCaptures......


Rafal Gaweda
0 Likes
Message 5 of 5

klavs
Contributor
Contributor

I managed to create and add a table to the report.
didn't know i had to use a prebuild table

CreateTable(IRobotTableType.I_TT_BARS, IRobotTableDataType.I_TDT_BAR)

 

 

I was using the ScreenCaptures.Remove but i located why i didn't think i was clearing the screenshots

robApp.Project.PrintEngine.ScreenCaptures.Remove("Moment");  <--- only works once

It removes the screenshot one time, but if I run my function again, it doesn't remove the screenshot and i'm asked to overwrite it again.

0 Likes