Exemplo n.º 1
0
        void IPropertyManagerPage2Handler9.AfterClose()
        {
            SauverConfigBouton = true;

            SauverConfig();

            if (OnRunAfterClose.IsRef())
            {
                OnRunAfterClose();
            }

            if (_Ok)
            {
                if (OnRunOkCommand.IsRef())
                {
                    OnRunOkCommand();
                }
                else
                if (OnRunCancelCommand.IsRef())
                {
                    OnRunCancelCommand();
                }
            }

            //SauverConfig();

            _Config = null;
            _Calque = null;
            _PmPage = null;
        }
Exemplo n.º 2
0
        public BoutonPMPManager()
        {
            try
            {
                SauverConfigBouton = false;

                var Options = PageOptions.Defaut;

                PageOptions pageOptionsAtt = GetType().GetCustomAttribute <PageOptions>();
                if (pageOptionsAtt.IsRef())
                {
                    Options |= pageOptionsAtt.Val;
                }

                int iErrors = 0;
                _PmPage = (PropertyManagerPage2)App.Sw.CreatePropertyManagerPage(TitreModule, (int)Options, this, ref iErrors);

                if (iErrors != (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
                {
                    this.LogMethode(new Object[] { "Erreur de création :", (swPropertyManagerPageStatus_e)iErrors });
                    IsInit = false;
                }
            }
            catch (Exception e)
            {
                this.LogMethode(new Object[] { "Erreur :", e });
                IsInit = false;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加GroupBox
        /// </summary>
        /// <param name="page"></param>
        /// <param name="id">id</param>
        /// <param name="Caption">标题</param>
        /// <param name="option">选项</param>
        /// <returns></returns>
        public static PropertyManagerPageGroup CreateGroupBoxEx(this PropertyManagerPage2 page, int id, string Caption,
                                                                IEnumerable <swAddGroupBoxOptions_e> options = null)
        {
            options = options ??
                      new[]
            {
                swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded,
                swAddGroupBoxOptions_e.swGroupBoxOptions_Visible
            };
            var optionsShort = (short)CombineToInt(options, v => (short)v);

            return(page.AddGroupBox(id, Caption, optionsShort) as PropertyManagerPageGroup);
        }
Exemplo n.º 4
0
        //The following runs when a new instance of the class is created
        public URDFExporterPM(SldWorks swAppPtr)
        {
            swApp                = swAppPtr;
            ActiveSWModel        = swApp.ActiveDoc;
            Exporter             = new URDFExporter(swApp);
            Exporter.mRobot      = new robot();
            Exporter.mRobot.name = ActiveSWModel.GetTitle();

            linksToVisit = new List <link>();
            docMenu      = new ContextMenuStrip();

            string PageTitle   = null;
            string caption     = null;
            string tip         = null;
            long   options     = 0;
            int    longerrors  = 0;
            int    controlType = 0;
            int    alignment   = 0;

            string[] listItems = new string[4];

            ActiveSWModel.ShowConfiguration2("URDF Export");


            #region Create and instantiate components of PM page
            //Set the variables for the page
            PageTitle = "URDF Exporter";
            //options = (int)swPropertyManagerButtonTypes_e.swPropertyManager_OkayButton + (int)swPropertyManagerButtonTypes_e.swPropertyManager_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_LockedPage + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_PushpinButton;
            options = (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_HandleKeystrokes;

            //Create the PropertyManager page
            pm_Page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage(PageTitle, (int)options, this, ref longerrors);

            //Make sure that the page was created properly
            if (longerrors == (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
            {
                setupPropertyManagerPage(ref caption, ref tip, ref options, ref controlType, ref alignment);
            }

            else
            {
                //If the page is not created
                System.Windows.Forms.MessageBox.Show("An error occurred while attempting to create the " + "PropertyManager Page");
            }

            #endregion
        }
Exemplo n.º 5
0
        protected void CreatePropertyManagerPage()
        {
            int errors  = -1;
            int options = (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton |
                          (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton;

            swPropertyPage = (PropertyManagerPage2)iSwApp.CreatePropertyManagerPage("创建分流板主体", (int)options, (PropertyManagerPage2Handler9)this, ref errors);
            if (swPropertyPage != null && errors == (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
            {
                try
                {
                    AddControls();
                }
                catch (Exception e)
                {
                    iSwApp.SendMsgToUser2(e.Message, 0, 0);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates the property manager page and populates it with controls
        /// </summary>
        private void SetupPage()
        {
            int errors = 0;

            //Create a property manager page and throw exceptions if an error occurs
            page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage("Edit Robot Frame of Reference",
                                                                                   (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton,
                                                                                   this, ref errors);
            if (errors == -1) //Creation failed
                throw new InternalSolidworksException("SldWorks::CreatePropertyManagerPage", "Failed to create property manager page");
            else if (errors == -2) //No open document
                throw new ProgramErrorException("Tried to open a property manager page when no document was open");
            else if (errors == 1) //Invlaid hanlder
                throw new ProgramErrorException("Tried to pass in and invalid page hanlder when creating a property manager page");

            //Helper variables for setup options
            //control type
            short labelCT = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            short selectionboxCT = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            short buttonCT = (int)swPropertyManagerPageControlType_e.swControlType_CheckableBitmapButton;
            // align
            short leftAlign = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            short buttonAlign = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            // options
            int groupboxOptions = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                                  (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible; // for group box
            int controlOptions = (int)swAddControlOptions_e.swControlOptions_Enabled |
                                 (int)swAddControlOptions_e.swControlOptions_Visible; // for controls
            // object filters
            int[] linefilter = new int[] { (int)swSelectType_e.swSelDATUMAXES, (int)swSelectType_e.swSelEDGES };
            int[] pointfilter = new int[] { (int)swSelectType_e.swSelDATUMPOINTS, (int)swSelectType_e.swSelVERTICES };
            int[] planefilter = new int[] { (int)swSelectType_e.swSelDATUMPLANES, (int)swSelectType_e.swSelFACES };

            //Setup and create the robot properties group
            robotPropertiesGroup = (PropertyManagerPageGroup)page.AddGroupBox(
                robotPropertiesGroupID, "Robot Frame of Reference Properties", groupboxOptions);
            //Setup and create the label for the origin point selection box
            originPointLabel = (PropertyManagerPageLabel)robotPropertiesGroup.AddControl(
                originPointLabelID, labelCT, "Robot origin point", leftAlign, controlOptions, "Select the origin point for this robot");
            //Setup and create the origin point selectionbox
            originPointSelectionbox = (PropertyManagerPageSelectionbox)robotPropertiesGroup.AddControl(
                originPointSelectionboxID, selectionboxCT, "Robot origin point", leftAlign, controlOptions, "Use this box to select a point");
            originPointSelectionbox.AllowSelectInMultipleBoxes = false;
            originPointSelectionbox.SingleEntityOnly = true;
            originPointSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem1);
            originPointSelectionbox.Mark = 2;
            originPointSelectionbox.SetSelectionFilters(pointfilter);
            //Setup and create the label for the base plane selection box
            basePlaneLabel = (PropertyManagerPageLabel)robotPropertiesGroup.AddControl(
                basePlaneLabelID, labelCT, "Base plane", leftAlign, controlOptions, "Select the base plane for this robot");
            //create baseplane flip checkbox
            flipPlaneDirectionButton = (PropertyManagerPageBitmapButton)robotPropertiesGroup.AddControl(
                flipPlaneDirectionButtonID, buttonCT, "Flip plane normal", buttonAlign, controlOptions, "Check to flip the direction of the normal of the base plane");
            flipPlaneDirectionButton.SetStandardBitmaps((int)swPropertyManagerPageBitmapButtons_e.swBitmapButtonImage_reverse_direction);
            flipPlaneDirectionButton.Checked = false;
            //Setup and create the base plane selectionbox
            basePlaneSelectionbox = (PropertyManagerPageSelectionbox)robotPropertiesGroup.AddControl(
                basePlaneSelectionboxID, selectionboxCT, "Base plane", leftAlign, controlOptions, "Use this box to select a plane");
            basePlaneSelectionbox.AllowSelectInMultipleBoxes = false;
            basePlaneSelectionbox.SingleEntityOnly = true;
            basePlaneSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            basePlaneSelectionbox.Mark = 4;
            basePlaneSelectionbox.SetSelectionFilters(planefilter);

            ((PropertyManagerPageControl)basePlaneSelectionbox).Top = 75;
            ((PropertyManagerPageControl)flipPlaneDirectionButton).Top = (short)(((PropertyManagerPageControl)basePlaneSelectionbox).Top+3);

            //Setup and create the label for the direction axis selection box
            directionAxisLabel = (PropertyManagerPageLabel)robotPropertiesGroup.AddControl(
                directionAxisLabelID, labelCT, "Direction axis", leftAlign, controlOptions, "Select the axis along which the robot faces");
            //Setup and create the axis flip checkbox
            flipAxisDirectionButton = (PropertyManagerPageBitmapButton)robotPropertiesGroup.AddControl(
                flipAxisDirectionButtonID, buttonCT, "Flip axis direction", buttonAlign, controlOptions, "Check to flip the direction of the axis to the direction that the robot is facing");
            flipAxisDirectionButton.SetStandardBitmaps((int)swPropertyManagerPageBitmapButtons_e.swBitmapButtonImage_reverse_direction);
            flipAxisDirectionButton.Checked = false;
            //Setup and create the direction axis selection box
            directionAxisSelectionbox = (PropertyManagerPageSelectionbox)robotPropertiesGroup.AddControl(
                directionAxisSelectionboxID, selectionboxCT, "Direction axis", leftAlign, controlOptions, "Use this box to select an axis");
            directionAxisSelectionbox.AllowSelectInMultipleBoxes = false;
            directionAxisSelectionbox.SingleEntityOnly = true;
            directionAxisSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem3);
            directionAxisSelectionbox.Mark = 8;
            directionAxisSelectionbox.SetSelectionFilters(linefilter);

            ((PropertyManagerPageControl)directionAxisSelectionbox).Top = 125;
            ((PropertyManagerPageControl)flipAxisDirectionButton).Top = (short)(((PropertyManagerPageControl)directionAxisSelectionbox).Top + 3);
        }
        /// <summary>
        /// sets up all the controls on the page
        /// </summary>
        public void SetupPage()
        {
            //Helper variables
            int options;
            short controlType, align;
            int errors = 0;
            System.Diagnostics.Debug.WriteLine(this is PropertyManagerPage2Handler9);
            //Create a property manager page and throw exceptions if an error occurs
            page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage("Attachment Selection",
                                                                                   (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton,
                                                                                   this, ref errors);
            if (errors == -1) //Creation failed
                throw new InternalSolidworksException("SldWorks::CreatePropertyManagerPage", "Failed to create property manager page");
            else if (errors == -2) //No open document
                throw new ProgramErrorException("Tried to open a property manager page when no document was open");
            else if (errors == 1) //Invlaid hanlder
                throw new ProgramErrorException("Tried to pass in and invalid page hanlder when creating a property manager page");

            //Sets the page's message
            page.SetMessage3("Select the origin and direction for this attachment.",
                                    (int)swPropertyManagerPageMessageVisibility.swMessageBoxVisible,
                                    (int)swPropertyManagerPageMessageExpanded.swMessageBoxExpand,
                                    "Message");
            //create the selection group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            selectionGroup = (PropertyManagerPageGroup)page.AddGroupBox(selectionGroupID, "Attachment Selections", options);

            //create the Origin selection Label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            originLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(originLabelID, controlType, "Attachment Origin", align, options, "Select the orgin point of the Attachment");

            //create Orgin selectionbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            originSelectionbox = (PropertyManagerPageSelectionbox)selectionGroup.AddControl(originSelectionboxID, controlType, "Attachment Origin", align, options, "Select the origin point of the Attachment");
            originSelectionbox.AllowSelectInMultipleBoxes = false;
            originSelectionbox.SingleEntityOnly = true;
            originSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            originSelectionbox.Mark = 2;
            int[] filter = { (int)swSelectType_e.swSelVERTICES, (int)swSelectType_e.swSelDATUMPOINTS};
            originSelectionbox.SetSelectionFilters(filter);

            //create the axis selection Label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            axisLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(axisLabelID, controlType, "Attachment Axis", align, options, "Select the viewing axis of the Attachment");

            //create axis selectionbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            axisSelectionbox = (PropertyManagerPageSelectionbox)selectionGroup.AddControl(axisSelectionboxID, controlType, "Attachment Axis", align, options, "Select the viewing axis of the Attachment");
            axisSelectionbox.AllowSelectInMultipleBoxes = false;
            axisSelectionbox.SingleEntityOnly = true;
            axisSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            axisSelectionbox.Mark = 4;
            filter = new int[] { (int)swSelectType_e.swSelEDGES, (int)swSelectType_e.swSelDATUMAXES};
            axisSelectionbox.SetSelectionFilters(filter);

            //Setup and create axis flip checkbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_CheckableBitmapButton;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            flipAxisButton = (PropertyManagerPageBitmapButton)selectionGroup.AddControl(flipAxisButtonID, controlType, "Flip direction axis", align, options, "Check to flip the direction of viewing");
            flipAxisButton.Checked = currentAttachment.FlipAxis;
            flipAxisButton.SetStandardBitmaps((int)swPropertyManagerPageBitmapButtons_e.swBitmapButtonImage_reverse_direction);

            ((PropertyManagerPageControl)flipAxisButton).Top = 75;
            ((PropertyManagerPageControl)axisSelectionbox).Top = 75;

            //create FOV label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            FOVLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(FOVLabelID, controlType, "Field of View", align, options, "Select Field of View");

            //create FOV slider
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Slider;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            FOVSlider = (PropertyManagerPageSlider)selectionGroup.AddControl(FOVSliderID, controlType, "FOV Slider", align, options, "Slide to adjust FOV");
            if (currentAttachment.FOV > 0)
            {
                FOVSlider.SetRange(5,175); //corresponds to radius of 5 to 175 meters
                FOVSlider.TickFrequency = 5;
                FOVSlider.Position = (int)currentAttachment.FOV;
            }
            else
            {
                FOVSlider.SetRange(5, 100); //after conversion corresponds to radius of 5 to 100 centimeters
                FOVSlider.TickFrequency = 5;
                FOVSlider.Position = (int)(-currentAttachment.FOV * 100);
            }
            FOVSlider.Style = (int)swPropMgrPageSliderStyle_e.swPropMgrPageSliderStyle_AutoTicks | (int)swPropMgrPageSliderStyle_e.swPropMgrPageSliderStyle_BottomLeftTicks | (int)swPropMgrPageSliderStyle_e.swPropMgrPageSliderStyle_NotifyWhileTracking;

            //create manual angle checkbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Checkbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            manualAngleCheckbox = (PropertyManagerPageCheckbox)selectionGroup.AddControl(manualAngleCheckboxID, controlType, "Manual Rotations", align, options, "Check to manually define angle rotations");
            manualAngleCheckbox.Checked = currentAttachment.UseManualAngles;

            //create the roll text Label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            rollLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(rollLabelID, controlType, "Roll", align, options, "Rotation about the X axis");

            //create roll textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            rollTextbox = (PropertyManagerPageTextbox)selectionGroup.AddControl(rollTextboxID, controlType, "0.0", align, options, "Enter the rotation about the X axis");

            //create the pitch text Label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            pitchLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(pitchLabelID, controlType, "Pitch", align, options, "Rotation about the Y axis");

            //create pitch textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pitchTextbox = (PropertyManagerPageTextbox)selectionGroup.AddControl(pitchTextboxID, controlType, "0.0", align, options, "Enter the rotation about the Y axis");

            //create the yaw text Label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            yawLabel = (PropertyManagerPageLabel)selectionGroup.AddControl(yawLabelID, controlType, "Yaw", align, options, "Rotation about the Z axis");

            //create roll textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            yawTextbox = (PropertyManagerPageTextbox)selectionGroup.AddControl(yawTextboxID, controlType, "0.0", align, options, "Enter the rotation about the Z axis");

            ToggleManualAngles(currentAttachment.UseManualAngles);

            page.Show();

            //ModelViewManager swModViewMgr = modelDoc.ModelViewManager;
            //IMathUtility mathUtil = ((IMathUtility)swApp.GetMathUtility());
            //swManip = swModViewMgr.CreateManipulator((int)swManipulatorType_e.swTriadManipulator, this);
            //rotManipulator = (TriadManipulator)swManip.GetSpecificManipulator();

            //rotManipulator.DoNotShow =  (int)swTriadManipulatorDoNotShow_e.swTriadManipulatorDoNotShowXYPlane
                //+ (int)swTriadManipulatorDoNotShow_e.swTriadManipulatorDoNotShowYZPlane + (int)swTriadManipulatorDoNotShow_e.swTriadManipulatorDoNotShowZXPlane;// 127;//hides all exept for rotations

            SelectOrigin();
            rollTextbox.Text = (currentAttachment.RotRoll * 180 / Math.PI).ToString();
            pitchTextbox.Text = (currentAttachment.RotPitch * 180 / Math.PI).ToString();
            yawTextbox.Text = (currentAttachment.RotYaw * 180 / Math.PI).ToString();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates the property manager page and populates it with controls
        /// </summary>
        private void SetupPage()
        {
            int errors = 0;

            //Create a property manager page and throw exceptions if an error occurs
            page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage("Edit Links",
                                                                                   (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton,
                                                                                   this, ref errors);

            if (errors == -1) //Creation failed
                throw new InternalSolidworksException("SldWorks::CreatePropertyManagerPage", "Failed to create property manager page");
            else if (errors == -2) //No open document
                throw new ProgramErrorException("Tried to open a property manager page when no document was open");
            else if (errors == 1) //Invlaid hanlder
                throw new ProgramErrorException("Tried to pass in and invalid page hanlder when creating a property manager page");

            //Helper variables for setup options
            //control type
            short labelCT = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            short selectionboxCT = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            short checkboxCT = (int)swPropertyManagerPageControlType_e.swControlType_Checkbox;
            short textboxCT = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            // align
            short leftAlign = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            // options
            int groupboxOptions = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                                  (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible; // for group box
            int controlOptions = (int)swAddControlOptions_e.swControlOptions_Enabled |
                                 (int)swAddControlOptions_e.swControlOptions_Visible; // for controls
            int readonlyOptions = (int)swAddControlOptions_e.swControlOptions_Visible;

            //Sets the page's message
            page.SetMessage3(infoMessage,
                                    (int)swPropertyManagerPageMessageVisibility.swMessageBoxVisible,
                                    (int)swPropertyManagerPageMessageExpanded.swMessageBoxExpand,
                                    "Message");
            //Setup and create the link properties group
            linkPropertiesGroup = (PropertyManagerPageGroup)page.
                AddGroupBox(linkPropertiesGroupID, "Link Properties", groupboxOptions);

            //Setup and create link colors checkbox
            linkColorCheckbox = (PropertyManagerPageCheckbox)linkPropertiesGroup.
                AddControl(linkColorCheckboxID, checkboxCT, "Color components by link", leftAlign, controlOptions, "Check to change all components that are part of links to the color of the link");
            linkColorCheckbox.Checked = false;

            //show Link name, Model type, and SW config to remind user
            //Setup and create the label for the link name texbox
            linkNameLabel = (PropertyManagerPageLabel)linkPropertiesGroup.
                AddControl(linkNameLabelID, labelCT, "Link Name:", leftAlign, controlOptions, "The name of this link");
            //Setup and create the link name textbox
            linkNameTextbox = (PropertyManagerPageTextbox)linkPropertiesGroup.
                AddControl(linkNameTextboxID, textboxCT, "Link Name", leftAlign, readonlyOptions, "The name of this link");
            //Setup and create the label for the model type texbox
            modelTypeLabel = (PropertyManagerPageLabel)linkPropertiesGroup.
                AddControl(modelTypeLabelID, labelCT, "Model:", leftAlign, controlOptions, "The current model type");
            //Setup and create the model type textbox
            modelTypeTextbox = (PropertyManagerPageTextbox)linkPropertiesGroup.
                AddControl(modelTypeTextboxID, textboxCT, "Model", leftAlign, readonlyOptions, "The current model type");
            //Setup and create the label for the sw configuration texbox
            swConfigLabel = (PropertyManagerPageLabel)linkPropertiesGroup.
                AddControl(swConfigLabelID, labelCT, "Solidworks Configuration:", leftAlign, controlOptions, "The current Solidworks configuration");
            //Setup and create the sw configuration textbox
            swConfigTextbox = (PropertyManagerPageTextbox)linkPropertiesGroup.
                AddControl(swConfigTextboxID, textboxCT, "Solidworks Configuration", leftAlign, readonlyOptions, "The current Solidworks configuration");

            isEmptyCheckbox = (PropertyManagerPageCheckbox)linkPropertiesGroup.
                AddControl(isEmptyCheckboxID, checkboxCT, "No " + ((ModelConfiguration.ModelConfigType)currentModelConfig) + " model for this link", leftAlign, controlOptions, "Check to make this model have no components");
            ((PropertyManagerPageControl)isEmptyCheckbox).Visible = (currentModelConfig == (int)ModelConfiguration.ModelConfigType.Collision);

            //Setup and create the label for the link components selection box
            linkComponentsLabel = (PropertyManagerPageLabel)linkPropertiesGroup.
                AddControl(linkComponentsLabelID, labelCT, "Link Components", leftAlign, controlOptions, "Use this box to select components that are part of this link");

            //Setup and create the link components selection box
            linkComponentsSelectionbox = (PropertyManagerPageSelectionbox)linkPropertiesGroup.
                AddControl(linkComponentsSelectionboxID, selectionboxCT, "Link Components", leftAlign, controlOptions, "Use this box to select components that are part of this link");
            linkComponentsSelectionbox.Height = 75;
            linkComponentsSelectionbox.Mark = 2;
            int[] filter = { (int)swSelectType_e.swSelCOMPONENTS };
            linkComponentsSelectionbox.SetSelectionFilters(filter);
            linkComponentsSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem3);
            //linkComponentsSelectionbox.SetSelectionColor(false, (int) null);
        }
Exemplo n.º 9
0
        //The following runs when a new instance of the class is created
        public URDFExporterPM(SldWorks swAppPtr)
        {
            swApp = swAppPtr;
            ActiveSWModel = swApp.ActiveDoc;
            Exporter = new URDFExporter(swApp);
            Exporter.mRobot = new robot();
            Exporter.mRobot.name = ActiveSWModel.GetTitle();

            linksToVisit = new List<link>();
            docMenu = new ContextMenuStrip();

            string PageTitle = null;
            string caption = null;
            string tip = null;
            long options = 0;
            int longerrors = 0;
            int controlType = 0;
            int alignment = 0;
            string[] listItems = new string[4];

            ActiveSWModel.ShowConfiguration2("URDF Export");

            #region Create and instantiate components of PM page
            //Set the variables for the page
            PageTitle = "URDF Exporter";
            //options = (int)swPropertyManagerButtonTypes_e.swPropertyManager_OkayButton + (int)swPropertyManagerButtonTypes_e.swPropertyManager_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_LockedPage + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_PushpinButton;
            options = (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_HandleKeystrokes;

            //Create the PropertyManager page
            pm_Page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage(PageTitle, (int)options, this, ref longerrors);

            //Make sure that the page was created properly
            if (longerrors == (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
            {
                setupPropertyManagerPage(ref caption, ref tip, ref options, ref controlType, ref alignment);
            }

            else
            {
                //If the page is not created
                System.Windows.Forms.MessageBox.Show("An error occurred while attempting to create the " + "PropertyManager Page");
            }

            #endregion
        }
        /// <summary>
        /// Creates the property manager page and populates it with controls
        /// </summary>
        private void SetupPage()
        {
            //Helper variables
            int options;
            short controlType, align;
            int errors = 0;

            //Create a property manager page and throw exceptions if an error occurs
            page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage("Edit Links",
                                                                                   (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton,
                                                                                   this, ref errors);
            if (errors == -1) //Creation failed
                throw new InternalSolidworksException("SldWorks::CreatePropertyManagerPage", "Failed to create property manager page");
            else if (errors == -2) //No open document
                throw new ProgramErrorException("Tried to open a property manager page when no document was open");
            else if (errors == 1) //Invlaid hanlder
                throw new ProgramErrorException("Tried to pass in and invalid page hanlder when creating a property manager page");

            //Sets the page's message
            page.SetMessage3(infoMessage,
                                    (int)swPropertyManagerPageMessageVisibility.swMessageBoxVisible,
                                    (int)swPropertyManagerPageMessageExpanded.swMessageBoxExpand,
                                    "Message");
            linkTab = page.AddTab(linkTabID, "Links", "", 0);
            jointTab = page.AddTab(jointTabID, "Joint", "", 0);
            #region Select Group

            //Setup and create link selection group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            selectGroup = (PropertyManagerPageGroup)linkTab.AddGroupBox(selectGroupID, "Select Link", options);

            //Setup and create link colors checkbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Checkbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            linkColorCheckbox = (PropertyManagerPageCheckbox)selectGroup.AddControl(linkColorCheckboxID, controlType, "Color components by link", align, options, "Check to change all components that are part of links to the color of the link");
            linkColorCheckbox.Checked = false;

            //Setup and create the link selector form handle
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            linkSelectorHandle = (PropertyManagerPageWindowFromHandle)selectGroup.AddControl(linkSelectorHandleID, controlType, "Link Selector", align, options, "Select, add, remove, and edit links");
               // linkSelectorControl = new LinkSelector(robot);
            //linkSelectorControl.OnLinkSelectionChanged += this.OnLinkSelectionChanged;
            linkSelectorHandle.Height = 200;
            //linkSelectorHandle.SetWindowHandlex64(linkSelectorControl.Handle.ToInt64());
            //linkSelectorControl.OnEditLink += EditLink;

            #endregion

            #region Link Properties Group

            //Setup and create the link properties group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            linkPropertiesGroup = (PropertyManagerPageGroup)linkTab.AddGroupBox(linkPropertiesGroupID, "Link Properties", options);

            //Setup and create the label for the link name texbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            linkNameLabel = (PropertyManagerPageLabel)linkPropertiesGroup.AddControl(linkNameLabelID, controlType, "Link Name", align, options, "Change the name of this link");

            //Setup and create the link name textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            linkNameTextbox = (PropertyManagerPageTextbox)linkPropertiesGroup.AddControl(linkNameTextboxID, controlType, "Link Name", align, options, "Enter the name for this link here");

            //Setup and create the label for the link components selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            linkComponentsLabel = (PropertyManagerPageLabel)linkPropertiesGroup.AddControl(linkComponentsLabelID, controlType, "Link Components", align, options, "Use this box to select components that are part of this link");

            //Setup and create the link components selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            linkComponentsSelectionbox = (PropertyManagerPageSelectionbox)linkPropertiesGroup.AddControl(linkComponentsSelectionboxID, controlType, "Link Components", align, options, "Use this box to select components that are part of this link");
            linkComponentsSelectionbox.Height = 75;
            linkComponentsSelectionbox.Mark = 2;
            int[] filter = { (int)swSelectType_e.swSelCOMPONENTS };
            linkComponentsSelectionbox.SetSelectionFilters(filter);

            #endregion

            #region Joint Properties Group

            //Setup and create the joint properties group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            jointPropertiesGroup = (PropertyManagerPageGroup)jointTab.AddGroupBox(jointPropertiesGroupID, "Joint Properties", options);

            //Setup and create the label for the joint type combobox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointTypeLabel = (PropertyManagerPageLabel)jointPropertiesGroup.AddControl(linkNameLabelID, controlType, "Joint Type", align, options, "Change the name of this link");

            //Setup and create the label for the joint type combobox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointTypeCombobox = (PropertyManagerPageCombobox)jointPropertiesGroup.AddControl(linkNameLabelID, controlType, "Joint Type", align, options, "Change the name of this link");
            jointTypeCombobox.AddItems(Joint.JointTypes);

            //Setup and create the label for the joint axis 1 selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointAxis1Label = (PropertyManagerPageLabel)jointPropertiesGroup.AddControl(linkNameLabelID, controlType, "Axis 1", align, options, "Select an axis for this joint");

            //Setup and create the joint axis 1 selectionbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointAxis1Selectionbox = (PropertyManagerPageSelectionbox)jointPropertiesGroup.AddControl(jointAxis1SelectionboxID, controlType, "Axis 1", align, options, "Use this box to select the axis of movment of this joint");
            jointAxis1Selectionbox.AllowSelectInMultipleBoxes = false;
            jointAxis1Selectionbox.SingleEntityOnly = true;
            jointAxis1Selectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            jointAxis1Selectionbox.Mark = 4;
            int[] filter2 = {(int) swSelectType_e.swSelDATUMAXES, (int)swSelectType_e.swSelEDGES };
            jointAxis1Selectionbox.SetSelectionFilters(filter2);

            //Setup and create the axis flip checkbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Checkbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            flipAxisDirectionCheckbox = (PropertyManagerPageCheckbox)jointPropertiesGroup.AddControl(flipAxisDirectionCheckboxID, controlType, "flipAxisDirection", align, options, "Check to flip the direction of movement for this joint");
            flipAxisDirectionCheckbox.Checked = false;

            //Setup and create the joint Movement Limits properties group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            jointMovementLimitsGroup = (PropertyManagerPageGroup)jointTab.AddGroupBox(jointMovementLimitsGroupID, "Joint Movement Limits", options);

            //Setup and create joint lower edgelabel
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLinkLowerEdgeLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Lower Link Edge", align, options, "Select a lower edge for this joint");

            //setup and create joint lower edge selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLinkLowerEdgeSelectionbox = (PropertyManagerPageSelectionbox)jointMovementLimitsGroup.AddControl(jointLinkLowerEdgeSelectionboxID, controlType, "Lower Link Edge", align, options, "Use this box to select the lower edge of the link");
            jointLinkLowerEdgeSelectionbox.AllowSelectInMultipleBoxes = false;
            jointLinkLowerEdgeSelectionbox.SingleEntityOnly = true;
            jointLinkLowerEdgeSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            jointLinkLowerEdgeSelectionbox.Mark = 8;
            int[] filter3 = { (int)swSelectType_e.swSelDATUMAXES, (int)swSelectType_e.swSelEDGES, (int)swSelectType_e.swSelFACES, (int)swSelectType_e.swSelVERTICES, (int)swSelectType_e.swSelDATUMPLANES, (int)swSelectType_e.swSelDATUMPOINTS };
            jointLinkLowerEdgeSelectionbox.SetSelectionFilters(filter3);

            //Setup and create joint lower limit stop label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLowerLimitStopLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Lower Motion Limit", align, options, "Select a lower limit for this joint");

            //setup and create joint lower limit selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLowerLimitStopSelectionbox = (PropertyManagerPageSelectionbox)jointMovementLimitsGroup.AddControl(jointLowerLimitStopSelectionboxID, controlType, "LowerMotionLimit", align, options, "Use this box to select the lower limit of the link");
            jointLowerLimitStopSelectionbox.AllowSelectInMultipleBoxes = false;
            jointLowerLimitStopSelectionbox.SingleEntityOnly = true;
            jointLowerLimitStopSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem3);
            jointLowerLimitStopSelectionbox.Mark = 16;
            jointLowerLimitStopSelectionbox.SetSelectionFilters(filter3);

            //Setup and create joint upper edgelabel
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLinkUpperEdgeLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Upper Link Edge", align, options, "Select a Upper edge for this joint");

            //setup and create joint Upper edge selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLinkUpperEdgeSelectionbox = (PropertyManagerPageSelectionbox)jointMovementLimitsGroup.AddControl(jointLinkUpperEdgeSelectionboxID, controlType, "Upper Link Edge", align, options, "Use this box to select the upper edge of the link");
            jointLinkUpperEdgeSelectionbox.AllowSelectInMultipleBoxes = false;
            jointLinkUpperEdgeSelectionbox.SingleEntityOnly = true;
            jointLinkUpperEdgeSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem2);
            jointLinkUpperEdgeSelectionbox.Mark = 32;
            jointLinkUpperEdgeSelectionbox.SetSelectionFilters(filter3);

            //Setup and create joint Upper limit stop label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointUpperLimitStopLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Upper Motion Limit", align, options, "Select an Upper limit for this joint");

            //Setup and create joint upper limit selectionbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointUpperLimitStopSelectionbox = (PropertyManagerPageSelectionbox)jointMovementLimitsGroup.AddControl(jointUpperLimitStopSelectionboxID, controlType, "Upper Motion Limit", align, options, "Use this box to select the upper limit of the joint");
            jointUpperLimitStopSelectionbox.AllowSelectInMultipleBoxes = false;
            jointUpperLimitStopSelectionbox.SingleEntityOnly = true;
            jointUpperLimitStopSelectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem3);
            jointUpperLimitStopSelectionbox.Mark = 64;
            jointUpperLimitStopSelectionbox.SetSelectionFilters(filter3);

            //Setup and create manual limit checkbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Checkbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointManualLimitsCheckbox = (PropertyManagerPageCheckbox)jointMovementLimitsGroup.AddControl(jointManualLimitsCheckboxID, controlType, "Set manual values for limits", align, options, "Check to manually set limit offsets from current position");
            jointManualLimitsCheckbox.Checked = false;

            //Setup and create joint lower limit label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLowerLimitLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Lower limit", align, options, "Select a lower limit for this joint");

            //Setup and create the joint lower limit Textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            jointLowerLimitTextbox = (PropertyManagerPageTextbox)jointMovementLimitsGroup.AddControl(jointLowerLimitTextboxID, controlType, "0.0", align, options, "Enter the lower limit of the joint");

            //Setup and create joint upper limit label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            jointUpperLimitLabel = (PropertyManagerPageLabel)jointMovementLimitsGroup.AddControl(linkNameLabelID, controlType, "Upper limit", align, options, "Select an upper limit for this joint");

            //Setup and create the joint upper limit Textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            jointUpperLimitTextbox = (PropertyManagerPageTextbox)jointMovementLimitsGroup.AddControl(jointUpperLimitTextboxID, controlType, "0.0", align, options, "Enter the upper limit of the joint");

            //Create the joint physical properties group
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded |
                      (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;
            jointPhysicalPropertiesGroup = (PropertyManagerPageGroup)jointTab.AddGroupBox(jointPhysicalPropertiesGroupID, "Joint Physical Properties", options);

            //Setup and create joint effort limit label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointEffortLimitLabel = (PropertyManagerPageLabel)jointPhysicalPropertiesGroup.AddControl(linkNameLabelID, controlType, "Effort limit", align, options, "Select an effort limit for this joint");

            //Setup and create the joint effort limit textbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointEffortLimitTextbox = (PropertyManagerPageTextbox)jointPhysicalPropertiesGroup.AddControl(jointEffortLimitTextboxID, controlType, "0.0", align, options, "Enter the effort limit of the joint");

            //Setup and create joint velocity limit label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointVelocityLimitLabel = (PropertyManagerPageLabel)jointPhysicalPropertiesGroup.AddControl(linkNameLabelID, controlType, "Velocity limit", align, options, "Select a velocity limit for this joint");

            //Setup and create the joint velocity limit selectionbox
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            align = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointVelocityLimitTextbox = (PropertyManagerPageTextbox)jointPhysicalPropertiesGroup.AddControl(jointVelocityLimitTextboxID, controlType, "0.0", align, options, "Enter the velocity limit of the joint");

            /*
            //Setup and create the label for the joint axis 2 selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            leftAlign = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                       (int)swAddControlOptions_e.swControlOptions_Visible;
            jointAxis2Label = (PropertyManagerPageLabel)jointPropertiesGroup.AddControl(linkNameLabelID, controlType, "Axis 2", leftAlign, options, "Select an axis for this joint");

            //Setup and create the joint axis 2 selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            leftAlign = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Enabled |
                    (int)swAddControlOptions_e.swControlOptions_Visible;
            jointAxis2Selectionbox = (PropertyManagerPageSelectionbox)jointPropertiesGroup.AddControl(jointAxis2SelectionboxID, controlType, "Link Components", leftAlign, options, "Use this box to select components that are part of this link");
            jointAxis2Selectionbox.AllowSelectInMultipleBoxes = false;
            jointAxis2Selectionbox.SingleEntityOnly = true;
            jointAxis2Selectionbox.SetSelectionColor(true, (int)swUserPreferenceIntegerValue_e.swSystemColorsSelectedItem4);
            jointAxis2Selectionbox.Mark = 8;
            jointAxis2Selectionbox.SetSelectionFilters(filter2);
            */
            #endregion
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates the property manager page and populates it with controls
        /// </summary>
        private void SetupPage()
        {
            int errors = 0;

            //Create a property manager page and throw exceptions if an error occurs
            page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage("Edit Joint: " + currentJoint.Name,
                                                                                   (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton,
                                                                                   this, ref errors);
            if (errors == -1) //Creation failed
                throw new InternalSolidworksException("SldWorks::CreatePropertyManagerPage", "Failed to create property manager page");
            else if (errors == -2) //No open document
                throw new ProgramErrorException("Tried to open a property manager page when no document was open");
            else if (errors == 1) //Invlaid hanlder
                throw new ProgramErrorException("Tried to pass in and invalid page hanlder when creating a property manager page");
        }