API - Settings for nodal displacement graphical view

API - Settings for nodal displacement graphical view

tobias_schnizer
Explorer Explorer
524 Views
2 Replies
Message 1 of 3

API - Settings for nodal displacement graphical view

tobias_schnizer
Explorer
Explorer

I am currently writing some automation (in VB.NET but should be almost identical to VBA) for Robot Structural Analysis 2024. The goal is to export images of structures and their deformation, but I can't seem to find the correct command and syntax to set the diagram description (nodal displacement component) UX, UY, UZ or U(total). I also can't find the right command that does what the "Normalize"-button does. See image [RSA - Nodal displacements settings API unknown.png] for context.

I am able to turn on and off various parameters of the view except these. The code I currently have is as follows. It sets on the things I need and off what often is still turned on while building the model. Then takes a screenshot and saves it.

 

Dim RobApp As New RobotApplication
Dim projName = RobApp.Project.Name
Dim fileName = RobApp.Project.FileName

' Activate graphical interface (needed for screenshots)
RobApp.Visible = True
RobApp.Window.Activate()
RobApp.Interactive = True
RobApp.UserControl = True

' Ensure the geometry view is the current layout for table generation
RobApp.Project.ViewMngr.CurrentLayout = IRobotLayoutId.I_LI_MODEL_GEOMETRY

Dim RView As IRobotView3 = RobApp.Project.ViewMngr.GetView(1)
Dim RVP As RobotViewDisplayParams = RView.ParamsDisplay

' Base visual configuration, XZ 3D view and redraw simple way of "zoom to fit"
RView.Projection = IRobotViewProjection.I_VP_XZ_3D
RView.Redraw(1)

' Deselect all objects to have a clean view
RobApp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR).Clear()
RobApp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_NODE).Clear()

' Set display parameters
RVP.Set(IRobotViewDisplayAttributes.I_VDA_STRUCTURE_SUPPORT_SHAPES, True)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_SECTIONS_SHAPE, True)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_STRUCTURE_NODE_NUMBERS, True)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_STRUCTURE_BAR_NUMBERS, False)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_SECTIONS_COLORS, False)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_LOADS_SYMBOLS_LINEAR, False)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_ADVANCED_RELEASE_SYMBOLS, True)
RVP.Set(IRobotViewDisplayAttributes.I_VDA_SECTIONS_SYMBOLS, False)

' Turn on deformation diagram for nodal displacements
RView.ParamsDiagram.Set(IRobotViewDiagramResultType.I_VDRT_DEFORMATION_DEFORMATION, True)

'Turn on local extremes labels with values for nodal displacements
RView.ParamsDiagram.Descriptions = IRobotViewDiagramDescriptionType.I_VDDT_LABELS
RView.ParamsDiagram.Values = IRobotViewDiagramValueType.I_VDVT_LOCAL_EXTREMES

' Set scales with static value
' THIS IS WHERE I WANT TO SET NORMALIZED DEFORMATION SCALE
RView.ParamsDiagram.SetScale(IRobotViewDiagramResultType.I_VDRT_DEFORMATION_DEFORMATION, 0.05)
RVP.SymbolSize = 2

'--------------------------------------------------------------------------------------
' THIS IS WHERE IT FAILS
RView.ParamsDetailed.Set(IRobotViewDetailedAnalysisResultType.I_VDART_NTM_UX, True)

' THESE SEEM TO NOT EXIST
'Dim targetEnums As IRobotViewDetailedAnalysisResultType() = {
'IRobotViewDetailedAnalysisResultType.I_VDART_NTM_UX,
'IRobotViewDetailedAnalysisResultType.I_VDART_NTM_UY,
'IRobotViewDetailedAnalysisResultType.I_VDART_NTM_UZ
'--------------------------------------------------------------------------------------

' Refresh graphical interfaces with correct settings
RobApp.Project.ViewMngr.Refresh()

' Prepare img output directory
Dim imgDir = Path.GetDirectoryName(fileName) + "\img\"
If Not Directory.Exists(imgDir) Then Directory.CreateDirectory(imgDir)

Dim ScPar As RobotViewScreenCaptureParams
ScPar = RobApp.CmpntFactory.Create(IRobotComponentType.I_CT_VIEW_SCREEN_CAPTURE_PARAMS)

ScPar.Name = "capture"
ScPar.ScaleAutomatic = True
ScPar.UpdateType = IRobotViewScreenCaptureUpdateType.I_SCUT_CURRENT_VIEW
ScPar.Resolution = IRobotViewScreenCaptureResolution.I_VSCR_4096
ScPar.UpdateType = IRobotViewScreenCaptureUpdateType.I_SCUT_COPY_TO_CLIPBOARD
RView.MakeScreenCapture(ScPar)

' Get image from clipboard and save it
Dim img = Clipboard.GetImage()
img.Save(imgDir + "Test.png", ImageFormat.Png)

 

I have found what seems to be the correct parameters and classes, see image [RSA - RobotAPI docref.png], as they correspend to the other settings in the same window "Diagrams (for Members)". I can also find these in the object overview in the reference, under ParamsDetailed [RSA - Objectoverview ParamsDetailed (not existing).png]. But every way I try, I can't manage to interact with the settings.

 

Does anyone know how to do this or point me into the right direction? Maybe @Stephane.kapetanovic, sorry to tag you so directly.

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

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @tobias_schnizer

You'll find plenty of information about configuring a view in this legendary thread:  (API) Command VBA Projection Capture of a view

  • Unfortunately IRobotView has no accessible ParamsDetailed property, even though it is mentioned in the PDF documentation.
  • So, the different values of the IRobotViewDetailedAnalysisResultType enum cannot be set on the view.
  • No implementation for automatic diagram scaling or normalization other than using the SetScale method. It should be possible to determine the structure’s scale within the view to relate it to that of the diagram. This requires applying your own rotations and adjustments, depending on the object to be framed, assuming familiarity with 2D/3D transformations.

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
Message 3 of 3

tobias_schnizer
Explorer
Explorer

Alright, thank you for your quick response!

Good to know, I thought I was going crazy for a couple of days now, haha. I have been looking into the tread you mentioned already for quite a while, indeed quite the gold mine. I have been able to do everything else that I needed. (The example script I provided earlier was a simpler version.) The only controls that I still needed were those last 2, but sadly unavailable.