- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
Solved! Go to Solution.