Hi All,
I've created an Add-In with VB.net and everything seems to work ok aside from that captions refuse to show-up on my property manager page. I can't figure out why. I've tried declaring the caption as a string and I've also tried putting the string in directly when creating the control. I've also tried removing some of the controls in case they are causing an error but still not luck.
I've written Add-Ins before and not had this problem so the inconsistency is frustrating. I've looked around the forums here and couldn't find a solution.
For reference, I'm on SolidWorks 2017 SP5.0
Please let me know if you have any suggestions.
Thanks!
<p>Imports SolidWorks.Interop.sldworks</p><p>Imports SolidWorks.Interop.swconst</p><p>Imports SolidWorks.Interop.swpublished</p><p></p><p></p><p>Public Class UserPMPage</p><p> Dim iSwApp As SldWorks</p><p> Dim userAddin As SwAddin</p><p> Dim handler As PMPageHandler</p><p> Dim ppage As PropertyManagerPage2</p><p></p><p></p><p>#Region "Property Manager Page Controls"</p><p> 'Groups</p><p> Dim group1 As PropertyManagerPageGroup</p><p></p><p></p><p> 'Controls</p><p> Dim selectionbox1 As PropertyManagerPageSelectionbox</p><p> Dim selectionbox2 As PropertyManagerPageSelectionbox</p><p> Dim numberbox1 As PropertyManagerPageNumberbox</p><p> Dim numberbox2 As PropertyManagerPageNumberbox</p><p></p><p></p><p> 'Control IDs</p><p> Dim group1ID As Integer = 0</p><p> Dim selectionbox1ID As Integer = 1</p><p> Dim selectionbox2ID As Integer = 2</p><p> Dim numberbox1ID As Integer = 3</p><p> Dim numberbox2ID As Integer = 4</p><p></p><p></p><p>#End Region</p><p></p><p></p><p> Sub Init(ByVal sw As SldWorks, ByVal addin As SwAddin)</p><p> iSwApp = sw</p><p> userAddin = addin</p><p> CreatePage()</p><p> AddControls()</p><p> End Sub</p><p></p><p></p><p> Sub Show()</p><p> ppage.Show()</p><p> End Sub</p><p></p><p></p><p> Sub CreatePage()</p><p> handler = New PMPageHandler()</p><p> handler.Init(iSwApp, userAddin)</p><p> Dim options As Integer</p><p> Dim errors As Integer</p><p> options = swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton</p><p> ppage = iSwApp.CreatePropertyManagerPage("Create a line pattern", options, handler, errors)</p><p> End Sub</p><p></p><p></p><p> Sub AddControls()</p><p> Dim options As Integer</p><p> Dim leftAlign As Integer</p><p> Dim controlType As Integer</p><p></p><p></p><p> 'Add Groups</p><p> options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible</p><p> group1 = ppage.AddGroupBox(group1ID, "Geometry for faster pattern creation", options)</p><p></p><p></p><p> 'Add Controls to Group1</p><p></p><p></p><p> 'Selectbox 1 - This will be where we select the sketch</p><p> controlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox</p><p> leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge</p><p> options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible</p><p> selectionbox1 = group1.AddControl(selectionbox1ID, controlType, "Center line", leftAlign, options, "Sketch to serve as center line")</p><p> selectionbox1.SingleEntityOnly = True</p><p></p><p></p><p> ''Attempt to only allow a sketch to be selected</p><p> Dim filters1(0) As swSelectType_e</p><p> filters1(0) = swSelectType_e.swSelSKETCHES</p><p> Dim filterObj1 As Object</p><p> filterObj1 = filters1</p><p> selectionbox1.SetSelectionFilters(filterObj1)</p><p></p><p></p><p> ''Selectbox 2- This will be where we select the normal surface</p><p> controlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox</p><p> leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge</p><p> options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible</p><p> selectionbox2 = group1.AddControl(selectionbox2ID, controlType, "Normal Surface", leftAlign, options, "Surface that will have lines normal")</p><p> selectionbox2.SingleEntityOnly = True</p><p></p><p></p><p> ''Attempt to only allow a surface to be selected</p><p> Dim filters2(0) As swSelectType_e</p><p> filters2(0) = swSelectType_e.swSelSURFACEBODIES</p><p> Dim filterObj2 As Object</p><p> filterObj2 = filters2</p><p> selectionbox2.SetSelectionFilters(filterObj2)</p><p></p><p></p><p> 'Numberbox 1 - This will be how many fasteners we want along the curve</p><p> controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox</p><p> leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge</p><p> options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible</p><p> numberbox1 = group1.AddControl(numberbox1ID, controlType, "Count", leftAlign, options, "How many fastener lines should be created along the curve")</p><p> numberbox1.Height = 40</p><p></p><p></p><p> 'Numberbox 2 - This will be the length of the fastener lines that we'd like</p><p> controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox</p><p> leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge</p><p> options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible</p><p> numberbox2 = group1.AddControl(numberbox2ID, controlType, "Length", leftAlign, options, "How long should the normal lines be")</p><p> numberbox2.Heigh = 40</p><p></p><p></p><p></p><p></p><p> End Sub</p><p></p><p></p><p>End Class</p><p></p>SolidworksApi/macros