ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magicsld/Debug_form.vb
Revision: 130
Committed: Wed Jul 30 21:26:03 2008 UTC (16 years, 9 months ago) by bournival
File size: 31449 byte(s)
Log Message:
Une mise à jour, car on aura peut-être besoin de mon code.

File Contents

# Content
1 Imports SolidWorks.Interop
2 Imports SolidWorks.Interop.swconst
3 Imports SolidWorks.Interop.swpublished
4
5 Public Class Debug_form
6 Inherits System.Windows.Forms.Form
7
8 #Region " Code généré par le Concepteur Windows Form "
9
10 Public Sub New()
11 MyBase.New()
12
13 'Cet appel est requis par le Concepteur Windows Form.
14 InitializeComponent()
15
16 'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
17
18 End Sub
19
20 'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants.
21 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
22 If disposing Then
23 If Not (components Is Nothing) Then
24 components.Dispose()
25 End If
26 End If
27 MyBase.Dispose(disposing)
28 End Sub
29
30 'Requis par le Concepteur Windows Form
31 Private components As System.ComponentModel.IContainer
32
33 'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
34 'Elle peut être modifiée en utilisant le Concepteur Windows Form.
35 'Ne la modifiez pas en utilisant l'éditeur de code.
36 Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
37 Friend WithEvents Label2 As System.Windows.Forms.Label
38 Friend WithEvents Label3 As System.Windows.Forms.Label
39 Friend WithEvents Label4 As System.Windows.Forms.Label
40 Friend WithEvents Label5 As System.Windows.Forms.Label
41 Friend WithEvents Label6 As System.Windows.Forms.Label
42 Friend WithEvents Label7 As System.Windows.Forms.Label
43 Friend WithEvents Label8 As System.Windows.Forms.Label
44 Friend WithEvents Label9 As System.Windows.Forms.Label
45 Friend WithEvents Label10 As System.Windows.Forms.Label
46 Friend WithEvents Label11 As System.Windows.Forms.Label
47 Friend WithEvents Label12 As System.Windows.Forms.Label
48 Friend WithEvents Label13 As System.Windows.Forms.Label
49 Friend WithEvents Label14 As System.Windows.Forms.Label
50 Friend WithEvents Label15 As System.Windows.Forms.Label
51 Friend WithEvents Label16 As System.Windows.Forms.Label
52 Friend WithEvents Label17 As System.Windows.Forms.Label
53 Friend WithEvents Label18 As System.Windows.Forms.Label
54 Friend WithEvents Label19 As System.Windows.Forms.Label
55 Friend WithEvents Label20 As System.Windows.Forms.Label
56 Friend WithEvents Label21 As System.Windows.Forms.Label
57 Friend WithEvents Label22 As System.Windows.Forms.Label
58 Friend WithEvents Label23 As System.Windows.Forms.Label
59 Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
60 Friend WithEvents Label24 As System.Windows.Forms.Label
61 Friend WithEvents Label25 As System.Windows.Forms.Label
62 Friend WithEvents Label26 As System.Windows.Forms.Label
63 Friend WithEvents Label27 As System.Windows.Forms.Label
64 Friend WithEvents ListBox2 As System.Windows.Forms.ListBox
65 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
66 Me.GroupBox1 = New System.Windows.Forms.GroupBox
67 Me.Label23 = New System.Windows.Forms.Label
68 Me.Label22 = New System.Windows.Forms.Label
69 Me.Label21 = New System.Windows.Forms.Label
70 Me.Label20 = New System.Windows.Forms.Label
71 Me.Label19 = New System.Windows.Forms.Label
72 Me.Label18 = New System.Windows.Forms.Label
73 Me.Label17 = New System.Windows.Forms.Label
74 Me.Label16 = New System.Windows.Forms.Label
75 Me.Label15 = New System.Windows.Forms.Label
76 Me.Label14 = New System.Windows.Forms.Label
77 Me.Label13 = New System.Windows.Forms.Label
78 Me.Label12 = New System.Windows.Forms.Label
79 Me.Label11 = New System.Windows.Forms.Label
80 Me.Label10 = New System.Windows.Forms.Label
81 Me.Label9 = New System.Windows.Forms.Label
82 Me.Label8 = New System.Windows.Forms.Label
83 Me.Label7 = New System.Windows.Forms.Label
84 Me.Label6 = New System.Windows.Forms.Label
85 Me.Label5 = New System.Windows.Forms.Label
86 Me.Label4 = New System.Windows.Forms.Label
87 Me.Label3 = New System.Windows.Forms.Label
88 Me.Label2 = New System.Windows.Forms.Label
89 Me.GroupBox2 = New System.Windows.Forms.GroupBox
90 Me.Label27 = New System.Windows.Forms.Label
91 Me.Label26 = New System.Windows.Forms.Label
92 Me.Label25 = New System.Windows.Forms.Label
93 Me.Label24 = New System.Windows.Forms.Label
94 Me.ListBox2 = New System.Windows.Forms.ListBox
95 Me.GroupBox1.SuspendLayout()
96 Me.GroupBox2.SuspendLayout()
97 Me.SuspendLayout()
98 '
99 'GroupBox1
100 '
101 Me.GroupBox1.Controls.Add(Me.Label23)
102 Me.GroupBox1.Controls.Add(Me.Label22)
103 Me.GroupBox1.Controls.Add(Me.GroupBox2)
104 Me.GroupBox1.Controls.Add(Me.Label21)
105 Me.GroupBox1.Controls.Add(Me.Label20)
106 Me.GroupBox1.Controls.Add(Me.Label19)
107 Me.GroupBox1.Controls.Add(Me.Label18)
108 Me.GroupBox1.Controls.Add(Me.Label17)
109 Me.GroupBox1.Controls.Add(Me.Label16)
110 Me.GroupBox1.Controls.Add(Me.Label15)
111 Me.GroupBox1.Controls.Add(Me.Label14)
112 Me.GroupBox1.Controls.Add(Me.Label13)
113 Me.GroupBox1.Controls.Add(Me.Label12)
114 Me.GroupBox1.Controls.Add(Me.Label11)
115 Me.GroupBox1.Controls.Add(Me.Label10)
116 Me.GroupBox1.Controls.Add(Me.Label9)
117 Me.GroupBox1.Controls.Add(Me.Label8)
118 Me.GroupBox1.Controls.Add(Me.Label7)
119 Me.GroupBox1.Controls.Add(Me.Label6)
120 Me.GroupBox1.Controls.Add(Me.Label5)
121 Me.GroupBox1.Controls.Add(Me.Label4)
122 Me.GroupBox1.Controls.Add(Me.Label3)
123 Me.GroupBox1.Controls.Add(Me.Label2)
124 Me.GroupBox1.Location = New System.Drawing.Point(12, 12)
125 Me.GroupBox1.Name = "GroupBox1"
126 Me.GroupBox1.Size = New System.Drawing.Size(336, 312)
127 Me.GroupBox1.TabIndex = 2
128 Me.GroupBox1.TabStop = False
129 Me.GroupBox1.Text = "Poutre"
130 '
131 'Label23
132 '
133 Me.Label23.Location = New System.Drawing.Point(120, 280)
134 Me.Label23.Name = "Label23"
135 Me.Label23.Size = New System.Drawing.Size(210, 24)
136 Me.Label23.TabIndex = 21
137 Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight
138 '
139 'Label22
140 '
141 Me.Label22.Location = New System.Drawing.Point(120, 256)
142 Me.Label22.Name = "Label22"
143 Me.Label22.Size = New System.Drawing.Size(210, 24)
144 Me.Label22.TabIndex = 20
145 Me.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight
146 '
147 'Label21
148 '
149 Me.Label21.Location = New System.Drawing.Point(120, 232)
150 Me.Label21.Name = "Label21"
151 Me.Label21.Size = New System.Drawing.Size(210, 24)
152 Me.Label21.TabIndex = 19
153 Me.Label21.TextAlign = System.Drawing.ContentAlignment.MiddleRight
154 '
155 'Label20
156 '
157 Me.Label20.Location = New System.Drawing.Point(120, 200)
158 Me.Label20.Name = "Label20"
159 Me.Label20.Size = New System.Drawing.Size(210, 15)
160 Me.Label20.TabIndex = 18
161 Me.Label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight
162 '
163 'Label19
164 '
165 Me.Label19.Location = New System.Drawing.Point(120, 160)
166 Me.Label19.Name = "Label19"
167 Me.Label19.Size = New System.Drawing.Size(210, 16)
168 Me.Label19.TabIndex = 17
169 Me.Label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight
170 '
171 'Label18
172 '
173 Me.Label18.Location = New System.Drawing.Point(120, 136)
174 Me.Label18.Name = "Label18"
175 Me.Label18.Size = New System.Drawing.Size(210, 16)
176 Me.Label18.TabIndex = 16
177 Me.Label18.TextAlign = System.Drawing.ContentAlignment.MiddleRight
178 '
179 'Label17
180 '
181 Me.Label17.Location = New System.Drawing.Point(120, 112)
182 Me.Label17.Name = "Label17"
183 Me.Label17.Size = New System.Drawing.Size(210, 16)
184 Me.Label17.TabIndex = 15
185 Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleRight
186 '
187 'Label16
188 '
189 Me.Label16.Location = New System.Drawing.Point(120, 88)
190 Me.Label16.Name = "Label16"
191 Me.Label16.Size = New System.Drawing.Size(210, 16)
192 Me.Label16.TabIndex = 14
193 Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight
194 '
195 'Label15
196 '
197 Me.Label15.Location = New System.Drawing.Point(120, 64)
198 Me.Label15.Name = "Label15"
199 Me.Label15.Size = New System.Drawing.Size(210, 16)
200 Me.Label15.TabIndex = 13
201 Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight
202 '
203 'Label14
204 '
205 Me.Label14.Location = New System.Drawing.Point(120, 40)
206 Me.Label14.Name = "Label14"
207 Me.Label14.Size = New System.Drawing.Size(210, 16)
208 Me.Label14.TabIndex = 12
209 Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight
210 '
211 'Label13
212 '
213 Me.Label13.Location = New System.Drawing.Point(120, 16)
214 Me.Label13.Name = "Label13"
215 Me.Label13.Size = New System.Drawing.Size(210, 16)
216 Me.Label13.TabIndex = 11
217 Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight
218 '
219 'Label12
220 '
221 Me.Label12.Location = New System.Drawing.Point(40, 288)
222 Me.Label12.Name = "Label12"
223 Me.Label12.Size = New System.Drawing.Size(64, 16)
224 Me.Label12.TabIndex = 10
225 Me.Label12.Text = "Z"
226 Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight
227 '
228 'Label11
229 '
230 Me.Label11.Location = New System.Drawing.Point(40, 264)
231 Me.Label11.Name = "Label11"
232 Me.Label11.Size = New System.Drawing.Size(64, 16)
233 Me.Label11.TabIndex = 9
234 Me.Label11.Text = "Y"
235 Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight
236 '
237 'Label10
238 '
239 Me.Label10.Location = New System.Drawing.Point(40, 240)
240 Me.Label10.Name = "Label10"
241 Me.Label10.Size = New System.Drawing.Size(64, 16)
242 Me.Label10.TabIndex = 8
243 Me.Label10.Text = "X"
244 Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight
245 '
246 'Label9
247 '
248 Me.Label9.Location = New System.Drawing.Point(8, 192)
249 Me.Label9.Name = "Label9"
250 Me.Label9.Size = New System.Drawing.Size(80, 40)
251 Me.Label9.TabIndex = 7
252 Me.Label9.Text = "Coordonnées du troisième point"
253 Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight
254 '
255 'Label8
256 '
257 Me.Label8.Location = New System.Drawing.Point(8, 40)
258 Me.Label8.Name = "Label8"
259 Me.Label8.Size = New System.Drawing.Size(96, 16)
260 Me.Label8.TabIndex = 6
261 Me.Label8.Text = "type de section"
262 Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
263 '
264 'Label7
265 '
266 Me.Label7.Location = New System.Drawing.Point(8, 136)
267 Me.Label7.Name = "Label7"
268 Me.Label7.Size = New System.Drawing.Size(96, 16)
269 Me.Label7.TabIndex = 5
270 Me.Label7.Text = "Dim. secondaire"
271 Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
272 '
273 'Label6
274 '
275 Me.Label6.Location = New System.Drawing.Point(8, 112)
276 Me.Label6.Name = "Label6"
277 Me.Label6.Size = New System.Drawing.Size(96, 16)
278 Me.Label6.TabIndex = 4
279 Me.Label6.Text = "Dim. principale"
280 Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
281 '
282 'Label5
283 '
284 Me.Label5.Location = New System.Drawing.Point(8, 88)
285 Me.Label5.Name = "Label5"
286 Me.Label5.Size = New System.Drawing.Size(96, 16)
287 Me.Label5.TabIndex = 3
288 Me.Label5.Text = "Inertie secondaire"
289 Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
290 '
291 'Label4
292 '
293 Me.Label4.Location = New System.Drawing.Point(8, 64)
294 Me.Label4.Name = "Label4"
295 Me.Label4.Size = New System.Drawing.Size(96, 16)
296 Me.Label4.TabIndex = 2
297 Me.Label4.Text = "Inertie principale"
298 Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
299 '
300 'Label3
301 '
302 Me.Label3.Location = New System.Drawing.Point(56, 16)
303 Me.Label3.Name = "Label3"
304 Me.Label3.Size = New System.Drawing.Size(48, 16)
305 Me.Label3.TabIndex = 1
306 Me.Label3.Text = "Matériau"
307 Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
308 '
309 'Label2
310 '
311 Me.Label2.Location = New System.Drawing.Point(8, 160)
312 Me.Label2.Name = "Label2"
313 Me.Label2.Size = New System.Drawing.Size(96, 16)
314 Me.Label2.TabIndex = 0
315 Me.Label2.Text = "Aire de la section"
316 Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
317 '
318 'GroupBox2
319 '
320 Me.GroupBox2.Controls.Add(Me.Label27)
321 Me.GroupBox2.Controls.Add(Me.Label26)
322 Me.GroupBox2.Controls.Add(Me.Label25)
323 Me.GroupBox2.Controls.Add(Me.Label24)
324 Me.GroupBox2.Location = New System.Drawing.Point(0, 0)
325 Me.GroupBox2.Name = "GroupBox2"
326 Me.GroupBox2.Size = New System.Drawing.Size(272, 312)
327 Me.GroupBox2.TabIndex = 3
328 Me.GroupBox2.TabStop = False
329 Me.GroupBox2.Text = "Coques"
330 Me.GroupBox2.Visible = False
331 '
332 'Label27
333 '
334 Me.Label27.Location = New System.Drawing.Point(96, 56)
335 Me.Label27.Name = "Label27"
336 Me.Label27.Size = New System.Drawing.Size(112, 24)
337 Me.Label27.TabIndex = 3
338 Me.Label27.TextAlign = System.Drawing.ContentAlignment.MiddleRight
339 '
340 'Label26
341 '
342 Me.Label26.Location = New System.Drawing.Point(96, 24)
343 Me.Label26.Name = "Label26"
344 Me.Label26.Size = New System.Drawing.Size(112, 24)
345 Me.Label26.TabIndex = 2
346 Me.Label26.TextAlign = System.Drawing.ContentAlignment.MiddleRight
347 '
348 'Label25
349 '
350 Me.Label25.Location = New System.Drawing.Point(16, 56)
351 Me.Label25.Name = "Label25"
352 Me.Label25.Size = New System.Drawing.Size(72, 24)
353 Me.Label25.TabIndex = 1
354 Me.Label25.Text = "Épaisseur"
355 Me.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleRight
356 '
357 'Label24
358 '
359 Me.Label24.Location = New System.Drawing.Point(16, 24)
360 Me.Label24.Name = "Label24"
361 Me.Label24.Size = New System.Drawing.Size(72, 24)
362 Me.Label24.TabIndex = 0
363 Me.Label24.Text = "Matériau"
364 Me.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleRight
365 '
366 'ListBox2
367 '
368 Me.ListBox2.Location = New System.Drawing.Point(363, 12)
369 Me.ListBox2.Name = "ListBox2"
370 Me.ListBox2.Size = New System.Drawing.Size(402, 446)
371 Me.ListBox2.TabIndex = 4
372 '
373 'Debug_form
374 '
375 Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
376 Me.ClientSize = New System.Drawing.Size(968, 486)
377 Me.Controls.Add(Me.ListBox2)
378 Me.Controls.Add(Me.GroupBox1)
379 Me.Name = "Debug_form"
380 Me.Text = "Debug_form"
381 Me.GroupBox1.ResumeLayout(False)
382 Me.GroupBox2.ResumeLayout(False)
383 Me.ResumeLayout(False)
384
385 End Sub
386
387 #End Region
388
389
390 Private Structure info
391 Dim tipe As Byte
392 Dim M As String
393 Dim S As String
394 Dim I1 As Double
395 Dim I2 As Double
396 Dim D1 As Double
397 Dim D2 As Double
398 Dim A As Double
399 Dim N3 As String
400
401 Dim Ep As Double
402
403 Dim x3 As Double
404 Dim y3 As Double
405 Dim z3 As Double
406 Dim swent As sldworks.Entity
407 End Structure
408
409 Private detail() As info
410
411
412 Private Sub Debug_form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
413 Dim selmgr As sldworks.SelectionMgr
414 Dim i As Integer
415 Dim swEnt As sldworks.Entity
416 Dim swFeat As sldworks.Feature
417 Dim attr As sldworks.Attribute
418
419 Try
420 Intersections.RegisterAttribut()
421
422 ' si on a sélectionné qqchose qui n'est pas une entité (sketch)
423
424 selmgr = swModel.SelectionManager
425 If selmgr.GetSelectedObjectCount = 0 Then Exit Sub
426
427 For i = 1 To selmgr.GetSelectedObjectCount
428
429 swEnt = selmgr.GetSelectedObject5(i)
430
431 Select Case swEnt.GetType
432
433
434 Case swconst.swSelectType_e.swSelATTRIBUTES ' un attribut sélectionné dans le featuremanager
435 Try
436
437 swFeat = swEnt
438 attr = swFeat.GetSpecificFeature2()
439 ecrire(attr)
440
441 Catch
442 End Try
443
444 Case swconst.swSelectType_e.swSelEDGES
445 Try
446 ' on essai pour la condition aux limites
447 ListBox2.Items.Add("------------------------------")
448 ListBox2.Items.Add("---------ARETE------------")
449 Dim arr As sldworks.Edge = swEnt
450 Dim e3 As New SuperArete(arr, True)
451 ListBox2.Items.Add("Nom = " & e3.nom)
452 ListBox2.Items.Add("Long. = " & e3.Longueur)
453 ecrire(swEnt)
454 Catch
455 End Try
456
457
458
459 Case swconst.swSelectType_e.swSelFACES
460 ' on essai pour la condition aux limites
461 ListBox2.Items.Add("------------------------------")
462 ListBox2.Items.Add("---------FACE-------------")
463 Dim swFace As sldworks.Face2 = swEnt
464 Dim face As New SuperFace(swFace, True)
465 ListBox2.Items.Add("Nom = " & face.nom)
466 ListBox2.Items.Add("Aire: =" & face.Aire)
467 ecrire(swEnt)
468
469 Case swconst.swSelectType_e.swSelVERTICES
470 ListBox2.Items.Add("------------------------------")
471 ListBox2.Items.Add("---------Sommet-------------")
472 Dim swSommet As sldworks.Vertex = swEnt
473 Dim Ssommet As New SuperSommet(swSommet)
474 ListBox2.Items.Add("Nom = " & Ssommet.nom)
475 ListBox2.Items.Add("x:= " & Ssommet.GetX)
476 ListBox2.Items.Add("y:= " & Ssommet.GetY)
477 ListBox2.Items.Add("z:= " & Ssommet.GetZ)
478 ecrire(swEnt)
479
480
481
482 End Select
483 Next
484
485 Catch
486 End Try
487
488 End Sub
489
490
491 Private Sub ecrire(ByRef swent As sldworks.Entity, Optional ByRef attr As sldworks.Attribute = Nothing)
492 ' faut trouver quel est l'attribut (s'il y en a un)
493 Dim trouvé As Boolean = False
494 Dim p As sldworks.Parameter
495 Intersections.RegisterAttribut()
496 Commun.ColorerAretes()
497 Try
498 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrConditionLimite, 0)
499 If attr IsNot Nothing Then
500 trouvé = True
501 ListBox2.Items.Add(" ** Condition limite ** ")
502 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
503 p = attr.GetParameter("CL")
504 ListBox2.Items.Add(" CL = " & p.GetStringValue)
505
506 attr = Nothing
507 End If
508 Catch
509 End Try
510
511 Try
512 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrDoublon, 0)
513 If attr IsNot Nothing Then
514 trouvé = True
515 ListBox2.Items.Add(" ** Doublon ** ")
516 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
517 p = attr.GetParameter("Maitre")
518 ListBox2.Items.Add(p.GetStringValue)
519 p = attr.GetParameter("Sens")
520 ListBox2.Items.Add(p.GetDoubleValue)
521 attr = Nothing
522 End If
523 Catch
524 End Try
525
526 Try
527 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrFaceInterne, 0)
528 If attr IsNot Nothing Then
529 trouvé = True
530 ListBox2.Items.Add(" ** Face Interne ** ")
531 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
532 p = attr.GetParameter("FI")
533 ListBox2.Items.Add(" Taille élems = " & p.GetDoubleValue)
534 p = attr.GetParameter("Po")
535 If p.GetDoubleValue = 0 Then ListBox2.Items.Add(" Poutre ") Else ListBox2.Items.Add(" Coque ")
536 attr = Nothing
537 End If
538
539 Catch
540 End Try
541
542 Try
543 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrIgnorer, 0)
544 If attr IsNot Nothing Then
545 trouvé = True
546 ListBox2.Items.Add(" ** Ignorer ** ")
547 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
548
549 attr = Nothing
550 End If
551 Catch
552
553 End Try
554
555 Try
556 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrInterALAL, 0)
557 If attr IsNot Nothing Then
558 trouvé = True
559 ListBox2.Items.Add(" ** Inter AL AL ** ")
560 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
561 p = attr.GetParameter("X")
562 ListBox2.Items.Add(" X" & p.GetDoubleValue)
563 p = attr.GetParameter("Y")
564 ListBox2.Items.Add(" Y" & p.GetDoubleValue)
565 p = attr.GetParameter("Z")
566 ListBox2.Items.Add(" Z" & p.GetDoubleValue)
567 p = attr.GetParameter("T")
568 ListBox2.Items.Add(" T" & p.GetDoubleValue)
569
570 attr = Nothing
571 End If
572 Catch
573 End Try
574
575 Try
576 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrRCCoque, 0)
577 If attr IsNot Nothing Then
578 trouvé = True
579 ListBox2.Items.Add(" ** RC Coque ** ")
580 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
581 p = attr.GetParameter("Ep")
582 ListBox2.Items.Add(" Épaiss." & p.GetDoubleValue)
583 p = attr.GetParameter("Flag")
584 ListBox2.Items.Add(" Flag." & p.GetDoubleValue)
585 attr = Nothing
586 End If
587 Catch
588 End Try
589
590 Try
591 If attr Is Nothing Then attr = swent.FindAttribute(Intersections.DefAttrRCP1, 0)
592 If attr IsNot Nothing Then
593 trouvé = True
594 ListBox2.Items.Add(" ** RC Poutre ** ")
595 ListBox2.Items.Add(" Nom att. = " & attr.GetName)
596 p = attr.GetParameter("S")
597 ListBox2.Items.Add(" Section" & p.GetStringValue)
598 p = attr.GetParameter("As")
599 ListBox2.Items.Add(" Aire sect." & p.GetDoubleValue)
600 p = attr.GetParameter("I1")
601 ListBox2.Items.Add(" Iner 1" & p.GetDoubleValue)
602 p = attr.GetParameter("I2")
603 ListBox2.Items.Add(" Iner 2" & p.GetDoubleValue)
604 p = attr.GetParameter("N3")
605 ListBox2.Items.Add(" N3" & p.GetStringValue)
606 p = attr.GetParameter("D1")
607 ListBox2.Items.Add(" D1" & p.GetDoubleValue)
608 p = attr.GetParameter("D2")
609 ListBox2.Items.Add(" D2" & p.GetDoubleValue)
610 p = attr.GetParameter("D3")
611 ListBox2.Items.Add(" D3" & p.GetDoubleValue)
612 p = attr.GetParameter("D4")
613 ListBox2.Items.Add(" D4" & p.GetDoubleValue)
614 p = attr.GetParameter("D5")
615 ListBox2.Items.Add(" D5" & p.GetDoubleValue)
616 p = attr.GetParameter("D6")
617 ListBox2.Items.Add(" D6" & p.GetDoubleValue)
618 p = attr.GetParameter("Flag")
619 ListBox2.Items.Add(" Flag" & p.GetDoubleValue)
620 attr = Nothing
621 End If
622
623
624 If Not trouvé Then
625 ListBox2.Items.Add(" --Pas d'attributs trouvés--")
626 End If
627
628
629 Catch
630 'MsgBox("Bug dans écrire de la débug_form")
631 End Try
632
633
634
635 End Sub
636
637
638
639
640
641
642 Private Sub populer(ByRef attr As sldworks.Attribute, ByRef swent As sldworks.Entity)
643
644 Dim i As Integer
645 Dim p As sldworks.Parameter
646 i = UBound(detail) + 1
647
648 ReDim Preserve detail(i)
649
650
651 If Microsoft.VisualBasic.Left(attr.GetName, 2) = "CL" Then
652 p = attr.GetParameter("CL")
653 Try
654 detail(i).M = p.GetStringValue
655 Catch ex As Exception
656 Dim pos As Integer
657 pos = InStr(attr.GetName, "_")
658 detail(i).M = p.GetStringValue 'Microsoft.VisualBasic.Right(attr.GetName, Len(attr.GetName) - pos)
659 End Try
660
661 detail(i).swent = swent
662 detail(i).tipe = 1
663 Exit Sub
664 End If
665
666 If Microsoft.VisualBasic.Left(attr.GetName, 9) = "InterAPAP" Then
667 p = attr.GetParameter("X")
668 detail(i).x3 = p.GetDoubleValue
669
670 p = attr.GetParameter("Y")
671 detail(i).y3 = p.GetDoubleValue
672
673 p = attr.GetParameter("Z")
674 detail(i).z3 = p.GetDoubleValue
675
676 detail(i).swent = swent
677 detail(i).tipe = 1
678 Exit Sub
679 End If
680
681 If Microsoft.VisualBasic.Left(attr.GetName, 5) = "FaceI" Then
682 detail(i).M = "FaceInterne"
683
684 detail(i).swent = swent
685 detail(i).tipe = 5
686 Exit Sub
687 End If
688
689 If Microsoft.VisualBasic.Left(attr.GetName, 2) = "Ig" Then
690 detail(i).M = "Ignorer"
691
692 detail(i).swent = swent
693 detail(i).tipe = 6
694 Exit Sub
695 End If
696
697
698 Try
699 p = attr.GetParameter("S")
700 detail(i).S = p.GetStringValue()
701
702 p = attr.GetParameter("M")
703 detail(i).M = p.GetStringValue
704
705 p = attr.GetParameter("I1")
706 detail(i).I1 = p.GetDoubleValue()
707
708 p = attr.GetParameter("I2")
709 detail(i).I2 = p.GetDoubleValue()
710
711 p = attr.GetParameter("D1")
712 detail(i).D1 = p.GetDoubleValue()
713
714 p = attr.GetParameter("D2")
715 detail(i).D2 = p.GetDoubleValue()
716
717 p = attr.GetParameter("As")
718 detail(i).A = p.GetDoubleValue()
719
720 p = attr.GetParameter("N3")
721 detail(i).N3 = p.GetStringValue()
722
723 p = attr.GetParameter("X3")
724 detail(i).x3 = p.GetDoubleValue
725
726 p = attr.GetParameter("Y3")
727 detail(i).y3 = p.GetDoubleValue
728
729 p = attr.GetParameter("Z3")
730 detail(i).z3 = p.GetDoubleValue
731
732 '******************
733 'If Not Microsoft.VisualBasic.Left(attr.GetName, 4) = "Mini" Then
734
735 ' Dim swDocExt As SldWorks.ModelDocExtension
736 ' Dim swXform As SldWorks.MathTransform
737 ' Dim selMgr As SldWorks.SelectionMgr
738 ' Dim swFeat As SldWorks.Feature
739
740 ' swDocExt = swModel.Extension
741 ' selMgr = swModel.SelectionManager
742 ' 'swFeat = selMgr.GetSelectedObject5(1)
743
744 ' swXform = swDocExt.GetCoordinateSystemTransformByName(detail(i).N3)
745
746 ' detail(i).x3 = swXform.ArrayData(9) * 1000.0#
747 ' detail(i).y3 = swXform.ArrayData(10) * 1000.0#
748 ' detail(i).z3 = swXform.ArrayData(11) * 1000.0#
749 'End If
750 detail(i).tipe = 1
751 detail(i).swent = swent
752 '*********************
753 Catch
754 ' ben, on a pas une poutre, mais une coque
755 p = attr.GetParameter("M")
756 detail(i).M = p.GetStringValue
757
758 p = attr.GetParameter("Ep")
759 detail(i).Ep = p.GetDoubleValue()
760 detail(i).tipe = 2
761 detail(i).swent = swent
762 End Try
763
764 fin:
765 End Sub
766
767 Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
768
769 End Sub
770
771 Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
772 'Dim i As Integer
773 'i = ListBox1.SelectedIndex()
774 'If i = 0 Then Exit Sub
775
776 'If detail(i).tipe = 1 Then
777 ' ' on vient de sélectionner une poutre
778 ' GroupBox2.Visible = False
779 ' GroupBox1.Visible = True
780
781 ' Label13.Text = detail(i).M
782 ' Label14.Text = detail(i).S
783 ' Label15.Text = detail(i).I1
784 ' Label16.Text = detail(i).I2
785 ' Label17.Text = detail(i).D1
786 ' Label18.Text = detail(i).D2
787 ' Label19.Text = detail(i).A
788 ' Label20.Text = detail(i).N3
789 ' Label21.Text = detail(i).x3
790 ' Label22.Text = detail(i).y3
791 ' Label23.Text = detail(i).z3
792
793 'ElseIf detail(i).tipe = 2 Then
794 ' ' on a sélectionné une coque
795 ' GroupBox1.Visible = False
796 ' GroupBox2.Visible = True
797
798 ' Label26.Text = detail(i).M
799 ' Label27.Text = detail(i).Ep
800 'End If
801
802 'On Error Resume Next
803 '' on peut sélectionner aussi les entités:
804 'detail(i).swent.Select(False)
805 ''swModel.SelectedFeatureProperties(255, 0.8, 0.5, 0.5, 1, 0, 1, False, False, 0)
806 '' si le entity est un
807 'If detail(i).swent.GetType = swconst.swSelectType_e.swSelATTRIBUTES Then
808 ' Dim swfeat As sldworks.Feature
809 ' Dim attr As sldworks.Attribute
810 ' Dim ent As sldworks.Entity
811 ' swfeat = detail(i).swent
812 ' attr = swfeat.GetSpecificFeature2()
813 ' ent = attr.GetEntity
814 ' ent.Select(True)
815 ' 'swModel.SelectedFeatureProperties(255, 0.8, 0.5, 0.5, 1, 0, 1, False, False, 0)
816 'End If
817
818 End Sub
819
820 Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter
821
822 End Sub
823
824 Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
825
826 End Sub
827 End Class