63 |
|
If path Is Nothing Or path = "" Then MsgBox("Aucun fichier sélectionné, sortie du programme!", MsgBoxStyle.Critical, "Erreur!") : Return "" |
64 |
|
|
65 |
|
'MsgBox("Début de la routine de pré-optimisation" & vbCr & vbCr & "l'écart nodal global est de : " & Eng & vbCr & "La zone de transition : " & NbCouches & vbCr & "Les arrondis sont à : " & Arrondis & vbCr & "Arretes rentrantes: " & rentrant & vbCr & "Les retraits matière: " & matiere & vbCr & vbCr & "Arrondi = " & ArrondiBool & vbCr & "Rentrant = " & rentrantBool & vbCr & "Matiere = " & matiereBool) |
66 |
< |
vBodies = swPart.GetBodies2(SwConst.swBodyType_e.swAllBodies, True) |
66 |
> |
vBodies = swPart.GetBodies2(swconst.swBodyType_e.swAllBodies, True) |
67 |
> |
|
68 |
> |
Erase TabPoints ' Sylvain : modifs si on veut plus d'un corps |
69 |
> |
Erase Tabface |
70 |
> |
Erase TabFaceDouble |
71 |
> |
Erase TabEdge |
72 |
> |
Erase TabEdgeDouble |
73 |
> |
cpt = 0 |
74 |
> |
BoiteEnglobante() ' Sylvain: Ajouté car je veut la boite totale, et non la boite de chaque volume |
75 |
> |
|
76 |
|
For Each vbody In vBodies |
77 |
< |
cpt = 0 |
78 |
< |
Erase TabPoints |
79 |
< |
Erase Tabface |
80 |
< |
Erase TabFaceDouble |
81 |
< |
Erase TabEdge |
82 |
< |
Erase TabEdgeDouble |
77 |
> |
'cpt = 0 |
78 |
> |
'Erase TabPoints |
79 |
> |
'Erase Tabface |
80 |
> |
'Erase TabFaceDouble |
81 |
> |
'Erase TabEdge |
82 |
> |
'Erase TabEdgeDouble |
83 |
|
|
84 |
|
swbody = vbody |
85 |
< |
BoiteEnglobante() |
85 |
> |
'BoiteEnglobante() ' Sylvain: Retiré car je veut la boite totale, et non la boite de chaque volume |
86 |
|
initialisation() |
87 |
|
|
88 |
|
'initialistation de la grille |
129 |
|
fichiertxt(Eng, path) |
130 |
|
swModel.ClearSelection2(True) |
131 |
|
testPog(False, False, False, True, False) |
132 |
< |
Return path |
132 |
> |
'Return path |
133 |
|
Next vbody |
134 |
< |
|
134 |
> |
Return path ' Sylvain : je crois que ça va à l'extérieur de la boucle... |
135 |
|
End Function |
136 |
|
|
137 |
|
''' <summary> |
147 |
|
Dim grill As New grille |
148 |
|
Dim Bbox() As Double |
149 |
|
Dim path As String |
150 |
< |
Dim Eng As Double |
150 |
> |
Dim Eng As Double = 0 |
151 |
|
Dim coef_min As Double |
152 |
|
Erx = (100 - Erx) / 100 ' valeur d'erreur d'analyse exacte a priori |
153 |
|
|
163 |
|
path = Txtpath(path) |
164 |
|
If path Is Nothing Or path = "" Then MsgBox("Aucun fichier sélectionné, sortie du programme!", MsgBoxStyle.Critical, "Erreur!") : Return "" |
165 |
|
|
166 |
< |
vBodies = swPart.GetBodies2(SwConst.swBodyType_e.swAllBodies, True) |
166 |
> |
vBodies = swPart.GetBodies2(swconst.swBodyType_e.swAllBodies, True) |
167 |
> |
|
168 |
> |
cpt = 0 ' Sylvain: Ajouté pour traiter plus d'un corps |
169 |
> |
Erase TabPoints |
170 |
> |
Erase Tabface |
171 |
> |
Erase TabFaceDouble |
172 |
> |
Erase TabEdge |
173 |
> |
Erase TabEdgeDouble |
174 |
> |
|
175 |
> |
BoiteEnglobante() ' Sylvain: Ajouté car je veut la boite totale, et non la boite de chaque volume |
176 |
|
For Each vbody In vBodies |
177 |
< |
cpt = 0 |
178 |
< |
Erase TabPoints |
179 |
< |
Erase Tabface |
180 |
< |
Erase TabFaceDouble |
181 |
< |
Erase TabEdge |
182 |
< |
Erase TabEdgeDouble |
177 |
> |
'cpt = 0 |
178 |
> |
'Erase TabPoints |
179 |
> |
'Erase Tabface |
180 |
> |
'Erase TabFaceDouble |
181 |
> |
'Erase TabEdge |
182 |
> |
'Erase TabEdgeDouble |
183 |
|
|
184 |
|
swbody = vbody |
185 |
< |
BoiteEnglobante() |
185 |
> |
'BoiteEnglobante() ' Sylvain: Retiré car je veut la boite totale, et non la boite de chaque volume |
186 |
|
initialisation() |
187 |
|
|
188 |
|
'Calul de Eng |
189 |
|
Eng = determination_ecart_nodal_global_retraits_mat(Erx, coef_min) |
190 |
< |
|
190 |
> |
If Eng = 0 Then Continue For |
191 |
|
|
192 |
|
'initialistation de la grille |
193 |
|
|
212 |
|
fichiertxt(Eng, path) |
213 |
|
swModel.ClearSelection2(True) |
214 |
|
testPog(False, False, False, True, False) |
215 |
< |
Return path |
215 |
> |
'Return path |
216 |
|
Next vbody |
217 |
+ |
Return path ' sylvain : Je crios aussi que ça vient à l'extérieur de la boucle |
218 |
|
End Function |
219 |
|
|
220 |
|
Sub entitéselection(ByRef coeff As Double, ByRef Ind As Boolean) |
1405 |
|
End If |
1406 |
|
Return path |
1407 |
|
End Function |
1408 |
+ |
|
1409 |
+ |
|
1410 |
|
Sub BoiteEnglobante() |
1411 |
|
' Ecrit la boite englobante dans le tableau de points |
1412 |
< |
Dim BodyBox() As Double |
1413 |
< |
Dim cpt1 As Integer |
1412 |
> |
Dim vBox As Object = swPart.GetPartBox(True) |
1413 |
> |
Dim box() As Double = vBox |
1414 |
|
|
1415 |
< |
BodyBox = swbody.GetBodyBox |
1416 |
< |
ReDim Preserve TabPoints(8, cpt) |
1415 |
> |
Dim centre(2) As Double ' le centre de la boite englobante |
1416 |
> |
Dim longueurs(2) As Double |
1417 |
|
|
1418 |
< |
For cpt1 = 0 To 5 |
1419 |
< |
TabPoints(cpt1, 0) = BodyBox(cpt1) |
1420 |
< |
Next cpt1 |
1418 |
> |
centre(0) = (box(3) + box(0)) / 2 |
1419 |
> |
centre(1) = (box(4) + box(1)) / 2 |
1420 |
> |
centre(2) = (box(5) + box(2)) / 2 |
1421 |
> |
|
1422 |
> |
longueurs(0) = (box(3) - box(0)) * 1.25 |
1423 |
> |
longueurs(1) = (box(4) - box(1)) * 1.25 |
1424 |
> |
longueurs(2) = (box(5) - box(2)) * 1.25 |
1425 |
> |
|
1426 |
> |
ReDim Preserve TabPoints(8, cpt) |
1427 |
> |
TabPoints(0, 0) = centre(0) - longueurs(0) / 2 |
1428 |
> |
TabPoints(1, 0) = centre(1) - longueurs(1) / 2 |
1429 |
> |
TabPoints(2, 0) = centre(2) - longueurs(2) / 2 |
1430 |
> |
TabPoints(3, 0) = centre(0) + longueurs(0) / 2 |
1431 |
> |
TabPoints(4, 0) = centre(1) + longueurs(1) / 2 |
1432 |
> |
TabPoints(5, 0) = centre(2) + longueurs(2) / 2 |
1433 |
> |
|
1434 |
> |
'Dim BodyBox() As Double |
1435 |
> |
'Dim cpt1 As Integer |
1436 |
> |
'BodyBox = swbody.GetBodyBox |
1437 |
> |
'ReDim Preserve TabPoints(8, cpt) |
1438 |
> |
|
1439 |
> |
'For cpt1 = 0 To 5 |
1440 |
> |
' TabPoints(cpt1, 0) = BodyBox(cpt1) |
1441 |
> |
'Next cpt1 |
1442 |
|
|
1443 |
|
End Sub |
1444 |
|
Sub initialisation() |
1672 |
|
swedge = TabEdge(cpt2) |
1673 |
|
vEdgeU = swedge.GetCurveParams2 |
1674 |
|
longueur = GetEdgeLenght(swedge) |
1675 |
< |
pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2), 0.5) |
1675 |
> |
pasmax = distance_entre_points(Eng, TabEdgeDouble(0, cpt2), TabEdgeDouble(1, cpt2), TabEdgeDouble(2, cpt2)) |
1676 |
|
|
1677 |
|
nbpas = 3 * Math.Max(2, Math.Floor(longueur / pasmax - 0.0001) + 1) |
1678 |
|
pas = (vEdgeU(7) - vEdgeU(6)) / nbpas |
1758 |
|
vSurfParam = swsurf.Parameterization |
1759 |
|
|
1760 |
|
vUVlong = GetUVLong(swface) |
1761 |
< |
pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3), 0.5) |
1761 |
> |
pasmax = distance_entre_points(Eng, TabFaceDouble(0, cpt3), TabFaceDouble(1, cpt3), TabFaceDouble(2, cpt3)) |
1762 |
|
|
1763 |
|
nbpasU = 3 * Math.Max(2, Math.Floor(vUVlong(0) / pasmax - 0.0001) + 1) |
1764 |
|
nbpasV = 3 * Math.Max(2, Math.Floor(vUVlong(1) / pasmax - 0.0001) + 1) |
2182 |
|
|
2183 |
|
|
2184 |
|
End Sub |
2185 |
< |
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 |
2185 |
> |
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 |
2186 |
|
Dim rmax As Double |
2187 |
|
Dim nor As Double = 0.5 |
2188 |
|
Dim eni As Double = eng * coef |
2829 |
|
Dim nb_retrait_mat As Integer = 0 |
2830 |
|
Dim param(1) As Double |
2831 |
|
Dim Eng_moy As Double = 0 |
2832 |
+ |
Dim Eng_ref As Double = 0 |
2833 |
|
Dim tmp() As Double |
2834 |
|
Dim Eni As Double |
2835 |
|
|
2836 |
|
ReDim Preserve Tabretrait_mat(0) |
2837 |
|
Tabretrait_mat(0) = New retrait_mat(Nothing, 0) |
2838 |
+ |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2839 |
|
|
2840 |
|
swfaceref = swbody.GetFirstFace |
2841 |
|
For cpt1 = 0 To swbody.GetFaceCount - 1 |
2871 |
|
nb_retrait_mat = nb_retrait_mat + 1 |
2872 |
|
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2873 |
|
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swface, diametre) |
2874 |
< |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2831 |
< |
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) |
2832 |
< |
If Eni = 0 Then Eni = Eng_moy |
2874 |
> |
If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1))) |
2875 |
|
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 |
2876 |
< |
End If |
2876 |
> |
End If |
2877 |
|
End If |
2878 |
|
Next cpt3 |
2879 |
|
Else |
2901 |
|
nb_retrait_mat = nb_retrait_mat + 1 |
2902 |
|
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2903 |
|
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre) |
2904 |
< |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2863 |
< |
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) |
2864 |
< |
If Eni = 0 Then Eni = Eng_moy |
2904 |
> |
If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1))) |
2905 |
|
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 |
2906 |
|
End If |
2907 |
|
Else |
2924 |
|
nb_retrait_mat = nb_retrait_mat + 1 |
2925 |
|
ReDim Preserve Tabretrait_mat(nb_retrait_mat - 1) |
2926 |
|
Tabretrait_mat(nb_retrait_mat - 1) = New retrait_mat(swfaceref, diametre) |
2927 |
< |
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2888 |
< |
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) |
2889 |
< |
If Eni = 0 Then Eni = Eng_moy |
2927 |
> |
If Eni = 0 Then Eni = diametre / 2 * Erx_m / (param(0) * Math.Pow(contrainte_vm_rm_ref(1, 2, tmp), param(1))) |
2928 |
|
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 |
2929 |
|
End If |
2930 |
|
End If |
2935 |
|
swfaceref = swfaceref.GetNextFace |
2936 |
|
Next cpt1 |
2937 |
|
|
2938 |
< |
If nb_retrait_mat > 0 Or Tabretrait_mat(0).diametre > 0 Then |
2901 |
< |
Eng_moy = Eng_moy / nb_retrait_mat |
2938 |
> |
If nb_retrait_mat Then |
2939 |
|
raffinn_auto_retrait_mat(0, 0, 0, 0, 0, 0, 0, param) |
2940 |
+ |
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) |
2941 |
+ |
diametre = 0 |
2942 |
+ |
For cpt1 = 0 To nb_retrait_mat - 1 |
2943 |
+ |
diametre = diametre + Tabretrait_mat(cpt1).diametre |
2944 |
+ |
Next |
2945 |
+ |
diametre = diametre / nb_retrait_mat |
2946 |
+ |
|
2947 |
+ |
Eng_moy = Eng_ref * diametre / 2 |
2948 |
|
determination_ecart_nodal_global_retraits_mat = Eng_moy |
2949 |
|
coeffmin = Eni / Eng_moy |
2950 |
|
'MsgBox("Pré-optimisation de maillage des caractéristiques Retraits de matière avec une écart nodal global de " & 1000 * Eng_moy & "mm") |