public override List <InputDefinition> DefineInput()
        {
            // create new instance of TSMUI.Picker and input definition list
            TSMUI.Picker           anglePicker = new TSMUI.Picker();
            List <InputDefinition> InputList   = new List <InputDefinition>();
            // create array list to hold plates for input
            ArrayList PlateList = new ArrayList();

            try
            {
                // Prompt user to pick 4 plates
                _plate1 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate;
                _plate2 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate;
                _plate3 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate;
                _plate4 = anglePicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as TSM.ContourPlate;

                // Get coordinate system for first plate
                _classModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TSM.TransformationPlane(_plate1.GetCoordinateSystem()));

                // Prompt user to pick points
                _point1 = anglePicker.PickPoint() as T3D.Point;
                _point2 = anglePicker.PickPoint() as T3D.Point;
                _point3 = anglePicker.PickPoint() as T3D.Point;
                _point4 = anglePicker.PickPoint() as T3D.Point;

                // Add plates to array list
                PlateList.Add(_plate1.Identifier);
                PlateList.Add(_plate2.Identifier);
                PlateList.Add(_plate3.Identifier);
                PlateList.Add(_plate4.Identifier);

                // Create inputs to InputDefinition list.
                InputDefinition Input1 = new InputDefinition(_point1);
                InputDefinition Input2 = new InputDefinition(_point2);
                InputDefinition Input3 = new InputDefinition(_point3);
                InputDefinition Input4 = new InputDefinition(_point4);
                InputDefinition Input5 = new InputDefinition(PlateList);

                // Add inputs to InputDefinition list.
                InputList.Add(Input1);
                InputList.Add(Input2);
                InputList.Add(Input3);
                InputList.Add(Input4);
                InputList.Add(Input5);
            }
            catch (Exception ex)
            {
                throw;
            }

            return(InputList);
        }
Пример #2
0
        public static Point PickAPoint(string prompt = "Pick a point")
        {
            Point myPoint = null;

            try
            {
                var picker = new UI.Picker();
                myPoint = picker.PickPoint(prompt);
            }
            catch (Exception ex)
            {
                if (ex.Message != "User interrupt")
                {
                    Console.WriteLine(ex.Message + ex.StackTrace);
                }
            }

            return(myPoint);
        }
Пример #3
0
        public override List <InputDefinition> DefineInput()
        {
            // create new instance of TSMUI.Picker and input definition list
            TSMUI.Picker           columnPicker = new TSMUI.Picker();
            List <InputDefinition> InputList    = new List <InputDefinition>();


            try
            {
                // Get insertion point from user
                _insertionPoint = columnPicker.PickPoint() as T3D.Point;
                InputDefinition Input1 = new InputDefinition(_insertionPoint);
                InputList.Add(Input1);
            }
            catch (Exception ex)
            {
                throw;
            }

            return(InputList);
        }
Пример #4
0
        // button to create column
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            T3D.Point    firstPoint = null;               // insertion point for column
            TSMUI.Picker picker     = new TSMUI.Picker(); // new picker for user
            double       columnHeight;                    // height of column
            string       beamProfile = txtProfile.Text;   // profile for column / beam

            try
            {
                // try converting text in text box for column height to double
                columnHeight = Convert.ToDouble(txtColumnHeight.Text);
            }
            catch
            {
                // if column height conversion failed, set height to zero and display error message
                columnHeight = 0;
                MessageBox.Show("No column height was entered.");
            }

            try
            {
                // prompt user to pick points in model
                firstPoint = picker.PickPoint();

                // create new column modeler
                ColumnModeler myColumnModeler = new ColumnModeler(currentModel);

                // model column
                myColumnModeler.ModelColumn(firstPoint, columnHeight, beamProfile);
            }
            catch
            {
                // set pickedpoints to null
                firstPoint = null;

                // read error message to user
                MessageBox.Show("No insertion points were picked");
            }
        }