46 |
|
Dim grill As New grille |
47 |
|
Dim Bbox() As Double |
48 |
|
Dim path As String |
49 |
– |
Dim erx_rm As Double |
49 |
|
|
50 |
|
|
51 |
|
Dim CMDialogl As New Windows.Forms.SaveFileDialog |
74 |
|
initialisation() |
75 |
|
|
76 |
|
'initialistation de la grille |
77 |
< |
Dim Coeffmax As Double = Math.Max(Math.Max(Arrondis, matiere), Math.Max(rentrant, Entities)) |
78 |
< |
Dim taillecase As Double = Eng * (1 - Coeffmax) |
77 |
> |
Dim Coeffmin As Double = Math.Min(Math.Min(Arrondis, matiere), Math.Min(rentrant, Entities)) |
78 |
> |
Dim taillecase As Double = Eng * (1 - Coeffmin) |
79 |
|
Bbox = swbody.GetBodyBox |
80 |
|
' on initialise la grille 0.5 pourcent supérieur à la bounding box |
81 |
|
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)) |
86 |
|
End If |
87 |
|
' Si la case retrait matiere est cochée |
88 |
|
If matiereBool = True Then |
89 |
< |
erx_rm = determination_precision_retrait_mat(Eng, matiere) |
91 |
< |
raffinement_retrait_matiere(Eng, erx_rm) |
92 |
< |
'testretraitMatiere(Eng, erx_rm) |
89 |
> |
testretraitMatiere(matiere) |
90 |
|
End If |
91 |
|
' si la case rentrant est cochée |
92 |
|
If rentrantBool = True Then |
131 |
|
''' <remarks></remarks> |
132 |
|
Public Function DebutAutomatique(ByVal Erx As Double, ByVal LimPT As Double) As String |
133 |
|
|
134 |
< |
MsgBox("Erx = " & Erx & vbCr & "Limite = " & LimPT) |
134 |
> |
Dim vbody As Object |
135 |
> |
Dim grill As New grille |
136 |
> |
Dim Bbox() As Double |
137 |
> |
Dim path As String |
138 |
> |
Dim Eng As Double |
139 |
> |
Dim coef_min As Double |
140 |
> |
Erx = (100 - Erx) / 100 ' valeur d'erreur d'analyse exacte a priori |
141 |
> |
|
142 |
> |
|
143 |
> |
Dim CMDialogl As New Windows.Forms.SaveFileDialog |
144 |
> |
CMDialogl.DefaultExt = ".txt" |
145 |
> |
CMDialogl.Filter = "Fichiers PoG (*.txt)|*.txt|Tout fichiers(*.*)|*.*" |
146 |
> |
|
147 |
> |
CMDialogl.OverwritePrompt = True |
148 |
> |
CMDialogl.Title = "Sélectionnez le fichier pour enregistrer les points" |
149 |
> |
CMDialogl.ShowDialog() |
150 |
> |
path = CMDialogl.FileName |
151 |
> |
path = Txtpath(path) |
152 |
> |
If path Is Nothing Or path = "" Then MsgBox("Aucun fichier sélectionné, sortie du programme!", MsgBoxStyle.Critical, "Erreur!") : Return "" |
153 |
> |
|
154 |
> |
vBodies = swPart.GetBodies2(SwConst.swBodyType_e.swAllBodies, True) |
155 |
> |
For Each vbody In vBodies |
156 |
> |
cpt = 0 |
157 |
> |
Erase TabPoints |
158 |
> |
Erase Tabface |
159 |
> |
Erase TabFaceDouble |
160 |
> |
Erase TabEdge |
161 |
> |
Erase TabEdgeDouble |
162 |
> |
|
163 |
> |
swbody = vbody |
164 |
> |
BoiteEnglobante() |
165 |
> |
initialisation() |
166 |
> |
|
167 |
> |
'Calul de Eng |
168 |
> |
Eng = determination_ecart_nodal_global_retraits_mat(Erx, coef_min) |
169 |
> |
|
170 |
> |
|
171 |
> |
'initialistation de la grille |
172 |
> |
|
173 |
> |
Dim taillecase As Double = Eng * (1 - coef_min) |
174 |
> |
Bbox = swbody.GetBodyBox |
175 |
> |
' on initialise la grille 0.5 pourcent supérieur à la bounding box |
176 |
> |
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)) |
177 |
> |
|
178 |
> |
|
179 |
> |
raffinement_retrait_matiere(Eng, Erx, LimPT) |
180 |
> |
|
181 |
> |
|
182 |
> |
' on crée les points d'échantillonnage sur les sommets |
183 |
> |
CreerPointsVertex(Eng, grill) |
184 |
> |
' on crée les points d'échantillonnage sur les arêtes |
185 |
> |
CreerPointsEdge(Eng, grill) |
186 |
> |
' on crée les points d'échantillonnage sur les faces |
187 |
> |
CreerPointsFace(Eng, grill) |
188 |
> |
|
189 |
|
|
190 |
< |
Return Nothing |
190 |
> |
' on créée le fichier d'échantillonnage |
191 |
> |
fichiertxt(Eng, path) |
192 |
> |
swModel.ClearSelection2(True) |
193 |
> |
testPog(False, False, False, True, False) |
194 |
> |
Return path |
195 |
> |
Next vbody |
196 |
|
End Function |
197 |
|
|
198 |
|
Sub entitéselection(ByRef coeff As Double, ByRef Ind As Boolean) |
441 |
|
Next cpt1 |
442 |
|
|
443 |
|
End Sub |
444 |
< |
Sub testretraitMatiere(ByRef Eng As Double, ByRef erx As Double) |
444 |
> |
Sub testretraitMatiere(ByRef coeff As Double) |
445 |
|
|
446 |
|
Dim swface As SldWorks.Face2 |
447 |
|
Dim swsurface As SldWorks.Surface |
451 |
|
Dim cpt1 As Integer |
452 |
|
Dim cpt2 As Integer |
453 |
|
Dim swedge As SldWorks.Edge |
398 |
– |
Dim swedgetmp As SldWorks.Edge |
454 |
|
Dim vedge As Object |
455 |
|
Dim vface As Object |
456 |
|
Dim cpt3 As Integer |
402 |
– |
Dim cpt4 As Integer |
457 |
|
Dim i As Integer |
458 |
|
Dim swent As SldWorks.Entity |
459 |
|
Dim bRet As Boolean |
460 |
< |
Dim lmbd_rm As Integer |
461 |
< |
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 |
460 |
> |
Dim lmbd_rm As Double = 4 |
461 |
> |
Dim courb_rm As Double = 0 |
462 |
|
|
463 |
|
swfaceref = swbody.GetFirstFace |
464 |
+ |
|
465 |
|
For cpt1 = 0 To swbody.GetFaceCount - 1 |
425 |
– |
diametre = 0 |
466 |
|
swfeat = swfaceref.GetFeature |
467 |
|
swsurface = swfaceref.GetSurface |
468 |
|
swloop = swfaceref.GetFirstLoop |
469 |
|
For cpt2 = 0 To swfaceref.GetLoopCount - 1 |
430 |
– |
select_loop = 0 |
470 |
|
If swloop.IsOuter = False Then |
471 |
|
vedge = swloop.GetEdges |
472 |
|
For cpt3 = 0 To swloop.GetEdgeCount - 1 |
473 |
|
swedge = vedge(cpt3) |
474 |
|
vface = swedge.GetTwoAdjacentFaces |
475 |
< |
swface = vface(0) |
476 |
< |
If swface.IsSame(swfaceref) = True Then swface = vface(1) |
477 |
< |
angle = GetAngle(swedge, swfaceref, swface) |
478 |
< |
If angle < 179 Then |
479 |
< |
If (select_loop = 0) Then |
480 |
< |
|
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) |
475 |
> |
For i = 0 To 1 |
476 |
> |
swface = vface(i) |
477 |
> |
If swface.IsSame(swfaceref) = False Then |
478 |
> |
If GetAngle(swedge, swfaceref, swface) < 179 Then |
479 |
> |
ChangeTabFace(swface, coeff) |
480 |
> |
End If |
481 |
|
End If |
482 |
< |
End If |
482 |
> |
Next i |
483 |
|
Next cpt3 |
484 |
|
Else |
485 |
|
If swfeat.GetTypeName = "HoleWzd" Then |
486 |
< |
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 |
486 |
> |
ChangeTabFace(swfaceref, coeff) |
487 |
|
Else |
488 |
< |
If swfeat.GetFaceCount = 1 And (swfeat.GetTypeName = "Cut" Or swfeat.GetTypeName = "RevCut") Then |
489 |
< |
diametre = 0 |
490 |
< |
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) |
488 |
> |
If swfeat.GetFaceCount = 1 And swfeat.GetTypeName = "Cut" Then |
489 |
> |
If swsurface.Identity = 4002 Or swsurface.Identity = 4003 Or swsurface.Identity = 4005 Then |
490 |
> |
ChangeTabFace(swfaceref, coeff) |
491 |
|
End If |
492 |
|
End If |
493 |
|
End If |
496 |
|
Next cpt2 |
497 |
|
swfaceref = swfaceref.GetNextFace |
498 |
|
Next cpt1 |
499 |
+ |
|
500 |
|
End Sub |
501 |
|
Sub testAngleMatiere(ByRef coeff As Double) |
502 |
|
|
509 |
|
Dim cpt1 As Integer |
510 |
|
Dim Phi As Double |
511 |
|
Dim swcurve As SldWorks.Curve |
512 |
< |
Dim lmbd_am As Integer |
513 |
< |
Dim courb_am As Double |
514 |
< |
lmbd_am = 6 |
525 |
< |
courb_am = 2 |
512 |
> |
Dim lmbd_am As Double = 4 |
513 |
> |
Dim courb_am As Double = 0 |
514 |
> |
|
515 |
|
|
516 |
|
vedge = swbody.GetEdges |
517 |
|
' on test les arete et on prend celles qui sont des lignes |
1627 |
|
swedge = TabEdge(cpt2) |
1628 |
|
vEdgeU = swedge.GetCurveParams2 |
1629 |
|
longueur = GetEdgeLenght(swedge) |
1630 |
< |
pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2), 0.15) |
1630 |
> |
pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2), 0.5) |
1631 |
|
|
1632 |
|
nbpas = 3 * Math.Max(2, Math.Floor(longueur / pasmax - 0.0001) + 1) |
1633 |
|
pas = (vEdgeU(7) - vEdgeU(6)) / nbpas |
1713 |
|
vSurfParam = swsurf.Parameterization |
1714 |
|
|
1715 |
|
vUVlong = GetUVLong(swface) |
1716 |
< |
pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3), 0.15) |
1716 |
> |
pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3), 0.5) |
1717 |
|
|
1718 |
|
nbpasU = 3 * Math.Max(2, Math.Floor(vUVlong(0) / pasmax - 0.0001) + 1) |
1719 |
|
nbpasV = 3 * Math.Max(2, Math.Floor(vUVlong(1) / pasmax - 0.0001) + 1) |
2139 |
|
End Sub |
2140 |
|
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 |
2141 |
|
Dim rmax As Double |
2142 |
+ |
Dim nor As Double = 0.5 |
2143 |
+ |
Dim eni As Double = eng * coef |
2144 |
+ |
Dim enmax As Double = eng * coef * (1 + erreur) |
2145 |
|
|
2154 |
– |
If courbure <= 0 Then |
2155 |
– |
rmax = erreur |
2156 |
– |
End If |
2146 |
|
|
2147 |
< |
If courbure > 0 Then |
2148 |
< |
rmax = -0.05 * (Math.Sqrt(1 - 40 * courbure * erreur * (erreur - 1)) - 1) / ((erreur - 1) * courbure) |
2160 |
< |
End If |
2147 |
> |
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)) |
2148 |
> |
If (courbure <= 0.0001) Then rmax = (enmax - eni) / (nor * (eng - enmax) - eni + enmax) |
2149 |
|
|
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 |
2150 |
|
|
2151 |
|
Return 2 * rmax * lmbd * eng * (1 - coef) |
2152 |
|
|
2691 |
|
End If |
2692 |
|
direction_retrait_matiere = n |
2693 |
|
End Function |
2694 |
< |
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 |
2694 |
> |
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 |
2695 |
|
Dim delta_ref_theo As Double |
2696 |
|
Dim delta_ref_ptlimite As Double |
2697 |
|
Dim Eng_ref As Double |
2701 |
|
Dim A As Double = 0.12 |
2702 |
|
Dim B As Double = 0.68 |
2703 |
|
Dim param_rm() As Double |
2719 |
– |
Dim pentelimite As Double = 0.25 |
2704 |
|
|
2705 |
|
Dim x As Double |
2706 |
|
Dim pente As Double |
2759 |
|
ReDim param(4) |
2760 |
|
param(0) = A : param(1) = B : param(2) = C : param(3) = D |
2761 |
|
End Function |
2762 |
< |
Function determination_precision_retrait_mat(ByRef Eng As Double, ByRef coeff_rm As Double) As Double |
2762 |
> |
Function determination_ecart_nodal_global_retraits_mat(ByRef Erx_m As Double, ByRef coeffmin As Double) As Double |
2763 |
|
|
2764 |
|
Dim swface As SldWorks.Face2 |
2765 |
|
Dim swsurface As SldWorks.Surface |
2774 |
|
Dim vface As Object |
2775 |
|
Dim cpt3 As Integer |
2776 |
|
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 |
2777 |
|
Dim lg As Double |
2778 |
|
Dim lgi As Double |
2779 |
|
Dim angle As Double |
2780 |
|
Dim n(2) As Double |
2781 |
|
Dim area As Double |
2782 |
|
Dim select_loop As Integer |
2804 |
– |
Dim t As Double |
2783 |
|
Dim diametre As Double = 0 |
2784 |
|
Dim nb_retrait_mat As Integer = 0 |
2785 |
|
Dim param(1) As Double |
2786 |
< |
Dim Eni_moy As Double = Eng * coeff_rm |
2786 |
> |
Dim Eng_moy As Double = 0 |
2787 |
|
Dim tmp() As Double |
2788 |
+ |
Dim Eni As Double |
2789 |
|
|
2790 |
|
ReDim Preserve Tabretrait_mat(0) |
2791 |
|
Tabretrait_mat(0) = New retrait_mat(Nothing, 0) |
2821 |
|
select_loop = 1 |
2822 |
|
End If |
2823 |
|
If diametre > 0.000001 Then |
2824 |
< |
If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1 |
2825 |
< |
ReDim Preserve Tabretrait_mat(nb_retrait_mat) |
2826 |
< |
Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swface, diametre) |
2824 |
> |
nb_retrait_mat = nb_retrait_mat + 1 |
2825 |
> |
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2826 |
> |
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swface, diametre) |
2827 |
> |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2828 |
> |
Eng_moy = Eng_moy + diametre / 2 * 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) puis multiplication par le rayon de la caractéristique (extrapolation) |
2829 |
> |
If Eni = 0 Then Eni = Eng_moy |
2830 |
> |
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 |
2831 |
|
End If |
2832 |
|
End If |
2833 |
|
Next cpt3 |
2853 |
|
MsgBox("Type de trou non reconnu") |
2854 |
|
End Select |
2855 |
|
If diametre > 0.000001 Then |
2856 |
< |
If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1 |
2857 |
< |
ReDim Preserve Tabretrait_mat(nb_retrait_mat) |
2858 |
< |
Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swfaceref, diametre) |
2859 |
< |
|
2856 |
> |
nb_retrait_mat = nb_retrait_mat + 1 |
2857 |
> |
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2858 |
> |
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre) |
2859 |
> |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2860 |
> |
Eng_moy = Eng_moy + diametre / 2 * 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) puis multiplication par le rayon de la caractéristique (extrapolation) |
2861 |
> |
If Eni = 0 Then Eni = Eng_moy |
2862 |
> |
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 |
2863 |
|
End If |
2864 |
|
Else |
2865 |
|
If swfeat.GetFaceCount = 1 And (swfeat.GetTypeName = "Cut" Or swfeat.GetTypeName = "RevCut") Then |
2878 |
|
diametre = params(7) * 2 |
2879 |
|
End If |
2880 |
|
If diametre > 0.000001 Then |
2881 |
< |
If Tabretrait_mat(0).diametre > 0 Then nb_retrait_mat = nb_retrait_mat + 1 |
2882 |
< |
ReDim Preserve Tabretrait_mat(nb_retrait_mat) |
2883 |
< |
Tabretrait_mat(nb_retrait_mat) = New retrait_mat(swfaceref, diametre) |
2881 |
> |
nb_retrait_mat = nb_retrait_mat + 1 |
2882 |
> |
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2883 |
> |
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre) |
2884 |
> |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2885 |
> |
Eng_moy = Eng_moy + diametre / 2 * 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) puis multiplication par le rayon de la caractéristique (extrapolation) |
2886 |
> |
If Eni = 0 Then Eni = Eng_moy |
2887 |
> |
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 |
2888 |
|
End If |
2889 |
|
End If |
2890 |
|
End If |
2895 |
|
Next cpt1 |
2896 |
|
|
2897 |
|
If nb_retrait_mat > 0 Or Tabretrait_mat(0).diametre > 0 Then |
2898 |
< |
diametre = 0 |
2899 |
< |
For cpt1 = 0 To nb_retrait_mat |
2900 |
< |
diametre = diametre + Tabretrait_mat(cpt1).diametre |
2901 |
< |
Next |
2902 |
< |
diametre = diametre / (nb_retrait_mat + 1) |
2913 |
< |
Eni_moy = 2 * Eni_moy / diametre ' devient Eni moy reference |
2914 |
< |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, param) |
2915 |
< |
determination_precision_retrait_mat = Eni_moy * param(0) * Math.Pow(contrainte_vm_rm_ref(0, 2, tmp), param(1)) |
2916 |
< |
MsgBox("Pré-optimisation de maillage des caractéristiques Retraits de matière avec une précision de " & 100 * determination_precision_retrait_mat & "%") |
2898 |
> |
Eng_moy = Eng_moy / nb_retrait_mat |
2899 |
> |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2900 |
> |
determination_ecart_nodal_global_retraits_mat = Eng_moy |
2901 |
> |
coeffmin = Eni / Eng_moy |
2902 |
> |
'MsgBox("Pré-optimisation de maillage des caractéristiques Retraits de matière avec une écart nodal global de " & 1000 * Eng_moy & "mm") |
2903 |
|
Else |
2904 |
< |
determination_precision_retrait_mat = 1 |
2904 |
> |
determination_ecart_nodal_global_retraits_mat = 0 |
2905 |
|
End If |
2906 |
|
End Function |
2907 |
|
|
2908 |
< |
Function raffinement_retrait_matiere(ByRef Eng As Double, ByRef Erx As Double) |
2908 |
> |
Sub raffinement_retrait_matiere(ByRef Eng As Double, ByRef Erx As Double, Optional ByRef limitepente As Double = 0.25) |
2909 |
|
Dim cpt As Integer |
2910 |
|
Dim coeff As Double |
2911 |
|
Dim lmbd As Double |
2913 |
|
Dim tmp() As Double |
2914 |
|
|
2915 |
|
For cpt = 0 To UBound(Tabretrait_mat) |
2916 |
< |
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) |
2916 |
> |
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) |
2917 |
|
Next |
2918 |
|
|
2919 |
< |
End Function |
2919 |
> |
End Sub |
2920 |
|
|
2921 |
|
End Module |
2922 |
|
|