ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magicsld/CLCode.vb
(Generate patch)

Comparing magicsld/CLCode.vb (file contents):
Revision 40 by bournival, Mon Aug 20 21:30:28 2007 UTC vs.
Revision 130 by bournival, Wed Jul 30 21:26:03 2008 UTC

# Line 1 | Line 1
1 + Imports SolidWorks.Interop
2 + Imports SolidWorks.Interop.swconst
3 + Imports SolidWorks.Interop.swpublished
4 +
5   Namespace ConditionsAuxLimites
6      Module CLCode
7  
# Line 20 | Line 24 | Namespace ConditionsAuxLimites
24          ''' <remarks></remarks>
25          Private Sub MettreNote(ByRef TypeCl As String, ByRef valeur As Double, ByRef couleur As Long, ByVal balon As Integer)
26              ' prend toutes les entités sélectionnées et met une annotation dessu.
23
24
27              Dim Note As SldWorks.Note
28              Dim Annotation As SldWorks.Annotation
29 <            Dim TextFormat As Object = nothing
29 >            Dim TextFormat As Object = Nothing
30              Note = swPart.InsertNote(TypeCl & "," & valeur)
31              If Not Note Is Nothing Then
32                  Note.Angle = 0
# Line 113 | Line 115 | Namespace ConditionsAuxLimites
115  
116          End Sub
117  
118 <        Private Sub SelectSousJacent(ByRef swFace As SldWorks.Face2)
119 <            Dim swEnt As SldWorks.Entity
118 >        Private Overloads Sub SelectSousJacent(ByRef swFace As sldworks.Face2)
119 >            Dim swEnt As sldworks.Entity
120              Dim coa As Integer
121 <            Dim swLoop As SldWorks.Loop2
120 <            Dim swCoArete As SldWorks.CoEdge
121 <            Dim swArete As SldWorks.Edge
121 >            Dim swLoop As sldworks.Loop2
122  
123              swLoop = swFace.GetFirstLoop
124              Do While Not swLoop Is Nothing
125                swCoArete = swLoop.GetFirstCoEdge
126                For coa = 0 To swLoop.GetEdgeCount
127                    swArete = swCoArete.GetEdge
128
129                    swEnt = swArete
130                    swEnt.Select4(True, Nothing)
131
125  
126 +                Dim vArete As Object = swLoop.GetEdges()
127 +                For Each swArete As sldworks.Edge In vArete
128 +                    'swEnt = swArete
129 +                    'swEnt.Select3(True, 0, Nothing)
130 +                    Dim e As New SuperArete(swArete, True) : e.SelectionnerSafe()
131                      Call SelectSousJacent(swArete)
132 <
135 <                    swCoArete = swCoArete.GetNext
136 <                Next coa ' fin de loop sur les coaretes
132 >                Next swArete ' fin de loop sur les coaretes
133  
134                  swLoop = swLoop.GetNext
135              Loop ' fin loop sur loop
136  
137          End Sub
138  
139 <        Private Sub SelectSousJacent(ByRef swArete As SldWorks.Edge)
139 >        Private Overloads Sub SelectSousJacent(ByRef swArete As sldworks.Edge)
140              ' l'arête est sélectionnée, il faut sélectionner ses sommets...
141 <            Dim sommet1 As SldWorks.Vertex
142 <            Dim sommet2 As SldWorks.Vertex
143 <            Dim swEnt As SldWorks.Entity
141 >            Dim sommet1 As sldworks.Vertex
142 >            Dim sommet2 As sldworks.Vertex
143 >            Dim swEnt As sldworks.Entity
144  
145              sommet1 = swArete.GetStartVertex
146  
147              If IsNothing(sommet1) Then Exit Sub ' courbe sans sommets
148  
149 <            swEnt = sommet1
150 <            swEnt.Select4(True, Nothing)
149 >            'swEnt = sommet1
150 >            'swEnt.Select2(True, Nothing)
151 >            Dim esom1 As New SuperSommet(sommet1, True) : esom1.SelectionnerSafe()
152  
153              sommet2 = swArete.GetEndVertex
154 <            swEnt = sommet2
155 <            swEnt.Select4(True, Nothing)
154 >            'swEnt = sommet2
155 >            'swEnt.Select2(True, Nothing)
156 >            Dim esom2 As New SuperSommet(sommet2, True) : esom2.SelectionnerSafe()
157  
158          End Sub
159  
# Line 181 | Line 179 | Namespace ConditionsAuxLimites
179              selMgr = swModel.SelectionManager
180  
181              For i = 1 To selMgr.GetSelectedObjectCount
182 <                If selMgr.GetSelectedObjectType2(i) = SwConst.swSelectType_e.swSelPOINTREFS Then
182 >                If selMgr.GetSelectedObjectType2(i) = swconst.swSelectType_e.swSelPOINTREFS Then
183                      ' transformer la sélection d'un pointref en une sélection de vertex
184                      Dim coords(2) As Double
185                      Dim vretval As Object
# Line 204 | Line 202 | Namespace ConditionsAuxLimites
202                      If Not swModel.AndSelectByID(Nothing, "VERTEX", lstpoints(j + 0), lstpoints(j + 1), lstpoints(j + 2)) Then MsgBox("Échec")
203                      Dim swsommet As SldWorks.Vertex
204  
205 <                    swModel.SelectAt(SwConst.swSelectType_e.swSelVERTICES, lstpoints(j + 0), lstpoints(j + 1), lstpoints(j + 2))
205 >                    swModel.SelectAt(swconst.swSelectType_e.swSelVERTICES, lstpoints(j + 0), lstpoints(j + 1), lstpoints(j + 2))
206                      swEnt = selMgr.GetSelectedObject5(1)
207                      swsommet = swEnt
208  
# Line 218 | Line 216 | Namespace ConditionsAuxLimites
216  
217              For Each swEnt In listeentite
218                  If swEnt IsNot Nothing Then
219 + retour:
220                      Select Case swEnt.GetType
221 <                        Case SwConst.swSelectType_e.swSelVERTICES
221 >                        Case swconst.swSelectType_e.swSelVERTICES
222                              Dim swSommet As SldWorks.Vertex
223                              swSommet = swEnt
224                              CL = New EncapCL(swSommet)
225  
226 <                        Case SwConst.swSelectType_e.swSelEDGES
226 >                        Case swconst.swSelectType_e.swSelEDGES
227                              Dim swArete As SldWorks.Edge
228                              swArete = swEnt
229                              CL = New EncapCL(swArete)
230  
231 <                        Case SwConst.swSelectType_e.swSelFACES
231 >                        Case swconst.swSelectType_e.swSelFACES
232                              Dim swFace As SldWorks.Face2
233                              swFace = swEnt
234                              CL = New EncapCL(swFace)
235 <
235 >                        Case swconst.swSelectType_e.swSelATTRIBUTES
236 >                            Dim attr As SldWorks.Attribute = swEnt
237 >                            swEnt = attr.GetEntity2()
238 >                            GoTo retour
239                          Case Else
240                              'MsgBox("Une entité sélectionnée ne peut avoir de condition aux limites -->" & selMgr.GetSelectedObjectType2(i))
241  
# Line 244 | Line 246 | Namespace ConditionsAuxLimites
246              Next swEnt
247          End Sub
248  
249 < End Module
249 >    End Module
250   End Namespace

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines