2 Replies Latest reply on Nov 13, 2018 6:00 AM by Dave Bear

    Property Manager Pages made suuuuuper easy with SwEx.PMPage Framework

    Artem Taturevych



      I want to introduce new free and open source library in the SwEx Framework family in addition to the SwEx.AddIn which was published last week.


      SwEx.PMPage library is designed to simplify the way the property manager pages are created and the values are being synchronised with the data model. Framework is used different approach where property manager page is created and bound automatically from the data model.


      For more information, API reference and video demonstration of the benefits of the framework follow this link: SwEx.PMPage




        • Re: Property Manager Pages made suuuuuper easy with SwEx.PMPage Framework
          Artem Taturevych

          New 0.4.0 version is release and published on NuGet. New version includes the following enhancements:

          • Added support for control tags and dependencies
          • Exposed control interface to access native SOLIDWORKS Property Manager Page Control
          • Added support for custom icons for controls and property page
          • Added the ability to add message to property page
          • Added ability to specify display text for enumeration fields used as items for combo box control
          • Added the ability to provide custom selection filter for the selection box control
          • Added the ability to ignore properties from creation property page controls


          Check documentation and API reference for more information and example projects.


          This is a free and open source library available on GitHub.


          This framework uses completely new approach for designing property manager pages. Allowing to develop simple, robust type safe pages in SOLIDWORKS by defining the data model.


          For example this is the property page and its behaviour created using the SwEx.PMPage framework for new version of Bounding Cylinder (Round Stock) Add-In


          1. Page icon loaded from the png file added to resources supporting transparency and automatically resized to fit SOLIDWORKS required size.
          2. Custom message displayed in the page
          3. Links to help documentation and what's new page
          4. Standard 'Select Face' icon used for selection box control
          5. Selection box allowing selection of faces and planes
          6. Additional check boxes
          7. Custom images added to controls (loaded from resources and automatically resized to match SOLIDWORKS required sizes)
          8. Additional styles applied to numberbox controls to include units of measure and wheel
          9. Controls enable state is controlled by the value of the check box. State is automatically updated when check box value is changed
          10. Tooltip of the control is displayed when mouse hovers the control


          And below is the only code required to create this property page. Note that it is not required to add any controls explicitly or set/get control values. Framework will take care of it and bound of the user selections directly to the defined data model (class object):


          [PageOptions(typeof(Resources), nameof(Resources.round_stock_icon),
              swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton |
                      | swPropertyManagerPageOptions_e.swPropertyManagerOptions_WhatsNew)]
              [Message("Select cylindrical face or plane to generate the round stock", "Stock Feature")]
              [DisplayName("Round Stock")]
              public class RoundStockViewModel
                  public enum RoundStepControls_e
                  public class StockStepDependencyHandler : DependencyHandler
                      protected override void UpdateControlState(IPropertyManagerPageControlEx control, IPropertyManagerPageControlEx[] parents)
                          if (parents != null && parents.Length == 1
                              && RoundStepControls_e.UseCustomStep.Equals(parents.First().Tag))
                              var useCustom = (bool)parents.First().GetValue();
                              switch ((RoundStepControls_e)control.Tag)
                                  case RoundStepControls_e.CustomStep:
                                      control.Enabled = useCustom;
                                  case RoundStepControls_e.StockStep:
                                      control.Enabled = !useCustom;
                              Debug.Assert(false, "Invalid dependency. This handler should only be applied to rounding step controls");
                  public class RoundingOptions
                      [Description("Predefined rounding step")]
                      [DependentOn(typeof(StockStepDependencyHandler), RoundStepControls_e.UseCustomStep)]
                      [ControlAttribution(typeof(Resources), nameof(Resources.round_step_predefined))]
                      public StockSteps_e StockStep { get; set; }
                      [DisplayName("Use custom round step")]
                      public bool UseCustomStep { get; set; }
                      [Description("Custom rounding step")]
                      [NumberBoxOptions(swNumberboxUnitType_e.swNumberBox_Length, 0, 1000, 0.001,
                          true, 0.01, 0.0005, swPropMgrPageNumberBoxStyle_e.swPropMgrPageNumberBoxStyle_Thumbwheel)]
                      [DependentOn(typeof(StockStepDependencyHandler), RoundStepControls_e.UseCustomStep)]
                      [ControlAttribution(typeof(Resources), nameof(Resources.round_step_custom))]
                      public double CustomStep { get; set; }
                  public class ExtraMaterialOptions
                      [Description("Add additional material to cylinder diameter")]
                      [NumberBoxOptions(swNumberboxUnitType_e.swNumberBox_Length, 0, 1000, 0.001,
                          true, 0.01, 0.0005, swPropMgrPageNumberBoxStyle_e.swPropMgrPageNumberBoxStyle_Thumbwheel)]
                      public double AdditionalRadius { get; set; }
                  public class ConditionOptions
                      [SelectionBox(swSelectType_e.swSelFACES, swSelectType_e.swSelDATUMPLANES)]
                      [DisplayName("Reference geometry defining the direction of round stock")]
                      public object Direction { get; set; }
                      [DisplayName("Concentric with cylindrical face")]
                      [Description("Specifies if the round stock needs to be concentric with selected cylindrical face")]
                      public bool ConcentricWithCylindricalFace { get; set; } = true;
                      [DisplayName("Create Solid Body")]
                      [Description("Specifies if solid body needs to be created")]
                      public bool CreateSolidBody { get; set; } = true;
                  public ConditionOptions Conditions { get; set; }
                  public RoundingOptions Rounding { get; set; }
                  [DisplayName("Extra Material")]
                  public ExtraMaterialOptions ExtraMaterial { get; set; }
              public enum StockSteps_e
                  Step0, //0