- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
in my company we only use Excel for the ellaboration of our calculation notes. In order to explain or help our clients to understand what we are doing we took the habit to screen all our simple load cases with the Robot capture tool. In Robot 2016 this is a really annoying process which make decent lose of time when any change is done.
Having only recently discovered the ROBOT API, I decided as my first attempt, to automatise throught VBA the importation of pictures of our structures ( then the editing only through vba).
I have encountered some end points throught my research which brought me there 🙂
First I found How to take Screens:
Dim RobApp As RobotApplication
Set RobApp = New RobotApplication
Dim t As RobotView
' Création des paramètres de capture d'écran
Set paramCaptureEcran = CreateObject("Robot.ViewScreenCaptureParams")
' Définition des paramètres de capture d'écran (facultatif)
paramCaptureEcran.Comment = "Capture d'écran de la vue graphique"
'paramCaptureEcran.IncludeDateAndTime = True
'paramCaptureEcran.Name = "Capture_vue_graphique"
'paramCaptureEcran.Orientation = 1 ' 1 pour paysage, 2 pour portrait
'paramCaptureEcran.Resolution = 1 ' Résolution de capture (1 pour standard, 2 pour haute)
'paramCaptureEcran.ScaleAutomatic = True ' True pour échelle automatique, False pour échelle définie par l'utilisateur
'paramCaptureEcran.ScaleValue = 1.0 ' Valeur d'échelle définie par l'utilisateur
But to actually take the screen of what I want I tried different solutions:
- With the view manager Method
Dim nViews As Long
nViews = RobApp.Project.ViewMngr.ViewCount
Workbooks.Add
For I = 1 To nViews
Set t = RobApp.Project.ViewMngr.GetView(I)
t.CopyToClipboard
't.MakeScreenCapture paramCaptureEcran
'Then the pasting/editing throught excel
Next I
Getting always the same image.
- With the case Selection Method
Dim Structure As RobotStructure, CaseSelection As RobotSelection
Dim Cases As RobotCaseServer, SimpleCase As RobotSimpleCase
Set Structure = RobApp.Project.Structure
Set Cases = Structure.Cases
Set CaseSelection = Structure.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)
If CaseSelection.Count = 0 Then
MsgBox "No loadcase opened"
Exit Sub
End If
For I = 1 To CaseSelection.Count
CaseNo = CaseSelection.Get(I)
Set SimpleCase = Cases.Get(CaseNo)
With SimpleCase
If .AnalizeType = I_CAT_DYNAMIC_MODAL Then GoTo NextCase
End With
' ACCESS TO VIEW OF THE CASE ??
Set t = RobApp.Project.ViewMngr.GetView(1)
t.CopyToClipboard
Which I just didn't find how to link it with an actual change how the view
I think I found a decent base but I struggle to understand how the active view of the screen is accessible throught the IDE. Is it even possible to change view, or rotate/translate/zoom the structure like that?
Many many thanks in advance
Ps: you'll find the complete excel macro joined to this post. To use it you need to setup your Robot screen (NOT in full screen!) and click the button. An other issue I encountered 😕
Solved! Go to Solution.