ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magicsld/PoGCode.vb
(Generate patch)

Comparing magicsld/PoGCode.vb (file contents):
Revision 46 by bournival, Wed Aug 22 18:28:53 2007 UTC vs.
Revision 51 by lacroix, Fri Aug 24 21:33:21 2007 UTC

# Line 1 | Line 1
1   Imports System
2   Imports System.IO
3 + Imports SolidWorks.Interop
4 + Imports SolidWorks.Interop.swconst
5 + Imports SolidWorks.Interop.swpublished
6   Module PoGCode
7      Private TabPoints(,) As Double
8      Private tabpointsface() As SldWorks.Face2
# Line 46 | Line 49 | Module PoGCode
49          Dim grill As New grille
50          Dim Bbox() As Double
51          Dim path As String
49        Dim erx_rm As Double
52  
53  
54          Dim CMDialogl As New Windows.Forms.SaveFileDialog
# Line 75 | Line 77 | Module PoGCode
77              initialisation()
78  
79              'initialistation de la grille
80 <            Dim Coeffmax As Double = Math.Max(Math.Max(Arrondis, matiere), Math.Max(rentrant, Entities))
81 <            Dim taillecase As Double = Eng * (1 - Coeffmax)
80 >            Dim Coeffmin As Double = Math.Min(Math.Min(Arrondis, matiere), Math.Min(rentrant, Entities))
81 >            Dim taillecase As Double = Eng * (1 - Coeffmin)
82              Bbox = swbody.GetBodyBox
83              ' on initialise la grille 0.5 pourcent supérieur à la bounding box
84              grill.initialiser(Bbox(0) - (Bbox(3) - Bbox(0)) * 0.005, Bbox(1) - (Bbox(4) - Bbox(1)) * 0.005, Bbox(2) - (Bbox(5) - Bbox(2)) * 0.005, Bbox(3) + (Bbox(3) - Bbox(0)) * 0.005, Bbox(4) + (Bbox(4) - Bbox(1)) * 0.005, Bbox(5) + (Bbox(5) - Bbox(2)) * 0.005, Int((Bbox(3) - Bbox(0) + 2 * (Bbox(3) - Bbox(0)) * 0.005) / taillecase), Int((Bbox(4) - Bbox(1) + 2 * (Bbox(4) - Bbox(1)) * 0.005) / taillecase), Int((Bbox(5) - Bbox(2) + 2 * (Bbox(5) - Bbox(2)) * 0.005) / taillecase))
# Line 87 | Line 89 | Module PoGCode
89              End If
90              ' Si la case retrait matiere est cochée
91              If matiereBool = True Then
92 <                erx_rm = determination_precision_retrait_mat(Eng, matiere)
91 <                raffinement_retrait_matiere(Eng, erx_rm)
92 <                'testretraitMatiere(Eng, erx_rm)
92 >                testretraitMatiere(matiere)
93              End If
94              ' si la case rentrant est cochée
95              If rentrantBool = True Then
# Line 134 | Line 134 | Module PoGCode
134      ''' <remarks></remarks>
135      Public Function DebutAutomatique(ByVal Erx As Double, ByVal LimPT As Double) As String
136  
137 <        MsgBox("Erx = " & Erx & vbCr & "Limite = " & LimPT)
137 >        Dim vbody As Object
138 >        Dim grill As New grille
139 >        Dim Bbox() As Double
140 >        Dim path As String
141 >        Dim Eng As Double = 0
142 >        Dim coef_min As Double
143 >        Erx = (100 - Erx) / 100 ' valeur d'erreur d'analyse exacte a priori
144 >
145 >
146 >        Dim CMDialogl As New Windows.Forms.SaveFileDialog
147 >        CMDialogl.DefaultExt = ".txt"
148 >        CMDialogl.Filter = "Fichiers PoG (*.txt)|*.txt|Tout fichiers(*.*)|*.*"
149 >
150 >        CMDialogl.OverwritePrompt = True
151 >        CMDialogl.Title = "Sélectionnez le fichier pour enregistrer les points"
152 >        CMDialogl.ShowDialog()
153 >        path = CMDialogl.FileName
154 >        path = Txtpath(path)
155 >        If path Is Nothing Or path = "" Then MsgBox("Aucun fichier sélectionné, sortie du programme!", MsgBoxStyle.Critical, "Erreur!") : Return ""
156 >
157 >        vBodies = swPart.GetBodies2(SwConst.swBodyType_e.swAllBodies, True)
158 >        For Each vbody In vBodies
159 >            cpt = 0
160 >            Erase TabPoints
161 >            Erase Tabface
162 >            Erase TabFaceDouble
163 >            Erase TabEdge
164 >            Erase TabEdgeDouble
165 >
166 >            swbody = vbody
167 >            BoiteEnglobante()
168 >            initialisation()
169 >
170 >            'Calul de Eng
171 >            Eng = determination_ecart_nodal_global_retraits_mat(Erx, coef_min)
172 >            If Eng = 0 Then Continue For
173 >
174 >            'initialistation de la grille
175 >
176 >            Dim taillecase As Double = Eng * (1 - coef_min)
177 >            Bbox = swbody.GetBodyBox
178 >            ' on initialise la grille 0.5 pourcent supérieur à la bounding box
179 >            grill.initialiser(Bbox(0) - (Bbox(3) - Bbox(0)) * 0.005, Bbox(1) - (Bbox(4) - Bbox(1)) * 0.005, Bbox(2) - (Bbox(5) - Bbox(2)) * 0.005, Bbox(3) + (Bbox(3) - Bbox(0)) * 0.005, Bbox(4) + (Bbox(4) - Bbox(1)) * 0.005, Bbox(5) + (Bbox(5) - Bbox(2)) * 0.005, Int((Bbox(3) - Bbox(0) + 2 * (Bbox(3) - Bbox(0)) * 0.005) / taillecase), Int((Bbox(4) - Bbox(1) + 2 * (Bbox(4) - Bbox(1)) * 0.005) / taillecase), Int((Bbox(5) - Bbox(2) + 2 * (Bbox(5) - Bbox(2)) * 0.005) / taillecase))
180  
181 <        Return Nothing
181 >
182 >            raffinement_retrait_matiere(Eng, Erx, LimPT)
183 >
184 >
185 >            ' on crée les points d'échantillonnage sur les sommets
186 >            CreerPointsVertex(Eng, grill)
187 >            ' on crée les points d'échantillonnage sur les arêtes
188 >            CreerPointsEdge(Eng, grill)
189 >            ' on crée les points d'échantillonnage sur les faces
190 >            CreerPointsFace(Eng, grill)
191 >
192 >
193 >            ' on créée le fichier d'échantillonnage
194 >            fichiertxt(Eng, path)
195 >            swModel.ClearSelection2(True)
196 >            testPog(False, False, False, True, False)
197 >            Return path
198 >        Next vbody
199      End Function
200  
201      Sub entitéselection(ByRef coeff As Double, ByRef Ind As Boolean)
# Line 385 | Line 444 | Module PoGCode
444          Next cpt1
445  
446      End Sub
447 <    Sub testretraitMatiere(ByRef Eng As Double, ByRef erx As Double)
447 >    Sub testretraitMatiere(ByRef coeff As Double)
448  
449          Dim swface As SldWorks.Face2
450          Dim swsurface As SldWorks.Surface
# Line 395 | Line 454 | Module PoGCode
454          Dim cpt1 As Integer
455          Dim cpt2 As Integer
456          Dim swedge As SldWorks.Edge
398        Dim swedgetmp As SldWorks.Edge
457          Dim vedge As Object
458          Dim vface As Object
459          Dim cpt3 As Integer
402        Dim cpt4 As Integer
460          Dim i As Integer
461          Dim swent As SldWorks.Entity
462          Dim bRet As Boolean
463 <        Dim lmbd_rm As Integer
464 <        Dim courb_rm As Double
408 <        Dim coeff As Double
409 <        Dim lg As Double
410 <        Dim lgi As Double
411 <        Dim angle As Double
412 <        Dim n(2) As Double
413 <        Dim area As Double
414 <        Dim select_loop As Integer
415 <        Dim t As Double
416 <        Dim diametre As Double = 0
417 <        Dim tmp() As Double
418 <
419 <
420 <        lmbd_rm = 0
421 <        courb_rm = 0
463 >        Dim lmbd_rm As Double = 4
464 >        Dim courb_rm As Double = 0
465  
466          swfaceref = swbody.GetFirstFace
467 +
468          For cpt1 = 0 To swbody.GetFaceCount - 1
425            diametre = 0
469              swfeat = swfaceref.GetFeature
470              swsurface = swfaceref.GetSurface
471              swloop = swfaceref.GetFirstLoop
472              For cpt2 = 0 To swfaceref.GetLoopCount - 1
430                select_loop = 0
473                  If swloop.IsOuter = False Then
474                      vedge = swloop.GetEdges
475                      For cpt3 = 0 To swloop.GetEdgeCount - 1
476                          swedge = vedge(cpt3)
477                          vface = swedge.GetTwoAdjacentFaces
478 <                        swface = vface(0)
479 <                        If swface.IsSame(swfaceref) = True Then swface = vface(1)
480 <                        angle = GetAngle(swedge, swfaceref, swface)
481 <                        If angle < 179 Then
482 <                            If (select_loop = 0) Then
483 <
442 <                                n = direction_retrait_matiere(swloop, swfaceref)
443 <                                lg = 0
444 <                                For cpt4 = 0 To swloop.GetEdgeCount - 1
445 <                                    swedgetmp = vedge(cpt4)
446 <                                    lgi = get_edge_plane_lenght(swedgetmp, n)
447 <                                    lg = lg + lgi
448 <                                Next cpt4
449 <                                area = get_loop_plane_area(swloop, n)
450 <
451 <                                diametre = 4 * area / lg
452 <
453 <                                select_loop = 1
454 <                            End If
455 <                            If diametre > 0.000001 Then
456 <                                If raffinn_auto_retrait_mat(erx, coeff, lmbd_rm, courb_rm, Eng, diametre / 2, tmp) Then ChangeTabFace(swface, coeff, lmbd_rm, courb_rm)
478 >                        For i = 0 To 1
479 >                            swface = vface(i)
480 >                            If swface.IsSame(swfaceref) = False Then
481 >                                If GetAngle(swedge, swfaceref, swface) < 179 Then
482 >                                    ChangeTabFace(swface, coeff)
483 >                                End If
484                              End If
485 <                        End If
485 >                        Next i
486                      Next cpt3
487                  Else
488                      If swfeat.GetTypeName = "HoleWzd" Then
489 <                        diametre = 0
463 <                        Dim hole As SldWorks.WizardHoleFeatureData2
464 <                        hole = swfeat.GetDefinition
465 <                        Select Case hole.Type
466 <                            Case 0, 2 To 5, 7 To 9
467 <                                diametre = hole.Diameter
468 <                            Case 1, 6
469 <                                diametre = (hole.MajorDiameter - hole.MinorDiameter) / 2
470 <                            Case 10 To 13, 22 To 24, 43
471 <                                diametre = hole.HoleDiameter
472 <                            Case 14 To 21, 25 To 30, 44, 45
473 <                                diametre = hole.ThruHoleDiameter
474 <                            Case 31, 32, 37, 38, 46, 47
475 <                                diametre = hole.TapDrillDiameter
476 <                            Case 33 To 36, 39 To 42, 48 To 55
477 <                                diametre = hole.ThruTapDrillDiameter
478 <                            Case Else
479 <                                MsgBox("Type de trou non reconnu")
480 <                        End Select
481 <                        If diametre > 0.000001 Then
482 <                            If raffinn_auto_retrait_mat(erx, coeff, lmbd_rm, courb_rm, Eng, diametre / 2, tmp) Then ChangeTabFace(swfaceref, coeff, lmbd_rm, courb_rm)
483 <                        End If
489 >                        ChangeTabFace(swfaceref, coeff)
490                      Else
491 <                        If swfeat.GetFaceCount = 1 And (swfeat.GetTypeName = "Cut" Or swfeat.GetTypeName = "RevCut") Then
492 <                            diametre = 0
493 <                            Dim params() As Double
488 <                            If swsurface.Identity = 4002 Then
489 <                                params = swsurface.CylinderParams
490 <                                diametre = params(6) * 2
491 <                            End If
492 <                            If swsurface.Identity = 4003 Then
493 <                                params = swsurface.ConeParams
494 <                                diametre = params(6) * 2
495 <                            End If
496 <                            If swsurface.Identity = 4005 Then
497 <                                params = swsurface.TorusParams
498 <                                diametre = params(7) * 2
499 <                            End If
500 <                            If diametre > 0.000001 Then
501 <                                If raffinn_auto_retrait_mat(erx, coeff, lmbd_rm, courb_rm, Eng, diametre / 2, tmp) Then ChangeTabFace(swfaceref, coeff, lmbd_rm, courb_rm)
491 >                        If swfeat.GetFaceCount = 1 And swfeat.GetTypeName = "Cut" Then
492 >                            If swsurface.Identity = 4002 Or swsurface.Identity = 4003 Or swsurface.Identity = 4005 Then
493 >                                ChangeTabFace(swfaceref, coeff)
494                              End If
495                          End If
496                      End If
# Line 507 | Line 499 | Module PoGCode
499              Next cpt2
500              swfaceref = swfaceref.GetNextFace
501          Next cpt1
502 +
503      End Sub
504      Sub testAngleMatiere(ByRef coeff As Double)
505  
# Line 519 | Line 512 | Module PoGCode
512          Dim cpt1 As Integer
513          Dim Phi As Double
514          Dim swcurve As SldWorks.Curve
515 <        Dim lmbd_am As Integer
516 <        Dim courb_am As Double
517 <        lmbd_am = 6
525 <        courb_am = 2
515 >        Dim lmbd_am As Double = 4
516 >        Dim courb_am As Double = 0
517 >
518  
519          vedge = swbody.GetEdges
520          ' on test les arete et on prend celles qui sont des lignes
# Line 1638 | Line 1630 | Module PoGCode
1630                  swedge = TabEdge(cpt2)
1631                  vEdgeU = swedge.GetCurveParams2
1632                  longueur = GetEdgeLenght(swedge)
1633 <                pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2), 0.15)
1633 >                pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2))
1634  
1635                  nbpas = 3 * Math.Max(2, Math.Floor(longueur / pasmax - 0.0001) + 1)
1636                  pas = (vEdgeU(7) - vEdgeU(6)) / nbpas
# Line 1724 | Line 1716 | Module PoGCode
1716                  vSurfParam = swsurf.Parameterization
1717  
1718                  vUVlong = GetUVLong(swface)
1719 <                pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3), 0.15)
1719 >                pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3))
1720  
1721                  nbpasU = 3 * Math.Max(2, Math.Floor(vUVlong(0) / pasmax - 0.0001) + 1)
1722                  nbpasV = 3 * Math.Max(2, Math.Floor(vUVlong(1) / pasmax - 0.0001) + 1)
# Line 2148 | Line 2140 | Module PoGCode
2140  
2141  
2142      End Sub
2143 <    Function distance_entre_points(ByVal eng As Double, ByVal coef As Double, ByVal lmbd As Double, ByVal courbure As Double, ByVal erreur As Double) As Double
2143 >    Function distance_entre_points(ByVal eng As Double, ByVal coef As Double, ByVal lmbd As Double, ByVal courbure As Double, Optional ByVal erreur As Double = 1) As Double
2144          Dim rmax As Double
2145 +        Dim nor As Double = 0.5
2146 +        Dim eni As Double = eng * coef
2147 +        Dim enmax As Double = eng * coef * (1 + erreur)
2148  
2154        If courbure <= 0 Then
2155            rmax = erreur
2156        End If
2149  
2150 <        If courbure > 0 Then
2151 <            rmax = -0.05 * (Math.Sqrt(1 - 40 * courbure * erreur * (erreur - 1)) - 1) / ((erreur - 1) * courbure)
2160 <        End If
2150 >        If (courbure > 0.0001) Then rmax = 0.05 * (Math.Sqrt((nor * (eng - enmax) - eni + enmax) * (nor * (eng - enmax) - eni + enmax) - 40 * courbure * nor * (eni - enmax) * (eng - enmax)) - nor * (eng - enmax) + eni - enmax) / (courbure * nor * (eng - enmax))
2151 >        If (courbure <= 0.0001) Then rmax = (enmax - eni) / (nor * (eng - enmax) - eni + enmax)
2152  
2162        'If courbure < 0 Then
2163        '    rmax = 0.05 * (Math.Sqrt(40 * courbure * erreur * (erreur - 1) + 1) + 20 * erreur * courbure - 1) / (erreur * courbure)
2164        'End If
2153  
2154          Return 2 * rmax * lmbd * eng * (1 - coef)
2155  
# Line 2706 | Line 2694 | Module PoGCode
2694          End If
2695          direction_retrait_matiere = n
2696      End Function
2697 <    Function raffinn_auto_retrait_mat(ByVal Erx_ref As Double, ByRef coef As Double, ByRef lmbd As Double, ByRef courb As Double, ByVal Dng As Double, ByVal rayon As Double, ByRef params() As Double) As Boolean
2697 >    Function raffinn_auto_retrait_mat(ByVal Erx_ref As Double, ByRef coef As Double, ByRef lmbd As Double, ByRef courb As Double, ByVal Dng As Double, ByVal rayon As Double, ByVal pentelimite As Double, ByRef params() As Double) As Boolean
2698          Dim delta_ref_theo As Double
2699          Dim delta_ref_ptlimite As Double
2700          Dim Eng_ref As Double
# Line 2716 | Line 2704 | Module PoGCode
2704          Dim A As Double = 0.12
2705          Dim B As Double = 0.68
2706          Dim param_rm() As Double
2719        Dim pentelimite As Double = 0.25
2707  
2708          Dim x As Double
2709          Dim pente As Double
# Line 2775 | Line 2762 | Module PoGCode
2762          ReDim param(4)
2763          param(0) = A : param(1) = B : param(2) = C : param(3) = D
2764      End Function
2765 <    Function determination_precision_retrait_mat(ByRef Eng As Double, ByRef coeff_rm As Double) As Double
2765 >    Function determination_ecart_nodal_global_retraits_mat(ByRef Erx_m As Double, ByRef coeffmin As Double) As Double
2766  
2767          Dim swface As SldWorks.Face2
2768          Dim swsurface As SldWorks.Surface
# Line 2790 | Line 2777 | Module PoGCode
2777          Dim vface As Object
2778          Dim cpt3 As Integer
2779          Dim cpt4 As Integer
2793        Dim i As Integer
2794        Dim swent As SldWorks.Entity
2795        Dim bRet As Boolean
2796        Dim lmbd_rm As Integer
2797        Dim courb_rm As Double
2780          Dim lg As Double
2781          Dim lgi As Double
2782          Dim angle As Double
2783          Dim n(2) As Double
2784          Dim area As Double
2785          Dim select_loop As Integer
2804        Dim t As Double
2786          Dim diametre As Double = 0
2787          Dim nb_retrait_mat As Integer = 0
2788          Dim param(1) As Double
2789 <        Dim Eni_moy As Double = Eng * coeff_rm
2789 >        Dim Eng_moy As Double = 0
2790 >        Dim Eng_ref As Double = 0
2791          Dim tmp() As Double
2792 +        Dim Eni As Double
2793  
2794          ReDim Preserve Tabretrait_mat(0)
2795          Tabretrait_mat(0) = New retrait_mat(Nothing, 0)
2796 +        raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param)
2797  
2798          swfaceref = swbody.GetFirstFace
2799          For cpt1 = 0 To swbody.GetFaceCount - 1
# Line 2842 | Line 2826 | Module PoGCode
2826                                  select_loop = 1
2827                              End If
2828                              If diametre > 0.000001 Then
2829 <                                If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1
2830 <                                ReDim Preserve Tabretrait_mat(nb_retrait_mat)
2831 <                                Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swface, diametre)
2832 <                            End If
2829 >                                nb_retrait_mat = nb_retrait_mat + 1
2830 >                                ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1)
2831 >                                Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swface, diametre)
2832 >                                If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1)))
2833 >                                Eni = Math.Min(Eni, diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(0, 2, tmp), param(1)))) ' calcul du Eni minimal sur le domaine
2834 >                                End If
2835                          End If
2836                      Next cpt3
2837                  Else
# Line 2870 | Line 2856 | Module PoGCode
2856                                  MsgBox("Type de trou non reconnu")
2857                          End Select
2858                          If diametre > 0.000001 Then
2859 <                            If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1
2860 <                            ReDim Preserve Tabretrait_mat(nb_retrait_mat)
2861 <                            Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swfaceref, diametre)
2862 <
2859 >                            nb_retrait_mat = nb_retrait_mat + 1
2860 >                            ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1)
2861 >                            Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre)
2862 >                            If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1)))
2863 >                            Eni = Math.Min(Eni, diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(0, 2, tmp), param(1)))) ' calcul du Eni minimal sur le domaine
2864                          End If
2865                      Else
2866                          If swfeat.GetFaceCount = 1 And (swfeat.GetTypeName = "Cut" Or swfeat.GetTypeName = "RevCut") Then
# Line 2892 | Line 2879 | Module PoGCode
2879                                  diametre = params(7) * 2
2880                              End If
2881                              If diametre > 0.000001 Then
2882 <                                If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1
2883 <                                ReDim Preserve Tabretrait_mat(nb_retrait_mat)
2884 <                                Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swfaceref, diametre)
2882 >                                nb_retrait_mat = nb_retrait_mat + 1
2883 >                                ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1)
2884 >                                Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre)
2885 >                                If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1)))
2886 >                                Eni = Math.Min(Eni, diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(0, 2, tmp), param(1)))) ' calcul du Eni minimal sur le domaine
2887                              End If
2888                          End If
2889                      End If
# Line 2904 | Line 2893 | Module PoGCode
2893              swfaceref = swfaceref.GetNextFace
2894          Next cpt1
2895  
2896 <        If nb_retrait_mat > 0 Or Tabretrait_mat(0).diametre > 0 Then
2896 >        If nb_retrait_mat Then
2897 >            raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param)
2898 >            Eng_ref = Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1))) ' Calcul de En_reference à une distance de 1 fois le rayon de reference (fin de zone à gradients de contraintes perturbés)
2899              diametre = 0
2900 <            For cpt1 = 0 To nb_retrait_mat
2900 >            For cpt1 = 0 To nb_retrait_mat - 1
2901                  diametre = diametre + Tabretrait_mat(cpt1).diametre
2902              Next
2903 <            diametre = diametre / (nb_retrait_mat + 1)
2904 <            Eni_moy = 2 * Eni_moy / diametre  ' devient Eni moy reference
2905 <            raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, param)
2906 <            determination_precision_retrait_mat = Eni_moy * param(0) * Math.Pow(contrainte_vm_rm_ref(0, 2, tmp), param(1))
2907 <            MsgBox("Pré-optimisation de maillage des caractéristiques Retraits de matière avec une précision de " & 100 * determination_precision_retrait_mat & "%")
2903 >            diametre = diametre / nb_retrait_mat
2904 >
2905 >            Eng_moy = Eng_ref * diametre / 2
2906 >            determination_ecart_nodal_global_retraits_mat = Eng_moy
2907 >            coeffmin = Eni / Eng_moy
2908 >            'MsgBox("Pré-optimisation de maillage des caractéristiques Retraits de matière avec une écart nodal global de " & 1000 * Eng_moy & "mm")
2909          Else
2910 <            determination_precision_retrait_mat = 1
2910 >            determination_ecart_nodal_global_retraits_mat = 0
2911          End If
2912      End Function
2913  
2914 <    Function raffinement_retrait_matiere(ByRef Eng As Double, ByRef Erx As Double)
2914 >    Sub raffinement_retrait_matiere(ByRef Eng As Double, ByRef Erx As Double, Optional ByRef limitepente As Double = 0.25)
2915          Dim cpt As Integer
2916          Dim coeff As Double
2917          Dim lmbd As Double
# Line 2927 | Line 2919 | Module PoGCode
2919          Dim tmp() As Double
2920  
2921          For cpt = 0 To UBound(Tabretrait_mat)
2922 <            If raffinn_auto_retrait_mat(Erx, coeff, lmbd, courb, Eng, Tabretrait_mat(cpt).diametre / 2, tmp) Then ChangeTabFace(Tabretrait_mat(cpt).face, coeff, lmbd, courb)
2922 >            If raffinn_auto_retrait_mat(Erx, coeff, lmbd, courb, Eng, Tabretrait_mat(cpt).diametre / 2, limitepente, tmp) Then ChangeTabFace(Tabretrait_mat(cpt).face, coeff, lmbd, courb)
2923          Next
2924  
2925 <    End Function
2925 >    End Sub
2926  
2927   End Module
2928  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines