Dimension on RebarShape.
예제 #1
0
        /// <summary>
        /// Add a constraint to RebarShapeDefinition.
        /// </summary>
        /// <param name="constraintType">Type of constraint
        /// (the class must be subclass of ConstraintOnRebarShape).</param>
        /// <returns></returns>
        public ConstraintOnRebarShape AddConstraint(Type constraintType)
        {
            ConstraintOnRebarShape constraintIns =
                Activator.CreateInstance(constraintType, this) as ConstraintOnRebarShape;

            m_constraints.Add(constraintIns);
            return(constraintIns);
        }
예제 #2
0
        /// <summary>
        /// Present a dialog to add a constraint to RebarShapeDef.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addConstraintButton_Click(object sender, EventArgs e)
        {
            using (AddConstraint addConstraint = new AddConstraint(m_rebarShapeDef.AllowedConstraintTypes()))
            {
                if (DialogResult.OK == addConstraint.ShowDialog())
                {
                    Type constraintType = addConstraint.ConstraintType;

                    // Add the constraint to RebarShapeDef.
                    ConstraintOnRebarShape constraint = m_rebarShapeDef.AddConstraint(constraintType);
                    propertyGrid.SelectedObject = constraint;
                    m_constraintsListBoxBinding.ResetBindings(false);
                    constraintListBox.SelectedItem = constraint;
                }
            }
        }