Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public Type pointM X As Double Y As Double Z As Double End Type 'tableau pour définir les contour des panneaux Public tableau_point_int(1 To 4) As pointM Public tableau_point_v1(1 To 4) As pointM Public tableau_point_v2(1 To 4) As pointM Public tableau_point_ext(1 To 6) As pointM Public ecran_capture As String Public typecharge As String Public casdecharge As String Public nocasdecharge As Integer Public valeurcharge As Double Public x_1 As Double Public y_1 As Double Public z_1 As Double Public x_2 As Double Public y_2 As Double Public z_2 As Double Public x_3 As Double Public y_3 As Double Public z_3 As Double Public x_4 As Double Public y_4 As Double Public z_4 As Double Public robapp As RobotApplication Sub robot_program() ' ouverture de robot, la session s'appellera robapp Set robapp = New RobotApplication ' ce sera une structure de type panneaux robapp.Project.New (I_PT_SHELL) robapp.Visible = True robapp.Interactive = False robapp.UserControl = False Dim RetVal Sleep 1000 Sheets("Données.dat").Select A = Range("B8").Value fichier_sortie = Range("B22").Value affaire = Range("B21").Value robapp.Project.OpenExtFile A, I_EFF_STR, 1 ' Ouvre le fichier text se trouvant dans A ' Call Plaque_Robot ' MsgBox "Calcul terminé" 'robapp.Project.Close 'robapp.Quit = True Call charges robapp.Project.CalcEngine.Calculate ' calculate model Call cree_vues_charges Call cree_vues_resultats ' saving printout \ report to file robapp.Project.PrintEngine.SaveReportToFile fichier_sortie, I_OFF_RTF_JPEG 'or directly opening printout in Word 'robapp.Project.PrintEngine.ExternalPreviewReport EPF_MS_OFFICE 'robapp.Quit I_QO_DISCARD_CHANGES ' Quitter sans sauvegarde End Sub Public Sub charges() 'trotoir gauche nocasdecharge = 3 valeurcharge = Sheets("charges permanentes").Range("M214").Value i = 49 'n° premiere colonne K = 36 'n° premiere ligne x_1 = Sheets("géométrie").Cells(K, i).Value y_1 = Sheets("géométrie").Cells(K, i + 1).Value z_1 = Sheets("géométrie").Cells(K, i + 2).Value x_2 = Sheets("géométrie").Cells(K + 1, i).Value y_2 = Sheets("géométrie").Cells(K + 1, i + 1).Value z_2 = Sheets("géométrie").Cells(K + 1, i + 2).Value x_3 = Sheets("géométrie").Cells(K + 2, i).Value y_3 = Sheets("géométrie").Cells(K + 2, i + 1).Value z_3 = Sheets("géométrie").Cells(K + 2, i + 2).Value x_4 = Sheets("géométrie").Cells(K + 3, i).Value y_4 = Sheets("géométrie").Cells(K + 3, i + 1).Value z_4 = Sheets("géométrie").Cells(K + 3, i + 2).Value Call chargement_panneau_contour 'trotoir gauche nocasdecharge = 3 valeurcharge = Sheets("charges permanentes").Range("M215").Value i = 49 K = 40 x_1 = Sheets("géométrie").Cells(K, i).Value y_1 = Sheets("géométrie").Cells(K, i + 1).Value z_1 = Sheets("géométrie").Cells(K, i + 2).Value x_2 = Sheets("géométrie").Cells(K + 1, i).Value y_2 = Sheets("géométrie").Cells(K + 1, i + 1).Value z_2 = Sheets("géométrie").Cells(K + 1, i + 2).Value x_3 = Sheets("géométrie").Cells(K + 2, i).Value y_3 = Sheets("géométrie").Cells(K + 2, i + 1).Value z_3 = Sheets("géométrie").Cells(K + 2, i + 2).Value x_4 = Sheets("géométrie").Cells(K + 3, i).Value y_4 = Sheets("géométrie").Cells(K + 3, i + 1).Value z_4 = Sheets("géométrie").Cells(K + 3, i + 2).Value Call chargement_panneau_contour End Sub Public Sub combinaisons() Dim Loads As RobotCaseServer Set Loads = robapp.Project.Structure.Cases Dim cmb As RobotCaseCombination Set cmb = Loads.CreateCombination(110, "COMB1", I_CBT_ALS, I_CN_EXPLOATATION, I_CAT_COMB) cmb.CaseFactors.New 1, 0.3 cmb.CaseFactors.New 2, 1 cmb.CaseFactors.New 6, 1 End Sub Sub chargement_panneau_contour() 'définit les cas de charges Dim Loads As RobotCaseServer Set Loads = robapp.Project.Structure.Cases Dim cas As RobotSimpleCase Dim recs As RobotLoadRecordMngr Dim rec_1 As RobotLoadRecordInContour Set cas = Loads.Get(nocasdecharge) 'creer un nouveau cas : ' Set cas = robapp.Project.Structure.Cases.CreateSimple(robapp.Project.Structure.Cases.FreeNumber, _ casdecharge, typecharge, I_CAT_STATIC_LINEAR) Set recs = cas.Records ' pression uniforme horizontale appliquée au contour ' définition des contours i = recs.New(I_LRT_IN_CONTOUR) ' création d'une nouvel enregistrement Set rec_1 = recs.Get(i) ' définition du plan de charge rec_1.Objects.FromText "tous" rec_1.SetValue I_ICRV_PX1, 0 rec_1.SetValue I_ICRV_PY1, 0 rec_1.SetValue I_ICRV_PZ1, -valeurcharge * 1000 rec_1.SetValue I_ICRV_PX2, 0# rec_1.SetValue I_ICRV_PY2, 0# rec_1.SetValue I_ICRV_PZ2, -valeurcharge * 1000 rec_1.SetValue I_ICRV_PX3, 0# rec_1.SetValue I_ICRV_PY3, 0# rec_1.SetValue I_ICRV_PZ3, -valeurcharge * 1000 ' sens de projection des efforts rec_1.SetValue I_ICRV_PROJECTION, 1 ' nombre de points composant le contour rec_1.SetValue I_ICRV_NPOINTS, 4 rec_1.SetValue I_ICRV_LOCAL, 0 ' définition des points sur le panneau rec_1.SetPoint 1, 0, 0, 0 rec_1.SetPoint 2, 1, 1, 0 rec_1.SetPoint 3, 1, 0, 0 rec_1.SetContourPoint 1, x_1, y_1, z_1 rec_1.SetContourPoint 2, x_2, y_2, z_2 rec_1.SetContourPoint 3, x_3, y_3, z_3 rec_1.SetContourPoint 4, x_4, y_4, z_4 rec_1.SetVector 0, 0, 1 Set recs = Nothing Set rec_1 = Nothing Set cas = Nothing End Sub Sub cree_vues_charges() Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view Set mavueRobot = robapp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use GetView instead mavueRobot.Projection = I_VP_3DXYZ mavueRobot.Redraw (True) 'faire un zoom Dim l As Double, t As Double, b As Double, r As Double l = 0 t = 0 b = 0 r = 0 mavueRobot.GetZoom l, t, r, b Dim CenterX As Double Dim CenterY As Double Dim VX As Double Dim VY As Double Dim zoomfacfor As Double Dim transfactor As Double transfactor = 0 zoomfactor = 1.6 CenterX = (l + r) / 2 CenterY = (t + b) / 2 VX = Abs(l - CenterX) / zoomfactor VY = Abs(t - CenterY) / zoomfactor CenterY = CenterY - transfactor * (t - b) mavueRobot.SetZoom CenterX + VX, CenterY + VY, CenterX - VX, CenterY - VY 'gauche haut droit bas 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 mavueRobot.Redraw (0) robapp.Project.ViewMngr.Refresh ecran_capture = "vue modele" Call screen_capture 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_OTHER_HIDE_NODES, True 'masquer noeuds mavueRobot.ParamsDisplay.Set 68, True 'symbole charges ponctuelles mavueRobot.ParamsDisplay.Set 69, True 'symbole charges lineaires mavueRobot.ParamsDisplay.Set 70, True 'symbole charges surfaciques robapp.Project.ViewMngr.Refresh For i = 1 To 3 mavueRobot.Selection.Get(I_OT_CASE).FromText (i) ' selecting case MsgBox ("Selectionner cas " & i) mavueRobot.Redraw (0) robapp.Project.ViewMngr.Refresh ecran_capture = "charges" + Str(i) Call screen_capture Next i End Sub Sub cree_vues_resultats() Dim mavueRobot As IRobotView3 ' this is important to set IRobotView3 if you want to make screen capture of this view Set mavueRobot = robapp.Project.ViewMngr.GetView(1) ' it seems CreateView makes this strange affect, use GetView instead mavueRobot.Projection = I_VP_XY_3D 'mavueRobot.Projection = I_VP_3DXYZ mavueRobot.ParamsDisplay.Set I_VDA_OTHER_RULER, True mavueRobot.Visible = True mavueRobot.Redraw (True) robapp.Project.ViewMngr.Refresh 'faire un zoom Dim l As Double, t As Double, b As Double, r As Double l = 0 t = 0 b = 0 r = 0 mavueRobot.GetZoom l, t, r, b Dim CenterX As Double Dim CenterY As Double Dim VX As Double Dim VY As Double Dim zoomfacfor As Double Dim transfactor As Double transfactor = 0.2 zoomfactor = 1.4 CenterX = (l + r) / 2 CenterY = (t + b) / 2 VX = Abs(l - CenterX) / zoomfactor VY = Abs(t - CenterY) / zoomfactor CenterY = CenterY - transfactor * (t - b) mavueRobot.SetZoom CenterX + VX, CenterY + VY, CenterX - VX, CenterY - VY 'gauche haut droit bas mavueRobot.Visible = True mavueRobot.Redraw (0) robapp.Project.ViewMngr.Refresh mavueRobot.Selection.Get(I_OT_CASE).FromText ("101") ' selecting case for results display ' displaying map 'mavueRobot.ParamsFeMap.CurrentResult = I_VFMRT_GLOBAL_DISPLACEMENT_Z mavueRobot.ParamsFeMap.WithDescription = True mavueRobot.ParamsDisplay.Set I_VDA_SECTIONS_SYMBOLS, False mavueRobot.ParamsFeMap.CurrentResult = I_VFMRT_COMPLEX_REINFORCE_TOP_MYY ecran_capture = "moments COMB1 Myy+" mavueRobot.Redraw (0) robapp.Project.ViewMngr.Refresh Call screen_capture mavueRobot.ParamsFeMap.CurrentResult = I_VFMRT_COMPLEX_REINFORCE_TOP_MXX ecran_capture = "moments COMB1 Mxx+" mavueRobot.Redraw (0) robapp.Project.ViewMngr.Refresh Call screen_capture End Sub Sub screen_capture() Dim mavueRobot As IRobotView3 Set mavueRobot = robapp.Project.ViewMngr.GetView(1) Dim ScPar As RobotViewScreenCaptureParams Set ScPar = robapp.CmpntFactory.Create(I_CT_VIEW_SCREEN_CAPTURE_PARAMS) ScPar.Name = ecran_capture ScPar.UpdateType = I_SCUT_CURRENT_VIEW 'ScPar.Resolution = I_VSCR_4096 mavueRobot.MakeScreenCapture ScPar robapp.Project.PrintEngine.AddScToReport ecran_capture