Get specific nodes and case data in table for printoutcomposition

Get specific nodes and case data in table for printoutcomposition

1234eddie
Advocate Advocate
1,715 Views
15 Replies
Message 1 of 16

Get specific nodes and case data in table for printoutcomposition

1234eddie
Advocate
Advocate

Hi all,

 

We @stefanyC6JZ7 and i are currently working on a VBA script that generates images and screencaptures from tables to use in our reports. Thanks to these topics: topic_1 , topic_2  We already solved quite a few things. 

 

But now we want a table, with a specific case and nodes displayed.

these are the nodes (in case 15) i want to display:

node to get displ.JPG

 

But now we get the full table see image

what we get now.JPG

 

This is our VBA code we have

' --------------------------------------------------------------
'
' Generation of the parametrized Silo.
'
Public RobApp As RobotApplication

 

Private Sub CommandButton1_Click()

 

'***Run Robot application

 

If RobApp Is Nothing Then
    Set RobApp = CreateObject("Robot.Application")
End If

 

RobApp.Visible = True
RobApp.Interactive = 1
RobApp.UserControl = True

 

'***Create an empty Shell project if it has not been created yet
If Not RobApp.Project.IsActive Or RobApp.Project.Type <> I_PT_SHELL Then
       RobApp.Project.New I_PT_SHELL
End If

'Sub kernel()

 

 

    'initialisation des valeurs
    Call init_value

    'permet de regénérer la vue
    Call CreeVueRM

    'sauvegarde le projet
    'robapp.Project.SaveAs newfilepath
    'robapp.Project.Close

End Sub

 

 

 

       
Public Sub CreeVueRM()

 

  ' définition d'une vue

    RobApp.Interactive = True
    RobApp.Visible = True
    RobApp.Window.Activate

    '------------------
    Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view
    Set mavueRobot = RobApp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use Get view instead
    Dim SimpleCaseSel As IRobotSelection 'Select Simple cases
    Dim ManualCombSel As IRobotSelection  'Select Combination cases


    '-----------------------------
    mavueRobot.Selection.Get(I_OT_CASE).FromText ("1") ' selecting case for results display
    mavueRobot.Redraw (True)
    'mavueRobot.Projection = I_VP_3DXYZ
    mavueRobot.Projection = I_VP_XZ_3D
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    '--------------------------------------------


'---------------------CREATE TABLE
    mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display SLS
    RobApp.Project.ViewMngr.Refresh

 

    Dim Rtable As RobotTable
    Dim TScPar As RobotTableScreenCaptureParams
    Set TScPar = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)

    TScPar.Name = "Disp_15"  'Screenshot Name
    'mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display SLS
    'mavueRobot.Selection.Get(I_OT_BAR).FromText ("5")
    'mavueRobot.Selection.Get(I_OT_NODE).FromText ("801 to 829") ' selecting case for results display SLS

    mavueRobot.Redraw (True)
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh

 

    'TScPar.UpdateType = I_SCUT_CURRENT_VIEW
    'TScPar.Resolution = I_VSCR_4096

'-----------------

    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_SUPPORT_SYMBOLS, False 'shows the supports
    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_NODE_NUMBERS, False 'shows the node numbers
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_MY, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FX, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FZ, False
    Set Rtable = RobApp.Project.ViewMngr.CreateTable(I_TT_NODE_DISPLACEMENTS, I_TDT_DISPLACEMENTS)
    'Rtable.Select(IRobotSelectionType.I_ST_CASE, "1")
    ''mavueRobot.Selection.Get().FromText ("15")
    'Dim ScPar As RobotViewScreenCaptureParams
    'Set ScPar = RobApp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)
    '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

    'mavueRobot.Visible = True
    'mavueRobot.Redraw (True)
    'RobApp.Project.ViewMngr.Refresh
    Rtable.MakeScreenCapture TScPar
    RobApp.Project.PrintEngine.SaveReportToOrganizer

 

    








 

 

    

 

 

End Sub

 

At line 120 we did try to select the case but it won't, Does anyone have a solution for this?

 

From my experience i know that @Rafal.Gaweda is quite familiair with this?

 

Many thanks in advance.

 

0 Likes
1,716 Views
15 Replies
Replies (15)
Message 2 of 16

Stephane.kapetanovic
Mentor
Mentor

hi @1234eddie 

Stephanekapetanovic_0-1691780588096.png

remove parentheses from method (when it does not return a value).

you will have to select the nodes also in the table

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 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic 

Thank you for your answer. We changed the code as you suggested. And, now it selects the correct case, Case 15, as you can see in the figure below. However, the screencapture of the Table is not done, and I get an error, in the yellow line: "Set TScPar = RobApp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)" 

stefanyC6JZ7_0-1691996888785.png

'
' Generation of the parametrized Silo.
'
Public RobApp As RobotApplication

Private Sub CommandButton1_Click()

'***Run Robot application

If RobApp Is Nothing Then
    Set RobApp = CreateObject("Robot.Application")
End If

RobApp.Visible = True
RobApp.Interactive = 1
RobApp.UserControl = True

'***Create an empty Shell project if it has not been created yet
If Not RobApp.Project.IsActive Or RobApp.Project.Type <> I_PT_SHELL Then
       RobApp.Project.New I_PT_SHELL
End If
    
'Sub kernel()


    'initialisation des valeurs
    Call init_value
    
    'permet de regénérer la vue
    Call CreeVueRM
    
    'sauvegarde le projet
    'robapp.Project.SaveAs newfilepath
    'robapp.Project.Close
    
End Sub




       
Public Sub CreeVueRM()

  ' définition d'une vue
    
    RobApp.Interactive = True
    RobApp.Visible = True
    RobApp.Window.Activate
    
    '------------------
    Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view
    Set mavueRobot = RobApp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use Get view instead
    Dim SimpleCaseSel As IRobotSelection 'Select Simple cases
    Dim ManualCombSel As IRobotSelection  'Select Combination cases
    
    
    '-----------------------------
    mavueRobot.Selection.Get(I_OT_CASE).FromText ("1") ' selecting case for results display
    mavueRobot.Redraw (True)
    'mavueRobot.Projection = I_VP_3DXYZ
    mavueRobot.Projection = I_VP_XZ_3D
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    '--------------------------------------------
    
    
'---------------------CREATE TABLE
    mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display SLS
    RobApp.Project.ViewMngr.Refresh

    Dim Rtable As RobotTable
    Dim TScPar As RobotTableScreenCaptureParams
    Set TScPar = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    
    TScPar.Name = "Disp_15"  'Screenshot Name
    'mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display SLS
    'mavueRobot.Selection.Get(I_OT_BAR).FromText ("5")
    'mavueRobot.Selection.Get(I_OT_NODE).FromText ("801 to 829") ' selecting case for results display SLS
   
    mavueRobot.Redraw (True)
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh

    'TScPar.UpdateType = I_SCUT_CURRENT_VIEW
    'TScPar.Resolution = I_VSCR_4096
    
'-----------------
    
    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_SUPPORT_SYMBOLS, False 'shows the supports
    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_NODE_NUMBERS, False 'shows the node numbers
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_MY, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FX, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FZ, False
    Set Rtable = RobApp.Project.ViewMngr.CreateTable(I_TT_NODE_DISPLACEMENTS, I_TDT_DISPLACEMENTS)
    Rtable.Select IRobotSelectionType.I_ST_CASE, "15"
    ''mavueRobot.Selection.Get().FromText ("15")
    'Dim ScPar As RobotViewScreenCaptureParams
    Set TScPar = RobApp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)
    '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
        
    'mavueRobot.Visible = True
    'mavueRobot.Redraw (True)
    'RobApp.Project.ViewMngr.Refresh
    Rtable.MakeScreenCapture TScPar
    RobApp.Project.PrintEngine.SaveReportToOrganizer

    
    
    
    
    
    
    
    


    


End Sub

Could you check this part of the code? 

 

Thanks in advance. 

 

Best regards, 

Stefany 

0 Likes
Message 4 of 16

Stephane.kapetanovic
Mentor
Mentor

hi @stefanyC6JZ7 

  Dim Rtable As RobotTable
  Dim TScPar As RobotTableScreenCaptureParams
   
  Set Rtable = RobApp.Project.ViewMngr.CreateTable(I_TT_NODE_DISPLACEMENTS, I_TDT_DISPLACEMENTS)
  Rtable.Select I_ST_CASE, "15"
  Set TScPar = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
  TScPar.Name = "my_results"
  Rtable.MakeScreenCapture TScPar

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
Message 5 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic 

Thank you for your reply, and your help. The code now is working perfectly.  And I get the screenshot. Also, I was wondering if you know how can I set the Page Setup parameters. I am tryint to get them following the path of line 104 " RobApp.Project.PrintEngine.PageSetup.Variables.Active = True". Could you check it please, I am not sure if this is the right way to set the Variables.

Thank you in advance for your help. 

 

Best regards, 

Stefany 

 

 

' --------------------------------------------------------------
'
' Generation of the parametrized Silo.
'
Public RobApp As RobotApplication

Private Sub CommandButton1_Click()

'***Run Robot application

If RobApp Is Nothing Then
    Set RobApp = CreateObject("Robot.Application")
End If

RobApp.Visible = True
RobApp.Interactive = 1
RobApp.UserControl = True

'***Create an empty Shell project if it has not been created yet
If Not RobApp.Project.IsActive Or RobApp.Project.Type <> I_PT_SHELL Then
       RobApp.Project.New I_PT_SHELL
End If
    
'Sub kernel()


    'initialisation des valeurs
    Call init_value
    
    'permet de regénérer la vue
    Call CreeVueRM
    
    'sauvegarde le projet
    'robapp.Project.SaveAs newfilepath
    'robapp.Project.Close
    
End Sub




       
Public Sub CreeVueRM()

  ' définition d'une vue
    
    RobApp.Interactive = True
    RobApp.Visible = True
    RobApp.Window.Activate
    
    '------------------
    Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view
    Set mavueRobot = RobApp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use Get view instead
    Dim SimpleCaseSel As IRobotSelection 'Select Simple cases
    Dim ManualCombSel As IRobotSelection  'Select Combination cases
    
    
    '-----------------------------
    mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display
    mavueRobot.Redraw (True)
    'mavueRobot.Projection = I_VP_3DXYZ
    mavueRobot.Projection = I_VP_XZ_3D
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    '--------------------------------------------
    
    
'---------------------CREATE TABLE
    'mavueRobot.Selection.Get(I_OT_CASE).FromText ("15") ' selecting case for results display SLS
    RobApp.Project.ViewMngr.Refresh

    Dim Rtable As RobotTable
    Dim TScPar As RobotTableScreenCaptureParams
    Set TScPar = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    
    TScPar.Name = "Disp_15"  'Screenshot Name
    'TScPar.UpdateType = I_SCUT_CURRENT_VIEW
    'TScPar.Resolution = I_VSCR_4096
    
'-----------------
    
    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_SUPPORT_SYMBOLS, False 'shows the supports
    mavueRobot.ParamsDisplay.Set I_VDA_STRUCTURE_NODE_NUMBERS, False 'shows the node numbers
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_MY, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FX, False
    mavueRobot.ParamsDiagram.Set I_VDRT_NTM_FZ, False
    Set Rtable = RobApp.Project.ViewMngr.CreateTable(I_TT_NODE_DISPLACEMENTS, I_TDT_DISPLACEMENTS)
    Rtable.Select IRobotSelectionType.I_ST_CASE, "15" 'Select the Specific Case
    Rtable.Select IRobotSelectionType.I_ST_NODE, "801 to 829" 'Selects the nodes of the last bar
        
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    Rtable.MakeScreenCapture TScPar
    RobApp.Project.PrintEngine.SaveReportToOrganizer
    
'----------------------HEADERS

    'RobApp.Project.PrintEngine.PageSetup.Header.Active = True
    'RobApp.Project.PrintEngine.PageSetup.Footer.Active = False
    'RobApp.Project.PrintEngine.PageSetup.Footer.Active = False
    'RobApp.Project.PrintEngine.PageSetup.MarginLeft.Set ("16")
    RobApp.Project.PrintEngine.PageSetup.Variables.Active = True
    'RobApp.Project IRobot.VariablePredefinedId.I_VPI_PROJECT_NAME, "Trials"
 
 
 
 
    'Dim Headers As IRobotVariablePredefinedId
    'Set Headers = RobApp.Project.Printouts.IRobotVariablePredefinedId (8)
    'Headers.I_VPI_USER_ADDRESS , "Trials"



End Sub


 

0 Likes
Message 6 of 16

Stephane.kapetanovic
Mentor
Mentor

RobotVariableMngr has no Active property, could you be clearer on what you want to set by RobApp.Project.PrintEngine.PageSetup.Variables? For example you have a SetPredefinedValue method that can help you.

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 7 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

hI @Stephane.kapetanovic

I want to edit the Page Setup Parameters, For example, "PROJECT_ADDRESS1" as figure below shows. I want to use  VBA to assign the Values instead of doing manually.

 

stefanyC6JZ7_3-1692008405457.png

 

I was checking the API Documentation and I found that IRobotPageSetup has the Field Variables as the figure below shows. 

stefanyC6JZ7_1-1692008021703.png

Also,  I Found the  IRobotVariablePredefinedId with some Parameters. As figure below shows. 

stefanyC6JZ7_2-1692008213532.png

 

I am not sure how to do it with VBA, Could you help me to check if the following code is correct to edit the variables, or what should I do?

RobApp.Project.PrintEngine.PageSetup.Variables 

 

Thank you in advance for your help. 

 

Best regards, 

Stefany

0 Likes
Message 8 of 16

Stephane.kapetanovic
Mentor
Mentor

as suggested you can use the SetPredefinedValue method.

  RobApp.Project.PrintEngine.PageSetup.Variables.SetPredefinedValue I_VPI_PROJECT_ADDRESS1, "MyProjectAdress"

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
Message 9 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic

Thank you for your answer, now it works fine. 

 

Best regards, 

Stefany 

0 Likes
Message 10 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic 

 

Sorry to bother you again. Could you help me to solve a question about Printout composition. 

I want to add the standard Tables (Data - Nodes, Data -Members, etc), from Printout composition, Standard Tab to my Printout list on the right as figure shows, using VBA instead of adding them manually.  

stefanyC6JZ7_0-1692109640814.png

I was checking the API Documentation, and I am not sure if it is correct to add them as follows: 

Set Rtable1 = RobApp.Project.ViewMngr.GetTable(I_TT_NODES, I_TDT_DEFAULT)


First, by using Get Table, please find the code below. Then, by adding 

(I_TT_NODES, I_TDT_DEFAULT)

stefanyC6JZ7_1-1692109892989.png

 

Dim Rtable1 As RobotTable
    Dim TScPar1 As RobotTableScreenCaptureParams
    Set TScPar1 = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    
    TScPar1.Name = "Disp_Nodes Table"  'Screenshot Name
    TScPar1.UpdateType = IRobotViewScreenCaptureUpdateType.I_SCUT_CURRENT_VIEW
    'TScPar1.Resolution = IRobotViewScreenCaptureResolution.I_VSCR_4096
    Set Rtable1 = RobApp.Project.ViewMngr.GetTable(I_TT_NODES, I_TDT_DEFAULT)
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    Rtable.MakeScreenCapture TScPar1
    RobApp.Project.PrintEngine.SaveReportToOrganizer

stefanyC6JZ7_2-1692110064441.png

stefanyC6JZ7_3-1692110098608.png

 

 

 

 

 

0 Likes
Message 11 of 16

Stephane.kapetanovic
Mentor
Mentor

hi @stefanyC6JZ7 

rather than using the get method, use the create method and close the window after use.

Dim Rtable As RobotTable
Dim TScPar As RobotTableScreenCaptureParams
With RobApp
  Set TScPar = .CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
  Set Rtable = .Project.ViewMngr.CreateTable(I_TT_NODES, I_TDT_NODE)
End With
TScPar.Name = "myNodeTable"
Rtable.MakeScreenCapture TScPar
Rtable.Window.SendMessage &H10, 0, 0

for the get method an example is below

https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-macro-for-dumping-all-opened-tabl...

 

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
Message 12 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic 

Thank you for your answer. You are right, I can get the tables. However, I got one issue in the creation of the Support Table. 
When I take it manually I got the table shown below. 

stefanyC6JZ7_0-1692175785637.png

But when I try it with the following code, I get a different table.

'--------------------Add Standard Data-Supports

    Dim Rtable5 As RobotTable
    Dim TScPar5 As RobotTableScreenCaptureParams 'To create a table
    Set TScPar5 = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    With RobApp
    Set TScPar5 = .CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    Set Rtable5 = .Project.ViewMngr.CreateTable(I_TT_SUPPORTS, I_TDT_SUPPORTS)
    End With
    TScPar5.Name = "Data - Supports"
    Rtable5.MakeScreenCapture TScPar5
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    RobApp.Project.PrintEngine.SaveReportToOrganizer

 

stefanyC6JZ7_1-1692175929035.png

I am not sure what is wrong, Could you help me to check it?

Thank you in advance. 

Best regards,
Stefany

0 Likes
Message 13 of 16

Stephane.kapetanovic
Mentor
Mentor

hi @stefanyC6JZ7 

the two main methods are those detailed above, if the presentation proves to be complicated to do by programming or that it only occurs in rare cases, it is probably possible manually by you. In your case, it may be more practical to use the Get method on a previously formatted table.

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
Message 14 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Thank you for your response @Stephane.kapetanovic. I checked again the API documentation and using the code below, the right table appears. 

Set Rtable0 = RobApp.Project.ViewMngr.CreateTable(I_TT_SUPPORTS_LABEL, I_TDT_SUPPORTS)

 Thank you for your help. 

 

Best regards, 

Stefany 

Message 15 of 16

stefanyC6JZ7
Enthusiast
Enthusiast

Hi @Stephane.kapetanovic

Sorry to bother you again. Could you help me to solve one issue when selecting specific nodes using VBA. 

I want to create this table, as figure below shows. The table shows the node displacement from Bar 5, containing nodes 801-829. 

stefanyC6JZ7_1-1692607876343.pngstefanyC6JZ7_0-1692607677660.png

Currently I am using the code below:

 

' --------------------------------------------------------------
'
' Generation of the parametrized Silo.
'
Public RobApp As RobotApplication

Private Sub CommandButton1_Click()

'***Run Robot application

If RobApp Is Nothing Then
    Set RobApp = CreateObject("Robot.Application")
End If

RobApp.Visible = True
RobApp.Interactive = 1
RobApp.UserControl = True

'***Create an empty Shell project if it has not been created yet
If Not RobApp.Project.IsActive Or RobApp.Project.Type <> I_PT_SHELL Then
       RobApp.Project.New I_PT_SHELL
End If
 
 ''Sub kernel()

    'initialisation des valeurs
    Call init_value
    
    'permet de regénérer la vue
    Call CreeVueRM
    

End Sub



       
Public Sub CreeVueRM()

  ' définition d'une vue
    
    RobApp.Interactive = True
    RobApp.Visible = True
    RobApp.Window.Activate
    
    '------------------
    Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view
    Set mavueRobot = RobApp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use Get view instead
  
    '-----------------------------
    mavueRobot.Redraw (True)
    mavueRobot.Projection = I_VP_XZ_3D
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    '--------------------------------------------

'---------------------CREATE TABLE
    ''RobApp.Project.ViewMngr.Refresh
    Dim Rtable As RobotTable
    Dim TScPar As RobotTableScreenCaptureParams
    Set TScPar = RobApp.CmpntFactory.Create(I_CT_TABLE_SCREEN_CAPTURE_PARAMS)
    
    TScPar.Name = "Disp_15"  'Screenshot Name

    '-------------------------------SELECT NODES

    
    Dim NodeSel As RobotSelection  'Node selection
    Set NodeSel = RobApp.Project.Structure.Selections.Get(I_OT_NODE) 'Selects all nodes
    NodeSel.FromText "all"
    
    Dim Node As RobotObjObject
    Dim NodeCol As RobotNodeCollection
    Set NodeCol = RobApp.Project.Structure.Nodes.GetMany(NodeSel)
    Dim NodesSelection As String
    
    Row = 2
    For ii = 1 To NodeCol.Count

        Cells(Row, 9) = "Node"
        Set RNode = NodeCol.Get(ii)
        Cells(Row, 10) = RNode.Number
        Row = Row + 1
        
    Next ii
    
    Dim i As Integer
    Dim firstRow As Integer
    Dim columnNumber As Integer
    Dim Max As Integer
    Z = 801
    
    firstRow = 2
    columnNumber = 10
    

    Set Sheet = ActiveSheet

    If Sheet.UsedRange.Rows.Count <= 1 Then Max = NaN Else Max = Sheet.Cells(firstRow, columnNumber)

    For i = firstRow + 1 To Sheet.UsedRange.Rows.Count
        If Sheet.Cells(i, columnNumber) > Max Then Max = Sheet.Cells(i, columnNumber)
    Next
        Cells(1, 9) = "Node_Max"
        Cells(1, 10) = Max
        V = Max
        Cells(1, 11) = "Node_Start"
        Cells(1, 12) = Z
    
    
    
    Set Rtable = RobApp.Project.ViewMngr.CreateTable(I_TT_NODE_DISPLACEMENTS, I_TDT_DISPLACEMENTS)
    Rtable.Select IRobotSelectionType.I_ST_CASE, 15 'Select the Specific Case
    Rtable.Select IRobotSelectionType.I_ST_NODE, "801to829"  'Selects the nodes of the last bar   
    
    mavueRobot.Visible = True
    mavueRobot.Redraw (True)
    RobApp.Project.ViewMngr.Refresh
    Rtable.MakeScreenCapture TScPar
    RobApp.Project.PrintEngine.SaveReportToOrganizer
End Sub








When creating the table, the code selects from node 801 to node 829. 

Rtable.Select IRobotSelectionType.I_ST_NODE, "801to829"  'Selects the nodes of the last bar

However, the maximum node number("829") will change depending on the project. Thats why the approach is to get the maximum node number from all the nodes. And then create the table from node 801 - Node_max number.

With the current code, I get succesfully the Node_Max number ("829") and export to Excel as fiure below shows: 

stefanyC6JZ7_2-1692608279170.png
And If I change the part of the code as follows: 

Rtable.Select IRobotSelectionType.I_ST_NODE, V  'Selects the nodes of the last bar
    

I got the following table, witht the right case and the max node mnumber:

stefanyC6JZ7_3-1692608614830.png

But I am not sure how to create the table from node 801to829 using V instead of 829. 

Rtable.Select IRobotSelectionType.I_ST_NODE, "801toV"  'Selects the nodes of the last bar
    

Could you help me to chekc if this is the correct way to get the table?

Many thanks  in advance. 

 

Best regards, 

Stefany 

0 Likes
Message 16 of 16

Stephane.kapetanovic
Mentor
Mentor

hi @stefanyC6JZ7 

The code below will give you the first and last number as well as the overall selection of nodes in your project.

 

With RobApp.Project.Structure.Selections.Create(I_OT_NODE)
  .FromText "all": First = .Get(1): Last = .Get(.Count): TxtFirstToLastNode = .ToText
End With

 

used like that

 

Rtable.Select IRobotSelectionType.I_ST_NODE, TxtFirstToLastNode

 

Best Regards 

 

not knowing your project, note that you can also write:

TxtFirstToLastNode = "801to" & Last

 

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