(API) Command VBA Projection Capture of a view

(API) Command VBA Projection Capture of a view

Anonymous
Not applicable
23,947 Views
146 Replies
Message 1 of 147

(API) Command VBA Projection Capture of a view

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
23,948 Views
146 Replies
Replies (146)
Message 21 of 147

Anonymous
Not applicable

OK thanks a lot

0 Likes
Message 22 of 147

Anonymous
Not applicable

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%.

0 Likes
Message 23 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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
0 Likes
Message 24 of 147

Anonymous
Not applicable

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 ?

0 Likes
Message 25 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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
0 Likes
Message 26 of 147

Anonymous
Not applicable

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

0 Likes
Message 27 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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
0 Likes
Message 28 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support
0 Likes
Message 29 of 147

Anonymous
Not applicable

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

0 Likes
Message 30 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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



Rafal Gaweda
0 Likes
Message 31 of 147

Anonymous
Not applicable

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.

0 Likes
Message 32 of 147

Anonymous
Not applicable

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

0 Likes
Message 33 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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
0 Likes
Message 34 of 147

Anonymous
Not applicable

Ok I would like to activate also with VBA :

 

excentrements

Croquis barres

epaisseur panneaux

profilés couleurs

 

Can you give me the VBA command ?

 

0 Likes
Message 35 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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 147

Anonymous
Not applicable

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"

0 Likes
Message 37 of 147

Anonymous
Not applicable

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

0 Likes
Message 38 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

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
0 Likes
Message 39 of 147

Anonymous
Not applicable

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.

0 Likes
Message 40 of 147

Rafal.Gaweda
Autodesk Support
Autodesk Support

Movie of my code

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

 



Rafal Gaweda
0 Likes