9 |
|
Public DefAttrRCCoque As SldWorks.AttributeDef |
10 |
|
Public DefAttrFaceInterne As SldWorks.AttributeDef |
11 |
|
Public DefAttrDoublon As SldWorks.AttributeDef |
12 |
< |
Public DefAttrIgnorer As SldWorks.AttributeDef |
12 |
> |
Public DefAttrIgnorer As sldworks.AttributeDef |
13 |
|
|
14 |
|
Public nbMinipoutre As Long |
15 |
|
|
17 |
|
|
18 |
|
Public MettreMiniPoutresSurFaceInternes As Boolean |
19 |
|
Public MultiDecoupageCoques As Boolean = False |
20 |
+ |
Public SectionSimpleSurPoutre As Boolean |
21 |
|
|
22 |
|
#Region "Enums" |
23 |
|
Public Enum typeInterPoutreVolume |
43 |
|
' fin des options de performance |
44 |
|
' ****** |
45 |
|
|
46 |
+ |
|
47 |
+ |
|
48 |
|
Memoriser3iemePoint() ' mémorise le coord system car si on découpe, sa coordonnée est perdue. |
49 |
|
|
50 |
|
CouperPoutres() |
51 |
|
Commun.GenererListes() ' va ignorer les poutres à ignorer... et ajouter les poutres coupées dans la liste. |
52 |
|
|
53 |
+ |
lst_InterCoqueCoque.Clear() |
54 |
+ |
DetectionCoqueCoque() |
55 |
+ |
DetectionPoutresVolumes() ' doit être avant interpoutreCoque au cas où on aurait une poutre de section |
56 |
+ |
DetectionPoutresCoques() |
57 |
+ |
DetectionCoqueVolume() |
58 |
+ |
|
59 |
|
|
60 |
|
|
52 |
– |
' Traitement des intersection poutres-Volumes |
53 |
– |
DetectionPoutresVolumes() ' doit être avant interpoutreCoque au cas où on aurait une poutre de section |
54 |
– |
DecouperPoutreVolume() |
55 |
– |
' fin traitement intersection poutres-volumes |
61 |
|
|
57 |
– |
swModel.EditRebuild3() |
62 |
|
|
63 |
|
|
64 |
+ |
' Traitement des intersection poutres-Volumes |
65 |
+ |
DecouperPoutreVolume() |
66 |
+ |
swModel.EditRebuild3() |
67 |
|
|
68 |
|
' Traitement des intersection entre poutre et coques |
62 |
– |
DetectionPoutresCoques() |
69 |
|
DecouperPoutreCoque() |
70 |
< |
' Fin du traitement des intersections entre poutre et coques |
65 |
< |
|
70 |
> |
swModel.EditRebuild3() |
71 |
|
|
72 |
|
' traitement des coques-volumes |
68 |
– |
DetectionCoqueVolume() |
73 |
|
DécouperCoqueVolume() |
74 |
< |
' fin traitement coque volume |
74 |
> |
swModel.EditRebuild3() |
75 |
|
|
76 |
|
' traitement des coques-coques |
73 |
– |
DetectionCoqueCoque() |
77 |
|
DecouperCoqueCoque() |
78 |
< |
' |
78 |
> |
swModel.EditRebuild3() |
79 |
> |
|
80 |
|
|
81 |
|
|
82 |
|
|
106 |
|
|
107 |
|
For Each interCC As InterCoqueCoque In lst_InterCoqueCoque |
108 |
|
'rayon = IIf(Coque Is interCC.sFaceCoque1, interCC.sFaceCoque2.GetEpaisseur, interCC.sFaceCoque1.GetEpaisseur) |
109 |
+ |
'MsgBox("Traitement de l'intersection de coque - coque # " & interCC.Numero) |
110 |
+ |
|
111 |
+ |
Try |
112 |
+ |
If interCC.DoitCouperCoque1 Then |
113 |
+ |
rayon = interCC.sFaceCoque2.GetEpaisseur / 2 |
114 |
+ |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
115 |
+ |
interCC.DecouperCoque(interCC.sFaceCoque1, sweep) |
116 |
+ |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque2, interCC.sFaceCoque1) |
117 |
+ |
End If |
118 |
+ |
|
119 |
+ |
If interCC.DoitCouperCoque2 Then |
120 |
+ |
rayon = interCC.sFaceCoque1.GetEpaisseur / 2 |
121 |
+ |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
122 |
+ |
interCC.DecouperCoque(interCC.sFaceCoque2, sweep) |
123 |
+ |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque1, interCC.sFaceCoque2) |
124 |
+ |
End If |
125 |
+ |
Catch |
126 |
+ |
If interCC.DoitCouperCoque2 Then |
127 |
+ |
rayon = interCC.sFaceCoque1.GetEpaisseur / 2 |
128 |
+ |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
129 |
+ |
interCC.DecouperCoque(interCC.sFaceCoque2, sweep) |
130 |
+ |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque1, interCC.sFaceCoque2) |
131 |
+ |
End If |
132 |
+ |
|
133 |
+ |
If interCC.DoitCouperCoque1 Then |
134 |
+ |
rayon = interCC.sFaceCoque2.GetEpaisseur / 2 |
135 |
+ |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
136 |
+ |
interCC.DecouperCoque(interCC.sFaceCoque1, sweep) |
137 |
+ |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque2, interCC.sFaceCoque1) |
138 |
+ |
End If |
139 |
+ |
|
140 |
+ |
|
141 |
+ |
End Try |
142 |
+ |
|
143 |
+ |
|
144 |
|
|
106 |
– |
If interCC.DoitCouperCoque1 Then |
107 |
– |
rayon = interCC.sFaceCoque2.GetEpaisseur / 2 |
108 |
– |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
109 |
– |
interCC.DecouperCoque(interCC.sFaceCoque1, sweep) |
110 |
– |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque2, interCC.sFaceCoque1) |
111 |
– |
End If |
145 |
|
|
113 |
– |
If interCC.DoitCouperCoque2 Then |
114 |
– |
rayon = interCC.sFaceCoque1.GetEpaisseur / 2 |
115 |
– |
Dim sweep As sldworks.Body2 = interCC.GénérerSweep(interCC.sketch, rayon) |
116 |
– |
interCC.DecouperCoque(interCC.sFaceCoque2, sweep) |
117 |
– |
If Intersections.MettreMiniPoutresSurFaceInternes Then interCC.MarquerFacesInternes(interCC.sFaceCoque1, interCC.sFaceCoque2) |
118 |
– |
End If |
146 |
|
|
147 |
|
If interCC.FaceAPlat Then |
148 |
|
interCC.CoupeAPlat() |
198 |
|
interCC.determineType() |
199 |
|
lst_InterCoqueCoque.Add(interCC) |
200 |
|
|
201 |
+ |
|
202 |
|
'Coque1.lst_InterCoqueCoque.Add(interCC) |
203 |
|
'Coque2.lst_InterCoqueCoque.Add(interCC) |
204 |
|
End If |
314 |
|
retval = DefAttrIgnorer.Register() |
315 |
|
If retval = False Then MsgBox("Enregistrement raté pour le Ignorer") |
316 |
|
|
317 |
+ |
|
318 |
|
nouveau = True |
319 |
|
|
320 |
|
End Sub |
614 |
|
End If |
615 |
|
|
616 |
|
If sPoutre.Evaluer(T2, PointTest) Then |
617 |
< |
effacer = Distance(sCoque.lst_Faces.Item(1), PointTest(0), PointTest(1), PointTest(2)) |
618 |
< |
If Distance(sCoque.lst_Faces.Item(1), PointTest(0), PointTest(1), PointTest(2)) < Epsilon Then |
617 |
> |
effacer = Distance(sCoque.lst_Faces.Item(0), PointTest(0), PointTest(1), PointTest(2)) |
618 |
> |
If Distance(sCoque.lst_Faces.Item(0), PointTest(0), PointTest(1), PointTest(2)) < Epsilon Then |
619 |
|
If Not premier2 Then tipe = 2 : premier2 = True Else tipe = 22 |
620 |
|
End If |
621 |
|
End If |
699 |
|
''' <remarks></remarks> |
700 |
|
Private Sub DecouperPoutreVolume() |
701 |
|
' #2 on procède au découpage de la face |
702 |
< |
Dim sVol As SlyFaceVolume |
702 |
> |
Dim sFaceVol As SlyFaceVolume |
703 |
|
|
704 |
< |
For Each sVol In lst_FaceVolume |
705 |
< |
If sVol.lst_InterPoutre.Count > 0 Then |
706 |
< |
sVol.decouper() |
704 |
> |
For Each sFaceVol In lst_FaceVolume |
705 |
> |
If sFaceVol.lst_InterPoutre.Count > 0 Then |
706 |
> |
sFaceVol.decouper() |
707 |
|
|
708 |
|
' on met-a-jour l'attribut des conditions aux limites |
709 |
< |
Dim attr As SldWorks.Attribute |
710 |
< |
Dim swent As SldWorks.Entity |
709 |
> |
Dim attr As sldworks.Attribute |
710 |
> |
Dim swent As sldworks.Entity |
711 |
|
Dim nom3 As String = Nothing |
712 |
< |
Dim p As SldWorks.Parameter |
713 |
< |
If Not sVol.AttributCL Is Nothing Then |
714 |
< |
nom3 = "CL_" & sVol.nom |
715 |
< |
swent = sVol.SwFace |
712 |
> |
Dim p As sldworks.Parameter |
713 |
> |
If Not sFaceVol.AttributCL Is Nothing Then |
714 |
> |
nom3 = "CL_" & sFaceVol.nom |
715 |
> |
swent = sFaceVol.SwFace |
716 |
|
attr = swent.FindAttribute(Intersections.DefAttrConditionLimite, 0) ' si l'attribut existe déjà on pointe dessus. |
717 |
|
|
718 |
< |
If attr Is Nothing Then attr = Intersections.DefAttrConditionLimite.CreateInstance5(swModel, sVol.SwFace, nom3, 0, 0) |
718 |
> |
If attr Is Nothing Then attr = Intersections.DefAttrConditionLimite.CreateInstance5(swModel, sFaceVol.SwFace, nom3, 0, 0) |
719 |
|
p = attr.GetParameter("CL") |
720 |
< |
p.SetStringValue(sVol.condition) |
720 |
> |
p.SetStringValue(sFaceVol.condition) |
721 |
|
|
722 |
|
End If |
723 |
|
GererDossiers("Conditions Aux Limites", nom3) |
1750 |
|
|
1751 |
|
End If |
1752 |
|
|
1724 |
– |
' tagger la vieille poutre pour ne pas la reprendre dans magic |
1725 |
– |
'Pour ça on ajoute un attribut pour ignorer... |
1726 |
– |
Dim nom As String |
1727 |
– |
Dim no As Integer |
1728 |
– |
Dim arete As sldworks.Edge |
1729 |
– |
|
1730 |
– |
arete = SlyArete1.swArete |
1731 |
– |
swEnt = arete |
1732 |
– |
nom = "Ignorer" & SlyArete1.nom & "_" & CStr(no) |
1733 |
– |
attr = swEnt.FindAttribute(Intersections.DefAttrRCP1, 0) |
1734 |
– |
'attr = DefAttrRCP1.CreateInstance5(swModel, arete, nom, 0, 2) ' une deuxième instance du RCPoutre... |
1735 |
– |
If attr Is Nothing Then |
1736 |
– |
Commun.ColorerAretes() |
1737 |
– |
swEnt = SlyArete1.swArete |
1738 |
– |
attr = swEnt.FindAttribute(Intersections.DefAttrRCP1, 0) |
1739 |
– |
End If |
1753 |
|
|
1754 |
< |
Dim p As sldworks.Parameter |
1755 |
< |
p = attr.GetParameter("D1") |
1756 |
< |
p.SetDoubleValue(-9) |
1757 |
< |
p = attr.GetParameter("D2") |
1758 |
< |
p.SetDoubleValue(-9) |
1759 |
< |
p = attr.GetParameter("D3") |
1760 |
< |
p.SetDoubleValue(-9) |
1761 |
< |
p = attr.GetParameter("D4") |
1762 |
< |
p.SetDoubleValue(-9) |
1754 |
> |
' on met un attribut pour ignorer l'arète. Les sommets devraient donc aussi être ignorés. |
1755 |
> |
|
1756 |
> |
SlyArete1.MettreAttributIgnorer() |
1757 |
> |
|
1758 |
> |
'Dim nom As String |
1759 |
> |
'Dim no As Integer |
1760 |
> |
'Dim arete As sldworks.Edge |
1761 |
> |
'arete = SlyArete1.swArete |
1762 |
> |
'swEnt = arete |
1763 |
> |
'nom = "Ignorer" & SlyArete1.nom & "_" & CStr(no) |
1764 |
> |
'attr = swEnt.FindAttribute(Intersections.DefAttrRCP1, 0) |
1765 |
> |
''attr = DefAttrRCP1.CreateInstance5(swModel, arete, nom, 0, 2) ' une deuxième instance du RCPoutre... |
1766 |
> |
'If attr Is Nothing Then |
1767 |
> |
' Commun.ColorerAretes() |
1768 |
> |
' swEnt = SlyArete1.swArete |
1769 |
> |
' attr = swEnt.FindAttribute(Intersections.DefAttrRCP1, 0) |
1770 |
> |
'End If |
1771 |
> |
|
1772 |
> |
'Dim p As sldworks.Parameter |
1773 |
> |
'p = attr.GetParameter("D1") |
1774 |
> |
'p.SetDoubleValue(-9) |
1775 |
> |
'p = attr.GetParameter("D2") |
1776 |
> |
'p.SetDoubleValue(-9) |
1777 |
> |
'p = attr.GetParameter("D3") |
1778 |
> |
'p.SetDoubleValue(-9) |
1779 |
> |
'p = attr.GetParameter("D4") |
1780 |
> |
'p.SetDoubleValue(-9) |
1781 |
|
|
1782 |
< |
If attr Is Nothing Then MsgBox("Pas marché") |
1782 |
> |
'If attr Is Nothing Then MsgBox("Pas marché") |
1783 |
|
|
1784 |
|
|
1785 |
|
End If |
2038 |
|
''' </summary> |
2039 |
|
''' <remarks></remarks> |
2040 |
|
Private Sub DécouperCoqueVolume() |
2041 |
< |
|
2041 |
> |
Static vc As Integer |
2042 |
|
' Algo: |
2043 |
|
' Pour chaque coque |
2044 |
|
' Si on doit couper la coque, alors on la coupe |
2067 |
|
CoupeCoque1(interFF) |
2068 |
|
If Not Intersections.MultiDecoupageCoques Then interFF.MarquerFacesInternes() |
2069 |
|
Else |
2070 |
+ |
interFF.DécouperVolume() |
2071 |
+ |
' s'il y a plus d'une arête sur la coque qui touche au volume alors on doit découper la coque aussi |
2072 |
+ |
' on sélectionne les 2 entités, puis on fait le sketch d'intersection et on évalue le nombre de courbes. |
2073 |
+ |
Dim swBod1 As sldworks.Body2 = interFF.sFaceVolume.SwFace.GetBody() : swBod1.Select2(False, Nothing) |
2074 |
+ |
Dim swBod2 As sldworks.Body2 = interFF.sFaceCoque.SwFace.GetBody() : swBod2.Select2(True, Nothing) |
2075 |
+ |
|
2076 |
+ |
swModel.Sketch3DIntersections() |
2077 |
+ |
Dim sketch As sldworks.Sketch = swModel.GetActiveSketch2 |
2078 |
+ |
swModel.InsertSketch2(True) |
2079 |
+ |
Dim swfeatS As sldworks.Feature = swModel.FeatureByPositionReverse(0) |
2080 |
+ |
swfeatS.Name = "Vérif_decoupage_coque#" & vc : vc += 1 |
2081 |
|
|
2082 |
< |
If interFF.DoitCouperCoque Then |
2082 |
> |
If UBound(sketch.GetSketchSegments) > 1 Then |
2083 |
|
interFF.DecouperCoque() |
2084 |
|
interFF.QuelleAreteCoqueToucheVolume() |
2085 |
|
End If |
2086 |
< |
interFF.DécouperVolume() |
2086 |
> |
|
2087 |
|
If Not Intersections.MultiDecoupageCoques Then interFF.MarquerFacesInternes() ' étape 6 |
2088 |
|
|
2089 |
|
End If |
2285 |
|
Try |
2286 |
|
curve = curveArray(0) |
2287 |
|
Catch |
2288 |
< |
|
2288 |
> |
Return False 'GoTo Fairesketch 'ne va pas toujours marcher, mais je n'ai rien de mieu pour l'instant... |
2289 |
|
'MsgBox("On a une intersection où 2 faces sont sur la même surface...") ' en théorie... |
2290 |
< |
Return True ' ouch... pas certain. |
2290 |
> |
' ouch... pas certain. |
2291 |
|
End Try |
2292 |
|
|
2293 |
|
|
2307 |
|
If ((Distance(face1, Point1(0), Point1(1), Point1(2)) < (1000 * Epsilon)) AndAlso (Distance(face2, Point1(0), Point1(1), Point1(2)) < (1000 * Epsilon))) OrElse ((Distance(face1, Point2(0), Point2(1), Point2(2)) < (Epsilon * 1000)) AndAlso (Distance(face2, Point2(0), Point2(1), Point2(2)) < (1000 * Epsilon))) Then |
2308 |
|
' return true |
2309 |
|
Else |
2310 |
+ |
|
2311 |
|
Dim swent2 As sldworks.Entity |
2312 |
|
Dim feat2 As sldworks.Feature |
2313 |
|
swModel.Insert3DSketch2(False) |
2314 |
|
swModel.ClearSelection2(True) |
2315 |
< |
swent2 = face1 : swent2.Select2(False, 0) |
2316 |
< |
swent2 = face2 : swent2.Select2(True, 0) |
2315 |
> |
'swent2 = face1 : swent2.Select2(False, 0) |
2316 |
> |
'swent2 = face2 : swent2.Select2(True, 0) |
2317 |
> |
Dim swBod1 As sldworks.Body2 = face1.GetBody : swBod1.Select2(False, Nothing) |
2318 |
> |
Dim swBod2 As sldworks.Body2 = face2.GetBody : swBod2.Select2(True, Nothing) |
2319 |
> |
|
2320 |
|
swModel.Sketch3DIntersections() |
2321 |
|
|
2322 |
|
swModel.Insert3DSketch2(False) |
2323 |
|
swModel.EditRebuild3() |
2324 |
|
feat2 = swModel.FeatureByPositionReverse(0) |
2325 |
|
|
2326 |
+ |
Debug.Print(feat2.Name) |
2327 |
+ |
|
2328 |
|
Sketch = feat2.GetSpecificFeature2 |
2329 |
|
feat2.Name = "TouchePas" & CStr(Rnd()) |
2330 |
+ |
'MsgBox(face1.GetArea) |
2331 |
|
Dim vSeg2 As Object = Sketch.GetSketchSegments() |
2332 |
|
If vSeg2 Is Nothing Then |
2333 |
|
swent2 = feat2 |
2335 |
|
swModel.EditDelete() |
2336 |
|
Return False |
2337 |
|
Else |
2338 |
+ |
If Math.Abs(bounds(0)) > 490 Then Return False ' se touchent à l'infini... |
2339 |
|
Return True |
2340 |
|
End If |
2341 |
+ |
|
2342 |
|
End If |
2343 |
|
End If |
2344 |
|
|
2345 |
+ |
Fairesketch: |
2346 |
|
Dim swent As sldworks.Entity |
2347 |
|
Dim feat As sldworks.Feature |
2348 |
|
swModel.Insert3DSketch2(False) |
2349 |
|
swModel.ClearSelection2(True) |
2350 |
< |
swent = face1 : swent.Select2(False, 0) |
2351 |
< |
swent = face2 : swent.Select2(True, 0) |
2350 |
> |
'swent = face1 : swent.Select2(False, 0) |
2351 |
> |
'swent = face2 : swent.Select2(True, 0) |
2352 |
> |
Dim swBod1a As sldworks.Body2 = face1.GetBody : swBod1a.Select2(False, Nothing) |
2353 |
> |
Dim swBod2a As sldworks.Body2 = face2.GetBody : swBod2a.Select2(True, Nothing) |
2354 |
> |
|
2355 |
|
swModel.Sketch3DIntersections() |
2356 |
|
|
2357 |
|
swModel.Insert3DSketch2(False) |
2358 |
|
swModel.EditRebuild3() |
2359 |
|
feat = swModel.FeatureByPositionReverse(0) |
2360 |
< |
|
2360 |
> |
Debug.Print(feat.Name) |
2361 |
|
Sketch = feat.GetSpecificFeature2 |
2362 |
|
Dim vSeg As Object = Sketch.GetSketchSegments() |
2363 |
|
If vSeg Is Nothing Then |
2505 |
|
sFace.MettrePointSurPOG(fichier) |
2506 |
|
Next |
2507 |
|
|
2508 |
< |
|
2508 |
> |
For Each sFace As SlyFaceCoque In Commun.lst_FaceCoque |
2509 |
> |
sFace.MettrePointSurPOG(fichier) |
2510 |
> |
Next |
2511 |
|
|
2512 |
|
' *** Fin |
2513 |
|
fichier.Close() |
2581 |
|
Return True |
2582 |
|
Else |
2583 |
|
' faut quand même évaluer si on a la bonne chose... |
2584 |
< |
Dim obj As Object = swSurf1.GetClosestPointOn(0, 0, 0) ' x, y , z, U, V |
2584 |
> |
Try |
2585 |
> |
Dim pt As Object = swSurf1.Evaluate(0.5, 0.5, 0, 0) |
2586 |
> |
Dim obj As Object = swSurf1.GetClosestPointOn(pt(0), pt(1), pt(2)) ' x, y , z, U, V |
2587 |
> |
Dim obj1 As Object = swSurf1.EvaluateAtPoint(obj(0), obj(1), obj(2)) |
2588 |
|
|
2589 |
< |
Dim obj1 As Object = swSurf1.EvaluateAtPoint(obj(0), obj(1), obj(2)) |
2590 |
< |
Dim obj2 As Object = swSurf1.EvaluateAtPoint(obj(0), obj(1), obj(2)) |
2589 |
> |
Dim objb As Object = swSurf2.GetClosestPointOn(pt(0), pt(1), pt(2)) ' x, y , z, U, V |
2590 |
> |
Dim obj2 As Object = swSurf2.EvaluateAtPoint(objb(0), objb(1), objb(2)) |
2591 |
|
|
2592 |
< |
If Math.Abs(obj1(9) - obj2(9)) < Epsilon And Math.Abs(obj1(10) - obj2(10)) < Epsilon Then |
2593 |
< |
' c'est cheap.... mais |
2594 |
< |
Return True |
2595 |
< |
End If |
2596 |
< |
Return False |
2592 |
> |
If Math.Abs(obj1(9) - obj2(9)) < Epsilon And Math.Abs(obj1(10) - obj2(10)) < Epsilon Then |
2593 |
> |
' c'est cheap.... mais |
2594 |
> |
Return True |
2595 |
> |
End If |
2596 |
> |
Return False |
2597 |
> |
Catch |
2598 |
> |
Return False |
2599 |
> |
End Try |
2600 |
|
|
2601 |
|
End If |
2602 |
|
|
2607 |
|
End Function |
2608 |
|
|
2609 |
|
|
2610 |
+ |
|
2611 |
|
End Module |