78 |
|
Next |
79 |
|
|
80 |
|
If nb3 > 0 Then 'CoupeCote(inter, poutre3) ' finalement on coupe sur les cotés |
81 |
+ |
' si on a un volme on ne vient plus ici |
82 |
|
lst_coupeCinter.Add(inter) |
83 |
|
lst_coupeCPoutre.Add(poutre3) |
84 |
|
End If |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
< |
' sub qui update les pointeurs après un split de la face. |
163 |
< |
Protected Function UpdateApresSplit(ByRef inter As InterPoutreVolume, ByRef poutre As SlyAretePoutre, ByRef x As Double, ByRef y As Double, ByRef z As Double, ByRef Plan As sldworks.RefPlane, Optional ByRef FI As Boolean = False) As sldworks.Face2 |
162 |
> |
|
163 |
> |
''' <summary> |
164 |
> |
''' Sub qui update les pointeurs après un split de la face. |
165 |
> |
''' </summary> |
166 |
> |
''' <param name="inter">La classe d'intersection</param> |
167 |
> |
''' <param name="poutre">La poutre</param> |
168 |
> |
''' <param name="x">Les coordonnées d'un point appartenant à la face Interne</param> |
169 |
> |
''' <param name="y"></param> |
170 |
> |
''' <param name="z"></param> |
171 |
> |
''' <param name="Plan"></param> |
172 |
> |
''' <param name="FI">Si vrai, on doit mettre un attribut de face iterne</param> |
173 |
> |
''' <returns>La face de plus</returns> |
174 |
> |
''' <remarks></remarks> |
175 |
> |
Protected Function UpdateApresSplit(ByRef inter As InterPoutreVolume, ByRef poutre As SlyAretePoutre, ByRef x As Double, ByRef y As Double, ByRef z As Double, ByRef Plan As sldworks.RefPlane, Optional ByRef FI As Boolean = False, Optional ByRef AjouterMini As Boolean = False) As sldworks.Face2 |
176 |
|
' le pointeur Me.swFace pointe soit sur une face, soit sur la face originale soit la face découpée |
164 |
– |
' cette procédure doit créer une nouvelle SlyFaceVOl |
177 |
|
' et tout ce que j'ai c'est un pointeur, et je sais même pas lequel. |
178 |
|
' la fonction ne créée pas de nouvelles slyEntités. |
179 |
|
' si le découpage donne 3 faces ou plus, elles sont placées dans lst_AutreFaces |
220 |
|
swSKSeg.Select4(False, Nothing) |
221 |
|
swent = Face : swent.Select4(True, Nothing) |
222 |
|
swFeat = swModel.InsertProjectedSketch2(0) ' 1 pour inverser la direction de la projection |
223 |
< |
If Not swFeat Is Nothing Then Exit For |
223 |
> |
If swFeat IsNot Nothing Then Exit For |
224 |
|
swFeat = swModel.InsertProjectedSketch2(1) ' 1 pour inverser la direction de la projection |
225 |
< |
If Not swFeat Is Nothing Then Exit For |
225 |
> |
If swFeat IsNot Nothing Then Exit For |
226 |
|
Next Face |
227 |
|
|
228 |
|
|
229 |
|
If swFeat Is Nothing Then |
230 |
|
' on passe à un autre type d'essai... |
231 |
+ |
Dim dist As Double |
232 |
+ |
For Each Face In Me.lst_Faces |
233 |
+ |
dist = swModel.ClosestDistance(Face, swSKSeg, Nothing, Nothing) |
234 |
+ |
If Math.Abs(dist) < Epsilon Then FaceInterne = Face : Exit For |
235 |
+ |
Next Face |
236 |
|
|
237 |
|
|
238 |
+ |
If FaceInterne Is Nothing Then MsgBox("N'a pas réussi à trouver la bonne face dans le UpdateAPrèsSplit") |
239 |
+ |
Return Nothing |
240 |
|
|
241 |
|
|
223 |
– |
MsgBox("N'a pas réussi à trouver la bonne face dans le UpdateAPrèsSplit") |
224 |
– |
Return Nothing |
242 |
|
Else |
243 |
|
FaceInterne = Face |
244 |
|
' effacer le feature... |
248 |
|
' ************************************************ |
249 |
|
' pour placer un attribut sur la face interne |
250 |
|
Dim attr As sldworks.Attribute |
234 |
– |
Dim p2 As sldworks.Parameter |
251 |
|
Dim no As Integer = 0 |
252 |
|
|
253 |
< |
If FI Or Flag = 20 Then |
254 |
< |
no = Me.MettreAttributFaceInterne(FaceInterne, poutre.SuggereGrosseurMaille, True) |
255 |
< |
'Dim nom2 As String = "FaceInterne" & no |
256 |
< |
'swent = FaceInterne |
257 |
< |
'attr = swent.FindAttribute(Intersections.DefAttrFaceInterne, 0) ' si l'attribut existe déjà on pointe dessus. |
258 |
< |
'If attr Is Nothing Then attr = Intersections.DefAttrFaceInterne.CreateInstance5(swModel, FaceInterne, nom2, 0, 2) ' 0 = swThisconfig |
259 |
< |
'While attr Is Nothing |
260 |
< |
' no += 1 |
261 |
< |
' nom2 = "FaceInterne" & CStr(no) |
262 |
< |
' attr = Intersections.DefAttrFaceInterne.CreateInstance5(swModel, FaceInterne, nom2, 0, 2) |
263 |
< |
'End While |
264 |
< |
'p2 = attr.GetParameter("FI") |
265 |
< |
'p2.SetDoubleValue(poutre.SuggereGrosseurMaille) |
266 |
< |
'GererDossiers("FaceInternes", nom2) |
251 |
< |
'no += 1 |
252 |
< |
ElseIf Flag = 2 Then ' on a un channel, on fait les 2 options |
253 |
< |
'Dim nom2 As String = "FaceInterne" & no |
254 |
< |
'swent = FaceInterne |
255 |
< |
'attr = swent.FindAttribute(Intersections.DefAttrFaceInterne, 0) ' si l'attribut existe déjà on pointe dessus. |
256 |
< |
'If attr Is Nothing Then attr = Intersections.DefAttrFaceInterne.CreateInstance5(swModel, FaceInterne, nom2, 0, 2) ' 0 = swThisconfig |
257 |
< |
'While attr Is Nothing |
258 |
< |
' no += 1 |
259 |
< |
' nom2 = "FaceInterne" & CStr(no) |
260 |
< |
' attr = Intersections.DefAttrFaceInterne.CreateInstance5(swModel, FaceInterne, nom2, 0, 2) |
261 |
< |
'End While |
262 |
< |
'p2 = attr.GetParameter("FI") |
263 |
< |
'p2.SetDoubleValue(poutre.SuggereGrosseurMaille) |
264 |
< |
'GererDossiers("FaceInternes", nom2) |
265 |
< |
'no += 1 |
266 |
< |
no = Me.MettreAttributFaceInterne(FaceInterne, poutre.SuggereGrosseurMaille, True) |
267 |
< |
MyBase.AjouterMiniPoutresSurFaceInterne(poutre, FaceInterne, inter.x, inter.y, inter.z) |
268 |
< |
Else |
269 |
< |
MyBase.AjouterMiniPoutresSurFaceInterne(poutre, FaceInterne, inter.x, inter.y, inter.z) |
270 |
< |
End If |
253 |
> |
If Flag = 20 Then MsgBox("Le flag = 20, voir ici...") |
254 |
> |
|
255 |
> |
If FI Then no = Me.MettreAttributFaceInterne(FaceInterne, poutre.SuggereGrosseurMaille, True) |
256 |
> |
If AjouterMini Then MyBase.AjouterMiniPoutresSurFaceInterne(poutre, FaceInterne, inter.x, inter.y, inter.z) |
257 |
> |
|
258 |
> |
|
259 |
> |
'If Flag = 2 Then ' on a un channel, on fait les 2 options |
260 |
> |
' no = Me.MettreAttributFaceInterne(FaceInterne, poutre.SuggereGrosseurMaille, True) |
261 |
> |
' MyBase.AjouterMiniPoutresSurFaceInterne(poutre, FaceInterne, inter.x, inter.y, inter.z) |
262 |
> |
'ElseIf FI Or Flag = 20 Then |
263 |
> |
' no = Me.MettreAttributFaceInterne(FaceInterne, poutre.SuggereGrosseurMaille, True) |
264 |
> |
'Else |
265 |
> |
' MyBase.AjouterMiniPoutresSurFaceInterne(poutre, FaceInterne, inter.x, inter.y, inter.z) |
266 |
> |
'End If |
267 |
|
|
268 |
|
' ************ l'attribut de la condition aux limites ******************* |
269 |
|
attr = Nothing |
326 |
|
Dim p(2) As Double |
327 |
|
Dim retour() As Double |
328 |
|
|
333 |
– |
'swModel.SetInferenceMode(False) ' ne pas mettre de contraintes par défaut |
334 |
– |
'swModel.SetAddToDB(True) |
335 |
– |
'swModel.SetDisplayWhenAdded(False) ' accélérer les performances |
336 |
– |
|
329 |
|
|
330 |
|
' l'idée est de sélectionner le point et l'arète puis d'utiliser CreatePlanePerCurveAndPassPoint3 |
331 |
|
Dim planReference As sldworks.RefPlane |
395 |
|
sens = Me.SwFace.FaceInSurfaceSense() |
396 |
|
|
397 |
|
' skx est la coordonnée du point de ref en coord de sketch, Rx est le point de référence dans le repère global. |
406 |
– |
Dim i As Integer, MettreFI As Boolean |
407 |
– |
Dim swFeat As sldworks.Feature |
398 |
|
|
399 |
< |
For i = 0 To 1 |
399 |
> |
Dim MettreFI As Boolean ' si vrai, on met un attribut de face interne |
400 |
> |
Dim swFeat As sldworks.Feature |
401 |
> |
Dim AutreSection As Boolean = True ' si vrai, on doit découper une autre face. |
402 |
> |
Dim i As Integer = 0 |
403 |
> |
Dim AjouterMiniPoutre As Boolean = False |
404 |
|
|
405 |
+ |
Do While AutreSection |
406 |
+ |
i += 1 |
407 |
|
swEnt = planReference |
408 |
|
swEnt.Select(False) |
409 |
|
swModel.InsertSketch2(False) |
416 |
|
p(0) = inter.x : p(1) = inter.y : p(2) = inter.z |
417 |
|
retour = Commun.TransfertModelSketch(swsketch, p) |
418 |
|
|
419 |
+ |
If SectionSimpleSurPoutre = True Then |
420 |
+ |
r = DessineSectionPoutreSimple(poutre, retour(0), retour(1), i, swsketch, CType(inter, InterAreteFace), MettreFI, AutreSection, AjouterMiniPoutre) |
421 |
+ |
Else |
422 |
+ |
r = DessineSectionPoutre(poutre, retour(0), retour(1), i, swsketch, CType(inter, InterAreteFace), MettreFI, AutreSection, AjouterMiniPoutre) |
423 |
+ |
End If |
424 |
|
|
424 |
– |
r = DessineSectionPoutre(poutre, retour(0), retour(1), i + 1, swsketch, inter, MettreFI) |
425 |
|
swModel.InsertSketch2(True) ' l'option true rebuild le modèle avec les modifications du sketch. |
426 |
|
swModel.ClearSelection2(True) |
427 |
|
|
437 |
|
Me.SwFace.DetachSurface() |
438 |
|
Me.SwFace.AttachSurface(LaSurface, sens) |
439 |
|
|
440 |
< |
Faces(i) = UpdateApresSplit(inter, poutre, r(0), r(1), r(2), planReference, MettreFI) |
441 |
< |
Commun.MettreUnPoint(r(0), r(1), r(2)) |
440 |
> |
Faces(i) = UpdateApresSplit(inter, poutre, r(0), r(1), r(2), planReference, MettreFI, AjouterMiniPoutre) |
441 |
> |
'Commun.MettreUnPoint(r(0), r(1), r(2)) |
442 |
|
|
443 |
|
If Faces(i) Is Nothing Then |
444 |
|
swEnt.Select(False) |
445 |
|
swModel.EditDelete() |
446 |
|
End If |
447 |
– |
If Flag = 2 Then Flag = 0 : Exit For |
447 |
|
|
448 |
< |
Next i |
448 |
> |
Loop |
449 |
> |
|
450 |
> |
|
451 |
> |
|
452 |
|
End Sub |
453 |
|
|
454 |
|
|