API - closing views

API - closing views

klavs
Contributor Contributor
1,020 Views
7 Replies
Message 1 of 8

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
Accepted solutions (1)
1,021 Views
7 Replies
Replies (7)
Message 2 of 8

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

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 8

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution
Message 4 of 8

klavs
Contributor
Contributor

Thanks that did the trick

0 Likes
Message 5 of 8

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
Message 6 of 8

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

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

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
Message 8 of 8

Stephane.kapetanovic
Mentor
Mentor

Hi @jazlik 

The codes published here are for demonstration purposes.

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