Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(API) Command VBA Projection Capture of a view

145 REPLIES 145
SOLVED
Reply
Message 1 of 146
mateaus
8160 Views, 145 Replies

(API) Command VBA Projection Capture of a view

Hi,

 

I have a problem with my macro. The command of projection in 3D doesn't work. My view stay in XZ plane.

 

robapp.Window.Activate
Set mavueRobot = robapp.Project.ViewMngr.CreateView(1)
mavueRobot.Projection = I_VP_3DXYZ


mavueRobot.Visible = True
mavueRobot.Redraw (True)

 

I want also make a capture of my model with diagram of results. Have you an example of code for it ?

 

I would like to get for final result the exemple in attachment.

145 REPLIES 145
Message 121 of 146

Is there a way to access the results map scale normalize button using API?

 

No, there is not. 

 

If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.



Artur Kosakowski
Message 122 of 146

Ok thanks.

 

I'm also trying to output a panel local axis direction vector using "GetDirX" function. It seems the function will only output 0, 0, 0? Can you tell me what I'm doing wrong?

 

                    Dim xVec As Double, yVec As Double, zVec As Double
                    
                    With FEparams
                        .Panel = PanelCol.Get(ii).Number
                        .GetDirX xVec, yVec, zVec
                    End With

 

Thanks.

 

Message 123 of 146
Rafal.Gaweda
in reply to: GGrayAtkins

  Dim RSel As RobotSelection
    Set RSel = RobApp.Project.Structure.Selections.CreateFull(I_OT_PANEL)
    Dim PanelCol As RobotObjObjectCollection
    Set PanelCol = RobApp.Project.Structure.Objects.GetMany(RSel)
    
    Dim X As RobotGeoPoint3D, Y As RobotGeoPoint3D, Z As RobotGeoPoint3D
    Dim Obj As RobotObjObject
    
    Set X = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
    Set Y = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
    Set Z = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
        
    For ii = 1 To PanelCol.Count
        
        Set Obj = PanelCol.Get(ii)
        Obj.Main.Attribs.GetLCS X, Y, Z
        
        Cells(12 + ii, 3) = Obj.Number
        Cells(12 + ii, 4) = "LCS X=" + Str(X.X) + ";" + Str(X.Y) + ";" + Str(X.Z)
        Cells(12 + ii, 5) = "LCS Y=" + Str(Y.X) + ";" + Str(Y.Y) + ";" + Str(Y.Z)
        Cells(12 + ii, 6) = "LCS Z=" + Str(Z.X) + ";" + Str(Z.Y) + ";" + Str(Z.Z)
        
    Next ii


Rafal Gaweda
Message 124 of 146
GGrayAtkins
in reply to: Rafal.Gaweda

Obj.Main.Attribs.GetLCS X, Y, Z

 

.GetLCS isn't available or mentioned anywhere in the API user guide. I'm using Robot 2014 Professional. Is there any other method for this version?

 

Thanks.

Message 125 of 146
Rafal.Gaweda
in reply to: GGrayAtkins

In this version you can get only local X

 

    Dim X As Double, Y As Double, Z As Double
    Obj.Main.Attribs.GetDirX X, Y, Z


Rafal Gaweda
Message 126 of 146
stevecms46
in reply to: Rafal.Gaweda

@Rafal.Gaweda could you have a look to the code that you wrote some years ago...seems doesn't work.

There are a lot of posts and I'm getting confuse. Is it possible to have just the code for having a screenshot from Robot please? 

Message 127 of 146
Rafal.Gaweda
in reply to: stevecms46

Hi @stevecms46

 

Example code

 

Sub screen_capture()

Dim viewRobot As IRobotView3
Set viewRobot = robapp.Project.ViewMngr.GetView(1)
Dim ScPar As RobotViewScreenCaptureParams
Set ScPar = robapp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)

ScPar.Name = "capture"
ScPar.UpdateType = I_SCUT_CURRENT_VIEW
ScPar.Resolution = I_VSCR_4096
viewRobot.MakeScreenCapture ScPar
robapp.Project.PrintEngine.AddScToReport "capture"

End Sub


Rafal Gaweda
Message 128 of 146
RSAJunior-
in reply to: Rafal.Gaweda

@Rafal.Gaweda Where I should get the screen?

Message 129 of 146
Rafal.Gaweda
in reply to: RSAJunior-

Hi @RSAJunior-

 

As always, in Printout Composition



Rafal Gaweda
Message 130 of 146
RSAJunior-
in reply to: Rafal.Gaweda

@Rafal.Gaweda Why do I get several screen (around 12), I would like to get just one!

Message 131 of 146
Rafal.Gaweda
in reply to: RSAJunior-

Hi @RSAJunior-

 

Delete all screen captures from the file, try your code, if needed debug your code.



Rafal Gaweda
Message 132 of 146
RSAJunior-
in reply to: Rafal.Gaweda

@Rafal.Gaweda I still get several picture.

I'm trying to get a screen in a path like that:

RobApp.Project.PrintEngine.ScreenCaptures "c:\test1.jpeg", I_OFF_RTF_JPEG

or 

RobApp.Project.PrintEngine.SaveReportToFile  "c:\test2.jpeg", I_OFF_RTF_JPEG

 

Both lines don't work!

Message 133 of 146
Rafal.Gaweda
in reply to: RSAJunior-

HI @RSAJunior-

 

Files extensions should be rtf

 

fichier_sortie = "d:\prb\outjpg.rtf"
RobApp.Project.PrintEngine.SaveReportToFile fichier_sortie, I_OFF_RTF_JPEG
fichier_sortie = "d:\prb\out.rtf"
RobApp.Project.PrintEngine.SaveReportToFile fichier_sortie, I_OFF_RTF


Rafal Gaweda
Message 134 of 146
RSAJunior-
in reply to: Rafal.Gaweda

@Rafal.Gaweda Is it no possible to get a picture file instead of rtf?

Message 135 of 146
Rafal.Gaweda
in reply to: RSAJunior-

Hi @RSAJunior-

 

Is it no possible to get a picture file instead of rtf?


No



Rafal Gaweda
Message 136 of 146
stevecms46
in reply to: Rafal.Gaweda

@Rafal.Gaweda what about excel? Is it possible to get a screen from Robot in the excel file?

Message 137 of 146
Rafal.Gaweda
in reply to: stevecms46

Hi @stevecms46

 

You may try (I personally have never checked it) to make screen capture to clipboard and then paste it in Excel

 

Dim ScPar As RobotViewScreenCaptureParams
Set ScPar = robapp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)

ScPar.Name = "capture"
ScPar.UpdateType = I_SCUT_CURRENT_VIEW
ScPar.Resolution = I_VSCR_4096
ScPar.UpdateType = I_SCUT_COPY_TO_CLIPBOARD

view.MakeScreenCapture ScPar

 



Rafal Gaweda
Message 138 of 146
rhlkochar
in reply to: Rafal.Gaweda

Hi @Rafal.Gaweda,

 

I want screen captures for MXX,MYY and so on (sectional forces and moments) for the structure that I have. I want to just save these screen captures in jpeg format in a folder so that I can use them later.

 

I have written the following code:

 

IRobotView3 mavuerobot = Robapp.Project.ViewMngr.GetView(1) as IRobotView3;
mavuerobot.Selection.Get(IRobotObjectType.I_OT_CASE).FromText("1");
mavuerobot.Redraw(1);
mavuerobot.Projection = IRobotViewProjection.I_VP_3DXYZ;


mavuerobot.ParamsFeMap.CurrentResult = IRobotViewFeMapResultType.I_VFMRT_DETAILED_MOMENT_XX;
mavuerobot.Visible = 1;
mavuerobot.Redraw(1);
Robapp.Project.ViewMngr.Refresh();

 

RobotViewScreenCaptureParams ScPar = Robapp.CmpntFactory.Create(IRobotComponentType.I_CT_VIEW_SCREEN_CAPTURE_PARAMS);
ScPar.Name = "First capture";
ScPar.UpdateType =IRobotViewScreenCaptureUpdateType.I_SCUT_CURRENT_VIEW;
ScPar.Resolution =IRobotViewScreenCaptureResolution.I_VSCR_4096;
mavuerobot.MakeScreenCapture(ScPar);

 

 

Could you please help me as to how I should save the screen capture in .jpeg now? And I am correctly capturing the screen capture for panel MXX through the above code?

Message 139 of 146
Rafal.Gaweda
in reply to: rhlkochar

Hi @rhlkochar

 

I hope my answer in post 135 is clear enough.

 



Rafal Gaweda
Message 140 of 146
rhlkochar
in reply to: Rafal.Gaweda

Hi @Rafal.Gaweda,

Thank you for your response  

How do I take the screen capture and put it in an Excel file? 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report