Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

API - closing views

klavs
Contributor

API - closing views

klavs
Contributor
Contributor

I'm creating alot of temporary views for screencaptures which I'm adding to the report using the API. 

 

How do i close the temporary views using the API?

0 Likes
Reply
Accepted solutions (1)
655 Views
7 Replies
Replies (7)

Stephane.kapetanovic
Mentor
Mentor

 Hi klavs,
 You can reuse the same view, pic your capture and reset the view for another.

One is enough.

 

Best Regards

0 Likes

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

klavs
Contributor
Contributor

Thanks that did the trick

0 Likes

jazlik
Contributor
Contributor

Hey! The link @Rafal.Gaweda sent is not working for me. Can somebody direct to me to it? I am in the same situation as the author of the post!
I am creating the view and later trying to close it/delete it as it slows down Robot quite a lot with so many views:

 

var panelSelection = GetPanelSelection(panelGroupName);
var rsaView = _rProject.ViewMngr.CreateView(IRobotViewType.I_VT_MAPS_ON_FINITE_ELEMENTS) as IRobotView3;

var selectedCombinations = GetCombGroupSelList(_rStructure.Groups, combType);
var getObjectsInView = rsaView.Selection.Get(IRobotObjectType.I_OT_CASE);
getObjectsInView.FromText(selectedCombinations);
rsaView.Selection.Set(IRobotObjectType.I_OT_PANEL, panelSelection);

var scrCaptureName = $"{panelGroupName} - {resultName} ({combType})";
CaptureRsaView(rsaView, scrCaptureName);

 

rsaView.Visible = -1;
Marshal.ReleaseComObject(view);
rsaView = null;

0 Likes

Stephane.kapetanovic
Mentor
Mentor

hi @jazlik 

Community content was recently archived. We're working to restore the discussion threads, but they might remain unavailable for a while. Support us here: https://forums.autodesk.com/t5/robot-structural-analysis-forum/community-content-archiving/td-p/1319...

 

Views can be closed like this:

Sub CreateViewAndCloseIt()
  Dim RobApp As IRobotApplication: Set RobApp = New RobotApplication
  
  Dim View As IRobotView3
  With RobApp.Project.ViewMngr
    Set View = .CreateView(.GetView(1).Type)
  End With
  With View.Window
    .Activate
    .State = I_WS_MAXIMIZE
    '[...]
    .SendMessage &H10, 0, 0
  End With
  
  Set RobApp = Nothing
End Sub

Best Regards

 

 

jazlik
Contributor
Contributor

Hey @Stephane.kapetanovic  thank you! Was new RobotApplication created here on purpose? Or was it just for having access to ViewMngr for creating new View?

0 Likes

Stephane.kapetanovic
Mentor
Mentor

Hi @jazlik 

The codes published here are for demonstration purposes.

Best Regards

0 Likes