/// <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();
        }
        /// <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);
        }
Example #4
0
        //A method that sets up the Property Manager Page
        private void setupPropertyManagerPage(ref string caption, ref string tip, ref long options, ref int controlType, ref int alignment)
        {
            //Begin adding the controls to the page
            //Create the group box
            caption = "Configure and Organize Links";
            options = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible + (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded;
            pm_Group = (PropertyManagerPageGroup)pm_Page.AddGroupBox(GroupID, caption, (int)options);

            //Create the parent link label (static)
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Parent Link";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ParentLinkLabel = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, "");

            //Create the parent link name label, the one that is updated
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ParentLink = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, "");

            //Create the link name text box label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Link Name";
            tip = "Enter the name of the link";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_LinkName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the link name text box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            caption = "base_link";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip = "Enter the name of the link";
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_TextBox_LinkName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip);

            //Create the joint name text box label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Joint Name";
            tip = "Enter the name of the joint";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_JointName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_JointName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the joint name text box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            caption = "";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip = "Enter the name of the joint";
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_TextBox_JointName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip);

            //Create the global origin coordinate sys label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Global Origin Coordinate System";
            tip = "Select the reference coordinate system for the global origin";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_GlobalCoordsys = (PropertyManagerPageLabel)pm_Group.AddControl(ID_Label_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip);

            // Create pull down menu for Coordinate systems
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption = "Global Origin Coordinate System Name";
            tip = "Select the reference coordinate system for the global origin";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_GlobalCoordsys = (PropertyManagerPageCombobox)pm_Group.AddControl(ID_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_GlobalCoordsys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;

            //Create the ref coordinate sys label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Reference Coordinate System";
            tip = "Select the reference coordinate system for the joint origin";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = 0;
            pm_Label_CoordSys = (PropertyManagerPageLabel)pm_Group.AddControl(Label_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            // Create pull down menu for Coordinate systems
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption = "Reference Coordinate System Name";
            tip = "Select the reference coordinate system for the joint origin";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = 0;
            pm_ComboBox_CoordSys = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_CoordSys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;

            //Create the ref axis label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Reference Axis";
            tip = "Select the reference axis for the joint";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_Axes = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            // Create pull down menu for axes
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption = "Reference Axis Name";
            tip = "Select the reference axis for the joint";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_Axes = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_Axes.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;

            //Create the joint type label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Joint Type";
            tip = "Select the joint type";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_JointType = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            // Create pull down menu for joint type
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption = "Joint type";
            tip = "Select the joint type";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_JointType = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_JointType.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;
            pm_ComboBox_JointType.AddItems(new string[] { "Automatically Detect", "continuous", "revolute", "prismatic", "fixed" });

            //Create the selection box label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Link Components";
            tip = "Select components associated with this link";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_Selection = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create selection box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            caption = "Link Components";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            tip = "Select components associated with this link";
            pm_Selection = (PropertyManagerPageSelectionbox)pm_Group.AddControl(SelectionID, (short)controlType, caption, (short)alignment, (int)options, tip);

            swSelectType_e[] filters = new swSelectType_e[1];
            filters[0] = swSelectType_e.swSelCOMPONENTS;
            object filterObj = null;
            filterObj = filters;

            pm_Selection.AllowSelectInMultipleBoxes = true;
            pm_Selection.SingleEntityOnly = false;
            pm_Selection.AllowMultipleSelectOfSameEntity = false;
            pm_Selection.Height = 50;
            pm_Selection.SetSelectionFilters(filterObj);

            //Create the number box label
            //Create the link name text box label
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption = "Number of child links";
            tip = "Enter the number of child links and they will be automatically added";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ChildCount = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the number box
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Numberbox;
            caption = "";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip = "Enter the number of child links and they will be automatically added";
            options = (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_NumberBox_ChildCount = pm_Group.AddControl(NumBox_ChildCount_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_NumberBox_ChildCount.SetRange2((int)swNumberboxUnitType_e.swNumberBox_UnitlessInteger, 0, int.MaxValue, true, 1, 1, 1);
            pm_NumberBox_ChildCount.Value = 0;

            //pm_Button_save = pm_Group.AddControl(Button_save_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Build Link", 0, (int)options, "");
            pm_Button_export = pm_Group.AddControl(Button_export_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Preview and Export...", 0, (int)options, "");

            controlType = (int)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle;
            caption = "Link Tree";
            alignment = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_tree = pm_Page.AddControl(dotNet_tree, (short)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle, caption, 0, (int)options, "");
            pm_tree.Height = 163;
            tree = new TreeView();
            tree.Height = 163;
            tree.Visible = true;
            tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(tree_AfterSelect);
            tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(tree_NodeMouseClick);
            tree.KeyDown += new System.Windows.Forms.KeyEventHandler(tree_KeyDown);
            tree.DragDrop += new DragEventHandler(tree_DragDrop);
            tree.DragOver += new DragEventHandler(tree_DragOver);
            tree.DragEnter += new DragEventHandler(tree_DragEnter);
            tree.ItemDrag += new ItemDragEventHandler(tree_ItemDrag);
            tree.AllowDrop = true;
            pm_tree.SetWindowHandlex64(tree.Handle.ToInt64());

            ToolStripMenuItem addChild = new ToolStripMenuItem();
            ToolStripMenuItem removeChild = new ToolStripMenuItem();
            //ToolStripMenuItem renameChild = new ToolStripMenuItem();
            addChild.Text = "Add Child Link";
            addChild.Click += new System.EventHandler(this.addChild_Click);

            removeChild.Text = "Remove";
            removeChild.Click += new System.EventHandler(this.removeChild_Click);
            //renameChild.Text = "Rename";
            //renameChild.Click += new System.EventHandler(this.renameChild_Click);
               //docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild, renameChild });
            docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild});
            LinkNode node = createEmptyNode(null);
            node.ContextMenuStrip = docMenu;
            tree.Nodes.Add(node);
            tree.SelectedNode = tree.Nodes[0];
            pm_Selection.SetSelectionFocus();
            pm_Page.SetFocus(dotNet_tree);
            //updateNodeNames(tree);
        }
        /// <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
        }
Example #6
0
        //A method that sets up the Property Manager Page
        private void setupPropertyManagerPage(ref string caption, ref string tip, ref long options, ref int controlType, ref int alignment)
        {
            //Begin adding the controls to the page
            //Create the group box
            caption  = "Configure and Organize Links";
            options  = (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Visible + (int)swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded;
            pm_Group = (PropertyManagerPageGroup)pm_Page.AddGroupBox(GroupID, caption, (int)options);

            //Create the parent link label (static)
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption     = "Parent Link";
            alignment   = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options     = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ParentLinkLabel = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, "");

            //Create the parent link name label, the one that is updated
            controlType         = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption             = "";
            alignment           = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options             = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ParentLink = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, "");

            //Create the link name text box label
            controlType       = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption           = "Link Name";
            tip               = "Enter the name of the link";
            alignment         = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options           = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_LinkName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the link name text box
            controlType         = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            caption             = "base_link";
            alignment           = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip                 = "Enter the name of the link";
            options             = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_TextBox_LinkName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip);


            //Create the joint name text box label
            controlType        = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption            = "Joint Name";
            tip                = "Enter the name of the joint";
            alignment          = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options            = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_JointName = (PropertyManagerPageLabel)pm_Group.AddControl(Label_JointName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the joint name text box
            controlType          = (int)swPropertyManagerPageControlType_e.swControlType_Textbox;
            caption              = "";
            alignment            = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip                  = "Enter the name of the joint";
            options              = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_TextBox_JointName = (PropertyManagerPageTextbox)pm_Group.AddControl(TextBox_LinkNameID, (short)(controlType), caption, (short)alignment, (int)options, tip);

            //Create the global origin coordinate sys label
            controlType             = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption                 = "Global Origin Coordinate System";
            tip                     = "Select the reference coordinate system for the global origin";
            alignment               = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options                 = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_GlobalCoordsys = (PropertyManagerPageLabel)pm_Group.AddControl(ID_Label_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip);


            // Create pull down menu for Coordinate systems
            controlType = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption     = "Global Origin Coordinate System Name";
            tip         = "Select the reference coordinate system for the global origin";
            alignment   = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options     = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_GlobalCoordsys       = (PropertyManagerPageCombobox)pm_Group.AddControl(ID_GlobalCoordsys, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_GlobalCoordsys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;



            //Create the ref coordinate sys label
            controlType       = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption           = "Reference Coordinate System";
            tip               = "Select the reference coordinate system for the joint origin";
            alignment         = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options           = 0;
            pm_Label_CoordSys = (PropertyManagerPageLabel)pm_Group.AddControl(Label_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);


            // Create pull down menu for Coordinate systems
            controlType                = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption                    = "Reference Coordinate System Name";
            tip                        = "Select the reference coordinate system for the joint origin";
            alignment                  = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options                    = 0;
            pm_ComboBox_CoordSys       = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_CoordSys.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;

            //Create the ref axis label
            controlType   = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption       = "Reference Axis";
            tip           = "Select the reference axis for the joint";
            alignment     = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options       = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_Axes = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip);


            // Create pull down menu for axes
            controlType            = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption                = "Reference Axis Name";
            tip                    = "Select the reference axis for the joint";
            alignment              = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options                = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_Axes       = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_Axes.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;

            //Create the joint type label
            controlType        = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption            = "Joint Type";
            tip                = "Select the joint type";
            alignment          = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options            = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_Label_JointType = (PropertyManagerPageLabel)pm_Group.AddControl(Label_Axes_ID, (short)controlType, caption, (short)alignment, (int)options, tip);


            // Create pull down menu for joint type
            controlType                 = (int)swPropertyManagerPageControlType_e.swControlType_Combobox;
            caption                     = "Joint type";
            tip                         = "Select the joint type";
            alignment                   = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options                     = (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_ComboBox_JointType       = (PropertyManagerPageCombobox)pm_Group.AddControl(ComboBox_CoordSys_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_ComboBox_JointType.Style = (int)swPropMgrPageComboBoxStyle_e.swPropMgrPageComboBoxStyle_EditBoxReadOnly;
            pm_ComboBox_JointType.AddItems(new string[] { "Automatically Detect", "continuous", "revolute", "prismatic", "fixed" });


            //Create the selection box label
            controlType        = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption            = "Link Components";
            tip                = "Select components associated with this link";
            alignment          = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options            = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_Selection = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create selection box
            controlType  = (int)swPropertyManagerPageControlType_e.swControlType_Selectionbox;
            caption      = "Link Components";
            alignment    = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            options      = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            tip          = "Select components associated with this link";
            pm_Selection = (PropertyManagerPageSelectionbox)pm_Group.AddControl(SelectionID, (short)controlType, caption, (short)alignment, (int)options, tip);

            swSelectType_e[] filters = new swSelectType_e[1];
            filters[0] = swSelectType_e.swSelCOMPONENTS;
            object filterObj = null;

            filterObj = filters;

            pm_Selection.AllowSelectInMultipleBoxes      = true;
            pm_Selection.SingleEntityOnly                = false;
            pm_Selection.AllowMultipleSelectOfSameEntity = false;
            pm_Selection.Height = 50;
            pm_Selection.SetSelectionFilters(filterObj);

            //Create the number box label
            //Create the link name text box label
            controlType         = (int)swPropertyManagerPageControlType_e.swControlType_Label;
            caption             = "Number of child links";
            tip                 = "Enter the number of child links and they will be automatically added";
            alignment           = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options             = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_Label_ChildCount = (PropertyManagerPageLabel)pm_Group.AddControl(Label_LinkName_ID, (short)controlType, caption, (short)alignment, (int)options, tip);

            //Create the number box
            controlType             = (int)swPropertyManagerPageControlType_e.swControlType_Numberbox;
            caption                 = "";
            alignment               = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent;
            tip                     = "Enter the number of child links and they will be automatically added";
            options                 = (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible;
            pm_NumberBox_ChildCount = pm_Group.AddControl(NumBox_ChildCount_ID, (short)controlType, caption, (short)alignment, (int)options, tip);
            pm_NumberBox_ChildCount.SetRange2((int)swNumberboxUnitType_e.swNumberBox_UnitlessInteger, 0, int.MaxValue, true, 1, 1, 1);
            pm_NumberBox_ChildCount.Value = 0;

            //pm_Button_save = pm_Group.AddControl(Button_save_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Build Link", 0, (int)options, "");
            pm_Button_export = pm_Group.AddControl(Button_export_ID, (short)swPropertyManagerPageControlType_e.swControlType_Button, "Preview and Export...", 0, (int)options, "");

            controlType          = (int)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle;
            caption              = "Link Tree";
            alignment            = (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge;
            options              = (int)swAddControlOptions_e.swControlOptions_Visible + (int)swAddControlOptions_e.swControlOptions_Enabled;
            pm_tree              = pm_Page.AddControl(dotNet_tree, (short)swPropertyManagerPageControlType_e.swControlType_WindowFromHandle, caption, 0, (int)options, "");
            pm_tree.Height       = 163;
            tree                 = new TreeView();
            tree.Height          = 163;
            tree.Visible         = true;
            tree.AfterSelect    += new System.Windows.Forms.TreeViewEventHandler(tree_AfterSelect);
            tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(tree_NodeMouseClick);
            tree.KeyDown        += new System.Windows.Forms.KeyEventHandler(tree_KeyDown);
            tree.DragDrop       += new DragEventHandler(tree_DragDrop);
            tree.DragOver       += new DragEventHandler(tree_DragOver);
            tree.DragEnter      += new DragEventHandler(tree_DragEnter);
            tree.ItemDrag       += new ItemDragEventHandler(tree_ItemDrag);
            tree.AllowDrop       = true;
            pm_tree.SetWindowHandlex64(tree.Handle.ToInt64());

            ToolStripMenuItem addChild    = new ToolStripMenuItem();
            ToolStripMenuItem removeChild = new ToolStripMenuItem();

            //ToolStripMenuItem renameChild = new ToolStripMenuItem();
            addChild.Text   = "Add Child Link";
            addChild.Click += new System.EventHandler(this.addChild_Click);

            removeChild.Text   = "Remove";
            removeChild.Click += new System.EventHandler(this.removeChild_Click);
            //renameChild.Text = "Rename";
            //renameChild.Click += new System.EventHandler(this.renameChild_Click);
            //docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild, renameChild });
            docMenu.Items.AddRange(new ToolStripMenuItem[] { addChild, removeChild });
            LinkNode node = createEmptyNode(null);

            node.ContextMenuStrip = docMenu;
            tree.Nodes.Add(node);
            tree.SelectedNode = tree.Nodes[0];
            pm_Selection.SetSelectionFocus();
            pm_Page.SetFocus(dotNet_tree);
            //updateNodeNames(tree);
        }