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
8159 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 21 of 146
mateaus
in reply to: Rafal.Gaweda

OK thanks a lot

Message 22 of 146
mateaus
in reply to: Rafal.Gaweda

Hi I would like to make a zoom of my picture because I can't anything on my screen capture. I wrote this command but it's not good written. Would you mind correct it ?

 

mavueRobot.GetZoom(2, 2, 2, 2) = 1

 

I would like make a zoom of 150%.

Message 23 of 146
Rafal.Gaweda
in reply to: mateaus

It is not that easy because zoom depends on real coordinates and viewport size \ aspect ratio.

 

Small 2d example below. Left top corner is important and vieport aspect ratio

 

zoom2d.JPG

 

3d example  (left top corner is related to left top corner on ZX plain view) ; additionally you should define rotation point and rotation angle

z3d2.JPG



Rafal Gaweda
Message 24 of 146
mateaus
in reply to: Rafal.Gaweda

Hi it did'nt work.

 

I send you a video which show what I want to do ?

 

Would you mind send me the command of VBA to write in the macro for it ?

Message 25 of 146
Rafal.Gaweda
in reply to: mateaus

Try this - change zoomfactor:

 

 

 

Set RobApp = New RobotApplication

 


Dim viewRobot As IRobotView3

Set viewRobot = RobApp.Project.ViewMngr.GetView(1)

 viewRobot.Redraw (True)

viewRobot.Projection = I_VP_XY

viewRobot.ParamsFeMap.CurrentResult = I_VFMRT_DETAILED_MOMENT_XY

RobApp.Project.ViewMngr.Refresh

 

Dim l As Double, t As Double, b As Double, r As Double
l = 0
t = 0
b = 0
r = 0

viewRobot.GetZoom l, t, r, b

Dim CenterX As Double
Dim CenterY As Double
Dim VX As Double
Dim VY As Double

CenterX = (l + r) / 2
CenterY = (t + b) / 2

 

Dim zoomfacfor As Double
zoomfactor = 2
VX = Abs(l - CenterX) / zoomfactor
VY = Abs(t - CenterY) / zoomfactor

viewRobot.SetZoom CenterX + VX, CenterY + VY, CenterX - VX, CenterY - VY


RobApp.Project.ViewMngr.Refresh



Rafal Gaweda
Message 26 of 146
mateaus
in reply to: Rafal.Gaweda

It doesn't change anything in the view. Have a look to the video.

Message 27 of 146
Rafal.Gaweda
in reply to: mateaus


mateaus wrote:

It doesn't change anything in the view. Have a look to the video.


viewRobot.SetZoom CenterX + VX, CenterY + VY, CenterX - VX, CenterY - VY


viewRobot.Redraw(True) ' <- I have not used this command, take a look in my code or use   ...Redraw(0)


RobApp.Project.ViewMngr.Refresh

 

 



Rafal Gaweda
Message 28 of 146
Rafal.Gaweda
in reply to: Rafal.Gaweda

Message 29 of 146
mateaus
in reply to: Rafal.Gaweda

I don't understand what does mean left, top, right and bottom for the command getzoom ?

Message 30 of 146
Rafal.Gaweda
in reply to: mateaus

Take  a look at my screen shots in message 23 in this thread



Rafal Gaweda
Message 31 of 146
mateaus
in reply to: mateaus

I would like to modify the layout. I prefer without the object manager and with the rules.

 

Can you give me the command ? I think it's with IRobotLayoutId and IRobotViewMngr.

Message 32 of 146
mateaus
in reply to: Rafal.Gaweda

I already read it. I need more explanations if it's possible.

Message 33 of 146
Rafal.Gaweda
in reply to: mateaus

Ruler :

 

mavueRobot.ParamsDisplay.Set I_VDA_OTHER_RULER, True
robapp.Project.ViewMngr.Refresh

 

Object Inspector - not possible to open \ close it by API

 



Rafal Gaweda
Message 34 of 146
mateaus
in reply to: Rafal.Gaweda

Ok I would like to activate also with VBA :

 

excentrements

Croquis barres

epaisseur panneaux

profilés couleurs

 

Can you give me the VBA command ?

 

Message 35 of 146
Rafal.Gaweda
in reply to: mateaus

mavueRobot.ParamsDisplay.Set I_VDA_ADVANCED_OFFSETS, True

mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SHAPE, True

mavueRobot.ParamsDisplay.Set I_VDA_FE_PANEL_THICKNESSES, True

mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_COLORS, True
robapp.Project.ViewMngr.Refresh



Rafal Gaweda
Message 36 of 146
mateaus
in reply to: Rafal.Gaweda

I would like to give the name to a screen capture wich is the name of the load :

 

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

ScPar.Name = ???

 

I think it's something with get and from text ?

 

For example "3 : Equipements"

Message 37 of 146
mateaus
in reply to: Rafal.Gaweda

I have got a problem with the display. The symbol of loads doesn't appear.

 

The refresh is not done. Have you got an idea ?

 

mavueRobot.ParamsDisplay.Set I_VDA_ADVANCED_OFFSETS, False      'afficher exentrements
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SHAPE, False        'afficher croquis barres
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SYMBOLS, True       'afficher symboles barres
mavueRobot.ParamsDisplay.Set I_VDA_FE_PANEL_THICKNESSES, False  'afficher epaisseur panneaux
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_COLORS, False       'afficher profilés en couleur
mavueRobot.ParamsDisplay.Set I_VDA_FE_FE_INTERIOR, False        'interieur element finis
mavueRobot.ParamsDisplay.Set I_VDA_FE_CLADDING_INTERIOR, False  'interieur bardages
mavueRobot.ParamsDisplay.Set I_VDA_FE_PANEL_INTERIOR, False     'interieur panneaux
mavueRobot.ParamsDisplay.Set I_VDA_FE_FINITE_ELEMENTS, False    'afficher elements finis
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_VALUES, True               'valeurs charges
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_SYMBOLS_UNIFORM_SIZE, True '
mavueRobot.ParamsDisplay.Set 68, True                               'symbole charges ponctuelles
mavueRobot.ParamsDisplay.Set 69, True                               'symbole charges lineaires
mavueRobot.ParamsDisplay.Set 70, True                               'symbole charges surfaciques

For i = 1 To 3

mavueRobot.Selection.Get(I_OT_CASE).FromText (i) ' selecting case

mavueRobot.Redraw (0)
robapp.Project.ViewMngr.Refresh

ecran_capture = "charges" & i

Call screen_capture

Next i

 image result

Message 38 of 146
Rafal.Gaweda
in reply to: mateaus

I have got model from you once. There are no loads in case 1 and 3 so there is nothing to be displayed

Case 2 works fine.

 

.....

mavueRobot.Visible = True
'mavueRobot.Redraw (True)
mavueRobot.ParamsDisplay.Set I_VDA_OTHER_RULER, False
mavueRobot.ParamsDisplay.Set I_VDA_ADVANCED_OFFSETS, False 'afficher exentrements
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SHAPE, False 'afficher croquis barres
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SYMBOLS, True 'afficher symboles barres
mavueRobot.ParamsDisplay.Set I_VDA_FE_PANEL_THICKNESSES, False 'afficher epaisseur panneaux
mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_COLORS, False 'afficher profilés en couleur
mavueRobot.ParamsDisplay.Set I_VDA_FE_FE_INTERIOR, False 'interieur element finis
mavueRobot.ParamsDisplay.Set I_VDA_FE_CLADDING_INTERIOR, False 'interieur bardages
mavueRobot.ParamsDisplay.Set I_VDA_FE_PANEL_INTERIOR, False 'interieur panneaux
mavueRobot.ParamsDisplay.Set I_VDA_FE_FINITE_ELEMENTS, False 'afficher elements finis
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_VALUES, True 'valeurs charges
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_SYMBOLS_UNIFORM_SIZE, True '
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_SYMBOLS_CONCENTRATED, True
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_SYMBOLS_LINEAR, True
mavueRobot.ParamsDisplay.Set I_VDA_LOADS_SYMBOLS_PLANAR, True
RobApp.Project.ViewMngr.Refresh

' making screen capture
Dim ScPar As RobotViewScreenCaptureParams
Set ScPar = RobApp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS)

For i = 1 To 3

mavueRobot.Selection.Get(I_OT_CASE).FromText (i) ' selecting case

mavueRobot.Redraw (0)
RobApp.Project.ViewMngr.Refresh

ScPar.Name = "My screen capture" + Str(i)
ScPar.UpdateType = I_SCUT_UPDATED_UPON_PRINTING
mavueRobot.MakeScreenCapture ScPar
Next i

 

case2.jpg



Rafal Gaweda
Message 39 of 146
mateaus
in reply to: Rafal.Gaweda

It doesn't work, look at the video :

 

demo

 

I have to select by myself the case of load in the model.

 

Refresh doesn't work.

Message 40 of 146
Rafal.Gaweda
in reply to: mateaus

Movie of my code

I am using ARSA 2012, but the same effect I got on 2011

 



Rafal Gaweda

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

Post to forums  

Autodesk Design & Make Report