ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magicsld/CLProp.vb
Revision: 48
Committed: Wed Aug 22 21:18:12 2007 UTC (17 years, 8 months ago) by bournival
File size: 7416 byte(s)
Log Message:
On passe aux nouveaux .dll

File Contents

# Content
1 Imports SolidWorks.Interop
2 Imports SolidWorks.Interop.swconst
3 Imports SolidWorks.Interop.swpublished
4
5 ' la classe des propriétés
6
7 Namespace ConditionsAuxLimites
8 Public Class ConditionLimitePage
9 Dim iSwApp As SldWorks.SldWorks
10 Dim userAddin As MAGIC.Magic
11 Dim handler As CLPageHandler
12 Dim ppage As sldworks.PropertyManagerPage2
13
14 #Region "Property Manager Page Controls"
15 'Groupes
16 Dim group1 As sldworks.PropertyManagerPageGroup
17 'Dim group2 As PropertyManagerPageGroup
18
19 ''Controles
20 'Dim checkbox1 As PropertyManagerPageCheckbox
21 Dim BoutonSousJascent As sldworks.PropertyManagerPageButton
22 Dim checkbox2 As sldworks.PropertyManagerPageCheckbox
23 Dim selection1 As sldworks.PropertyManagerPageSelectionbox
24 Dim combo1 As sldworks.PropertyManagerPageCombobox
25 Dim Numberbox1 As sldworks.PropertyManagerPageNumberbox
26 Dim DessinerCheck As sldworks.PropertyManagerPageCheckbox
27
28
29
30 #End Region
31
32 Function Init(ByVal sw As SldWorks.SldWorks, ByVal addin As MAGIC.Magic) As Object
33 iSwApp = sw
34 userAddin = addin
35 CreatePage()
36 AddControls()
37 Return Nothing
38 End Function
39
40 Sub Show()
41 ppage.Show()
42 End Sub
43
44 Sub CreatePage()
45 handler = New CLPageHandler
46 handler.Init(iSwApp, userAddin)
47 Dim options As Integer
48 Dim errors As Integer
49 options = swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton
50 ppage = iSwApp.CreatePropertyManagerPage("Condition limite", options, handler, errors)
51 End Sub
52
53 Sub AddControls()
54 Dim options As Integer
55 Dim leftAlign As Integer
56 Dim controlType As Integer
57
58 ppage.SetMessage("La sélection de l'option «Inclure les topologies sous-jacentes» n'affichera pas les entités dans la liste mais les sélectionne sur le modèle (et les prend en compte)", swPropertyManagerPageMessageVisibility.swMessageBoxVisible)
59 ' premier (et théoriquement seul) groupe
60 options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible
61 group1 = ppage.AddGroupBox(0, "Condition de frontière", options)
62
63
64 'Selection1, qui contiendra les entités sélectionnées
65 controlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox
66 leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
67 options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
68 selection1 = group1.AddControl(1, controlType, "Topologies sélectionnées", leftAlign, options, "Montre les entités qui ont été sélectionnées")
69 If Not selection1 Is Nothing Then
70 Dim filter() As Integer = New Integer() {swSelectType_e.swSelVERTICES, swSelectType_e.swSelEDGES, swSelectType_e.swSelFACES, swSelectType_e.swSelPOINTREFS} ' pour sélectionner juste les faces, aretes et sommets
71 selection1.Height = 50
72 selection1.SetSelectionFilters(filter)
73 End If
74 CLCode.selection1 = selection1 ' pour accéder à ses méthodes à partir du module CLCode...
75
76
77 'Bouton1, qui demande si on doit inclure les topologies sous-jacentes
78 controlType = swPropertyManagerPageControlType_e.swControlType_Button
79 leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
80 options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
81 BoutonSousJascent = group1.AddControl(2, controlType, "Ajouter les topologies sous-jacentes", leftAlign, options, "Une face sélectionnée ajoute les arêtes et sommets, une arete sélectionnée ajoute ses sommets")
82 BoutonSousJascent.Caption = "Sélectionner topologies sous-jacentes"
83 'CLCode.SousJacent = False
84 'CLCode.checkbox1 = checkbox1
85
86 'Checkbox2, qui demande si l'on doit utiliser une seule annotation pour toutes les entités
87 'controlType = swPropertyManagerPageControlType_e.swControlType_Checkbox
88 'leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
89 'options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
90 'checkbox2 = group1.AddControl(3, controlType, "Utiliser une seule annotation", leftAlign, options, "Utiliser une seule annotation pour désigner toutes les conditions aux limites de ce type")
91 'checkbox2.Checked = True
92 'CLCode.checkbox2 = checkbox2
93 'CLCode.AnnoSeul = True
94
95 'Combo1, les types de conditions aux limites
96 controlType = swPropertyManagerPageControlType_e.swControlType_Combobox
97 leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
98 options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
99 combo1 = group1.AddControl(4, controlType, "Type de conditions", leftAlign, options, " Choix du type de condition à appliquer à (aux) entité(s) sélectionnée(s)")
100 If Not combo1 Is Nothing Then
101 combo1.Height = 600
102 Dim items() As String = New String() {"Da, Bloquer les translations", "Dx, Bloquer les translations en X", "Dy, Bloquer les translations en Y", "Dz, Bloquer les translations en Z", "Fx, Force en X", "Fy, Force en Y", "Fz, Force en Z", "Px, Pression en X", "Py, Pression en Y", "Pz, Pression en Z", "Pn, Pression normale"}
103 combo1.Style = swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditableText
104 combo1.AddItems(items)
105 End If
106 CLCode.combo1 = combo1
107
108 'Numberbox1, là où on entre les valeurs
109 controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox
110 leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
111 options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
112 Numberbox1 = group1.AddControl(5, controlType, "Valeur", leftAlign, options, "Entrez la valeur de la condition")
113 Numberbox1.Value = 0
114 Numberbox1.SetRange(SwConst.swNumberboxUnitType_e.swNumberBox_UnitlessDouble, -1.0E+20, 1.0E+20, 1, True)
115 CLCode.Numberbox1 = Numberbox1
116
117 ' checkbox où on dit que l'on veut dessiner
118 controlType = swPropertyManagerPageControlType_e.swControlType_Checkbox
119 leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge
120 options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible
121 DessinerCheck = group1.AddControl(8, controlType, "Dessiner les conditions", leftAlign, options, "Place des repères pour illustrer les conditions")
122 CLCode.DessinerCL = DessinerCheck
123
124 End Sub
125 End Class
126
127
128
129
130 End Namespace