AnsweredAssumed Answered

Property manager page control captions refuse to display

Question asked by Alex Baer on Jan 2, 2019
Latest reply on Jan 3, 2019 by Alex Baer

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!

 

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst

Imports SolidWorks.Interop.swpublished

 

 

Public Class UserPMPage

    Dim iSwApp As SldWorks

    Dim userAddin As SwAddin

    Dim handler As PMPageHandler

    Dim ppage As PropertyManagerPage2

 

 

#Region "Property Manager Page Controls"

    'Groups

    Dim group1 As PropertyManagerPageGroup

 

 

    'Controls

    Dim selectionbox1 As PropertyManagerPageSelectionbox

    Dim selectionbox2 As PropertyManagerPageSelectionbox

    Dim numberbox1 As PropertyManagerPageNumberbox

    Dim numberbox2 As PropertyManagerPageNumberbox

 

 

    'Control IDs

    Dim group1ID As Integer = 0

    Dim selectionbox1ID As Integer = 1

    Dim selectionbox2ID As Integer = 2

    Dim numberbox1ID As Integer = 3

    Dim numberbox2ID As Integer = 4

 

 

#End Region

 

 

    Sub Init(ByVal sw As SldWorks, ByVal addin As SwAddin)

        iSwApp = sw

        userAddin = addin

        CreatePage()

        AddControls()

    End Sub

 

 

    Sub Show()

        ppage.Show()

    End Sub

 

 

    Sub CreatePage()

        handler = New PMPageHandler()

        handler.Init(iSwApp, userAddin)

        Dim options As Integer

        Dim errors As Integer

        options = swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton

        ppage = iSwApp.CreatePropertyManagerPage("Create a line pattern", options, handler, errors)

    End Sub

 

 

    Sub AddControls()

        Dim options As Integer

        Dim leftAlign As Integer

        Dim controlType As Integer

 

 

        'Add Groups

        options = swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded + swAddGroupBoxOptions_e.swGroupBoxOptions_Visible

        group1 = ppage.AddGroupBox(group1ID, "Geometry for faster pattern creation", options)

 

 

        'Add Controls to Group1

 

 

        'Selectbox 1 - This will be where we select the sketch

        controlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox

        leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge

        options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible

        selectionbox1 = group1.AddControl(selectionbox1ID, controlType, "Center line", leftAlign, options, "Sketch to serve as center line")

        selectionbox1.SingleEntityOnly = True

 

 

        ''Attempt to only allow a sketch to be selected

        Dim filters1(0) As swSelectType_e

        filters1(0) = swSelectType_e.swSelSKETCHES

        Dim filterObj1 As Object

        filterObj1 = filters1

        selectionbox1.SetSelectionFilters(filterObj1)

 

 

        ''Selectbox 2- This will be where we select the normal surface

        controlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox

        leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge

        options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible

        selectionbox2 = group1.AddControl(selectionbox2ID, controlType, "Normal Surface", leftAlign, options, "Surface that will have lines normal")

        selectionbox2.SingleEntityOnly = True

 

 

        ''Attempt to only allow a surface to be selected

        Dim filters2(0) As swSelectType_e

        filters2(0) = swSelectType_e.swSelSURFACEBODIES

        Dim filterObj2 As Object

        filterObj2 = filters2

        selectionbox2.SetSelectionFilters(filterObj2)

 

 

        'Numberbox 1 - This will be how many fasteners we want along the curve

        controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox

        leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge

        options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible

        numberbox1 = group1.AddControl(numberbox1ID, controlType, "Count", leftAlign, options, "How many fastener lines should be created along the curve")

        numberbox1.Height = 40

 

 

        'Numberbox 2 - This will be the length of the fastener lines that we'd like

        controlType = swPropertyManagerPageControlType_e.swControlType_Numberbox

        leftAlign = swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge

        options = swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_Visible

        numberbox2 = group1.AddControl(numberbox2ID, controlType, "Length", leftAlign, options, "How long should the normal lines be")

        numberbox2.Heigh = 40

 

 

 

 

    End Sub

 

 

End Class

 

Outcomes