26 |
|
Public Sub New(ByRef coque1 As SlyFaceCoque, ByRef coque2 As SlyFaceCoque) |
27 |
|
sFaceCoque1 = coque1 |
28 |
|
sFaceCoque2 = coque2 |
29 |
+ |
|
30 |
+ |
If Commun.OptionMettreNoteIntersection = True Then |
31 |
+ |
Dim texte As String = "Intersection # " & Me.Numero & vbCr & "Coque - coque" |
32 |
+ |
Dim eface As New SuperFace(sFaceCoque1.SwFace) |
33 |
+ |
Dim xyz(2) As Double |
34 |
+ |
eface.Evaluer(0.5, 0.5, xyz(0), xyz(1), xyz(2)) |
35 |
+ |
Commun.CreerAnnotation(xyz(0), xyz(1), xyz(2), texte) |
36 |
+ |
eface = Nothing |
37 |
+ |
|
38 |
+ |
eface = New SuperFace(sFaceCoque2.SwFace) |
39 |
+ |
eface.Evaluer(0.5, 0.5, xyz(0), xyz(1), xyz(2)) |
40 |
+ |
Commun.CreerAnnotation(xyz(0), xyz(1), xyz(2), texte) |
41 |
+ |
End If |
42 |
|
End Sub |
43 |
|
|
44 |
|
|
50 |
|
''' <remarks></remarks> |
51 |
|
Public Sub DetermineType() |
52 |
|
|
53 |
< |
ADecouper1 = True |
41 |
< |
ADecouper2 = True |
42 |
< |
FaceAPlat1 = False |
43 |
< |
FaceAPlat2 = False |
53 |
> |
|
54 |
|
|
55 |
|
' si les faces reposent une sur l'autre, on doit leur faire un traitement particulier |
56 |
|
If Intersections.ComparerSurfaces(sFaceCoque1.SwFace.GetSurface, sFaceCoque2.SwFace.GetSurface) Then |
58 |
|
ADecouper2 = False |
59 |
|
FaceAPlat1 = True |
60 |
|
FaceAPlat2 = True |
61 |
+ |
Exit Sub |
62 |
|
End If |
63 |
|
|
64 |
+ |
|
65 |
+ |
'ADecouper1 = True ' les 2 coques doivent être coupées si on veut leur mettre des mini-poutres. |
66 |
+ |
'ADecouper2 = True |
67 |
+ |
'FaceAPlat1 = False |
68 |
+ |
'FaceAPlat2 = False |
69 |
+ |
Nb_segments_intersection() |
70 |
+ |
|
71 |
+ |
' si on a on a plus d'un segment alors on doit couper les 2 coques |
72 |
+ |
|
73 |
+ |
|
74 |
|
End Sub |
75 |
|
|
76 |
+ |
|
77 |
+ |
|
78 |
+ |
Private Sub Nb_segments_intersection() |
79 |
+ |
swModel.ClearSelection2(True) |
80 |
+ |
|
81 |
+ |
Me.sFaceCoque2.SelectionnerToutes(, False) |
82 |
+ |
Me.sFaceCoque1.SelectionnerToutes(, True) |
83 |
+ |
|
84 |
+ |
|
85 |
+ |
swModel.Sketch3DIntersections() |
86 |
+ |
swModel.ClearSelection2(True) |
87 |
+ |
swModel.Sketch3DIntersections() |
88 |
+ |
swModel.ClearSelection2(True) |
89 |
+ |
swModel.SketchManager.InsertSketch(True) |
90 |
+ |
|
91 |
+ |
Dim sketchFeat1 As sldworks.Feature = swModel.FeatureByPositionReverse(0) |
92 |
+ |
Dim swsketch1 As sldworks.Sketch = sketchFeat1.GetSpecificFeature2 |
93 |
+ |
|
94 |
+ |
|
95 |
+ |
Dim objsketch As Object = swsketch1.GetSketchSegments() |
96 |
+ |
'Dim sketchsegments() As sldworks.SketchSegment = objsketch |
97 |
+ |
Dim sketchsegments1() As sldworks.SketchSegment |
98 |
+ |
ReDim sketchsegments1(UBound(objsketch)) |
99 |
+ |
|
100 |
+ |
For i As Integer = 0 To UBound(objsketch) |
101 |
+ |
sketchsegments1(i) = objsketch(i) |
102 |
+ |
Next i |
103 |
+ |
|
104 |
+ |
|
105 |
+ |
Dim premier As Boolean = False |
106 |
+ |
Dim second As Boolean = False |
107 |
+ |
|
108 |
+ |
If UBound(sketchsegments1) > 0 Then |
109 |
+ |
ADecouper1 = True : ADecouper2 = True |
110 |
+ |
Exit Sub |
111 |
+ |
|
112 |
+ |
Else |
113 |
+ |
' si une arête de la coque touche l'autre coque à 2 sommets de la coque |
114 |
+ |
Dim swent As sldworks.Entity = swsketch1 : swent.Select2(False, 1) |
115 |
+ |
swModel.InsertCompositeCurve() |
116 |
+ |
|
117 |
+ |
Dim swFeat As sldworks.Feature = swModel.FeatureByPositionReverse(0) |
118 |
+ |
|
119 |
+ |
If swFeat.GetTypeName() = "CompositeCurve" Then |
120 |
+ |
|
121 |
+ |
Dim refcurve As sldworks.ReferenceCurve = swFeat.GetSpecificFeature2() |
122 |
+ |
Dim swEdge As sldworks.Edge = refcurve.GetFirstSegment() |
123 |
+ |
|
124 |
+ |
Dim e As New SuperArete(swEdge, True) |
125 |
+ |
Dim aretes1() As sldworks.Edge = Me.sFaceCoque1.GetAretes |
126 |
+ |
Dim aretes2() As sldworks.Edge = Me.sFaceCoque2.GetAretes |
127 |
+ |
|
128 |
+ |
For i As Integer = 0 To aretes1.GetUpperBound(0) |
129 |
+ |
If e.comparer(aretes1(i)) Then premier = True : Exit For |
130 |
+ |
Next |
131 |
+ |
|
132 |
+ |
For i As Integer = 0 To aretes2.GetUpperBound(0) |
133 |
+ |
If e.comparer(aretes2(i)) Then second = True : Exit For |
134 |
+ |
Next |
135 |
+ |
|
136 |
+ |
If premier Then ADecouper1 = False Else ADecouper1 = True |
137 |
+ |
If second Then ADecouper2 = False Else ADecouper2 = True |
138 |
+ |
If premier And second Then ADecouper1 = True : ADecouper2 = True |
139 |
+ |
|
140 |
+ |
|
141 |
+ |
End If |
142 |
+ |
|
143 |
+ |
' on efface la courbe |
144 |
+ |
swFeat.Select2(False, 0) |
145 |
+ |
Dim ext As sldworks.ModelDocExtension = swModel.Extension |
146 |
+ |
ext.DeleteSelection2(swconst.swDeleteSelectionOptions_e.swDelete_Children) |
147 |
+ |
|
148 |
+ |
End If |
149 |
+ |
|
150 |
+ |
|
151 |
+ |
End Sub |
152 |
+ |
|
153 |
+ |
|
154 |
+ |
|
155 |
+ |
|
156 |
+ |
|
157 |
|
''' <summary> |
158 |
|
''' Si vrai, alors on a une intersection de face à plat |
159 |
|
''' </summary> |
301 |
|
|
302 |
|
Dim swEnt As SldWorks.Entity |
303 |
|
|
202 |
– |
|
203 |
– |
|
304 |
|
' technique du sweep du cercle |
305 |
|
' 1 - trace de la ligne d'intersection |
306 |
|
' en théorie c'est déjà fait et on a interFF.sketch qui a le sketch d'intersection... |
312 |
|
Dim seg As SldWorks.SketchSegment |
313 |
|
Dim skPoint As SldWorks.SketchPoint = Nothing |
314 |
|
|
315 |
+ |
'MsgBox("Nombre de points dans le sketch " & sketch.GetSketchPointsCount2()) |
316 |
+ |
Dim nbpoints As Integer = sketch.GetSketchPointsCount2() ' étrangement, si on a pas ça ça plante!!! |
317 |
|
|
318 |
|
vSeg = sketch.GetSketchSegments() : seg = vSeg(0) |
319 |
|
|
373 |
|
swEnt = sketchCercle : swEnt.Select2(False, 1) |
374 |
|
swEnt = sketch : swEnt.Select2(True, 4) |
375 |
|
|
376 |
< |
feat = swFeatManager.InsertProtrusionSwept3(False, False, 0, False, False, 1, 1, False, 0, 0, 0, 0, merge, 1, 1, 0, 1) ' merge fait additionner le bnouveau corps... Pas certain du false qui suit. |
275 |
< |
|
376 |
> |
feat = swFeatManager.InsertProtrusionSwept3(False, False, 0, False, False, swTangencyType_e.swTangencyNone, swTangencyType_e.swTangencyNone, False, 0, 0, 0, 0, 0, 1, 1, 0, 1) |
377 |
|
If feat Is Nothing Then |
378 |
|
swEnt = sketchCercle : swEnt.Select2(False, 1) |
379 |
|
swEnt = sketch : swEnt.Select2(True, 4) |
380 |
< |
feat = swFeatManager.InsertProtrusionSwept3(False, False, 0, False, False, 0, 0, False, 0, 0, 0, 0, 0, 1, 1, 0, 1) |
380 |
> |
feat = swFeatManager.InsertProtrusionSwept3(False, False, 0, False, False, swTangencyType_e.swTangencyNone, swTangencyType_e.swTangencyNone, False, 0, 0, 0, 0, 0, 1, 1, 0, 1) |
381 |
|
End If |
382 |
|
|
383 |
|
If feat Is Nothing Then |
384 |
|
' il est possible que la coque soit une spline |
385 |
< |
MsgBox("Il est impossible de découper la forme de la courbe, la coque est trop repliée sur elle-même..." & vbCr & "Un rayon de courbure de la section de la coque est inférieur à l'épaisseur de la coque", MsgBoxStyle.Information, "Impossible de découper à un endroit!") |
385 |
> |
'MsgBox("Il est impossible de découper la forme de la courbe, la coque est trop repliée sur elle-même..." & vbCr & "Un rayon de courbure de la section de la coque est inférieur à l'épaisseur de la coque", MsgBoxStyle.Information, "Impossible de découper à un endroit!") |
386 |
> |
Err.Raise(600) |
387 |
|
' on pourrait éventuellement appliquer une autre méthode. |
388 |
|
Return Nothing |
389 |
|
End If |
436 |
|
PetitSketch = feat.GetSpecificFeature2() ' devrait être un sketch |
437 |
|
|
438 |
|
|
439 |
< |
' 2 - Couper la coque à partir su sweep |
439 |
> |
' 2 - Couper la coque à partir du sweep |
440 |
|
swModel.EditRebuild3() |
441 |
|
featmanager = swModel.FeatureManager |
442 |
< |
Dim faces() As SldWorks.Face2 = LaCoque.GetFaces ' les faces de la coque qui sont découpées |
443 |
< |
For Each swface2 In faces ' les faces de la coque |
442 |
> |
Dim faces() As sldworks.Face2 = LaCoque.GetFaces ' les faces de la coque qui sont découpées |
443 |
> |
Debug.Print(LaCoque.GetEpaisseur) |
444 |
> |
Debug.Print(sweep.Name) |
445 |
> |
|
446 |
> |
|
447 |
> |
'aller chercher le surface body et demander toutes les faces... |
448 |
> |
swface2 = faces(0) |
449 |
> |
Dim swbody As sldworks.Body2 = swface2.GetBody() |
450 |
> |
Debug.Print(swbody.GetFaceCount) |
451 |
> |
swface2 = swbody.GetFirstFace |
452 |
> |
While swface2 IsNot Nothing 'For Each swface2 In faces ' les faces de la coque |
453 |
> |
|
454 |
> |
feat = Nothing |
455 |
> |
Debug.Print(swface2.GetArea) |
456 |
|
If swModel.ClosestDistance(swface2, sweep, Nothing, Nothing) < Epsilon Then |
457 |
|
swModel.ClearSelection2(True) |
458 |
|
swFace = sweep.GetFirstFace() |
464 |
|
|
465 |
|
swent = swface2 : swent.Select2(True, 32) ' la face qui est coupée |
466 |
|
feat = featmanager.InsertSplitLineIntersect(7) |
467 |
< |
'If feat IsNot Nothing Then lstFeat.Add(feat) |
467 |
> |
' si on coupe bien une face, les pointeurs peuvent revenir à 0 et on peut ignorer une face... |
468 |
> |
If feat IsNot Nothing Then |
469 |
> |
' rajout des nouvelles faces à la coque |
470 |
> |
feat = swModel.FeatureByPositionReverse(0) |
471 |
> |
Dim vFaces As Object = feat.GetFaces() |
472 |
> |
For Each swFace In vFaces |
473 |
> |
LaCoque.AjouterFace(swFace) |
474 |
> |
Next |
475 |
> |
End If |
476 |
|
End If |
477 |
< |
Next |
478 |
< |
sweep.HideBody(True) |
477 |
> |
swface2 = swface2.GetNextFace() |
478 |
> |
End While |
479 |
|
|
358 |
– |
' rajout des nouvelles faces à la coque |
359 |
– |
feat = swModel.FeatureByPositionReverse(0) |
360 |
– |
Dim vFaces As Object = feat.GetFaces() |
361 |
– |
For Each swFace In vFaces |
362 |
– |
LaCoque.AjouterFace(swFace) |
363 |
– |
Next |
480 |
|
|
481 |
|
Next |
482 |
+ |
sweep.HideBody(True) |
483 |
|
End Sub |
484 |
|
|
485 |
|
|
502 |
|
Dim e As New SuperArete(swAreteVol, True) : e.Colorer(2, 0, 1, 0) |
503 |
|
For Each swAreteCoque As SldWorks.Edge In swAreteCoques |
504 |
|
If e.comparer(swAreteCoque) Then |
505 |
< |
sFace.MettreAttributFaceInterne(sFace.SwFace, , False) |
505 |
> |
sFace.MettreAttributFaceInterne(sFace.SwFace, CoqueCoupante.GetEpaisseur / 4, False) |
506 |
|
trouve = True : Exit For |
507 |
|
End If |
508 |
|
Next |