Example #1
0
        protected override void OnMouseDown(GetPointMouseEventArgs e)
        {
            if (m_radius_dc.PickResult.Mode != GumballMode.None || m_height_dc.PickResult.Mode != GumballMode.None)
            {
                return;
            }

            m_base_origin = Point3d.Unset;
            m_base_point  = Point3d.Unset;

            m_radius_dc.PickResult.SetToDefault();
            m_height_dc.PickResult.SetToDefault();

            var pick_context = new PickContext
            {
                View      = e.Viewport.ParentView,
                PickStyle = PickStyle.PointPick
            };

            var xform = e.Viewport.GetPickTransform(e.WindowPoint);

            pick_context.SetPickTransform(xform);

            Line pick_line;

            e.Viewport.GetFrustumLine(e.WindowPoint.X, e.WindowPoint.Y, out pick_line);

            pick_context.PickLine = pick_line;
            pick_context.UpdateClippingPlanes();

            // try picking one of the gumballs
            if (m_radius_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_cylinder.RadiusPlane.Origin;
                m_base_point  = e.Point;
            }
            else if (m_height_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_cylinder.HeightPlane.Origin;
                m_base_point  = e.Point;
            }
        }
Example #2
0
        protected override void OnMouseDown(GetPointMouseEventArgs e)
        {
            if (x_height_plus_dc.PickResult.Mode != GumballMode.None || x_height_minus_dc.PickResult.Mode != GumballMode.None ||
                y_height_plus_dc.PickResult.Mode != GumballMode.None || y_height_minus_dc.PickResult.Mode != GumballMode.None ||
                z_height_plus_dc.PickResult.Mode != GumballMode.None || z_height_minus_dc.PickResult.Mode != GumballMode.None)
            {
                return;
            }

            m_base_origin = Point3d.Unset;
            m_base_point  = Point3d.Unset;

            x_height_plus_dc.PickResult.SetToDefault();
            x_height_minus_dc.PickResult.SetToDefault();
            y_height_plus_dc.PickResult.SetToDefault();
            y_height_minus_dc.PickResult.SetToDefault();
            z_height_plus_dc.PickResult.SetToDefault();
            z_height_minus_dc.PickResult.SetToDefault();

            var pick_context = new PickContext
            {
                View      = e.Viewport.ParentView,
                PickStyle = PickStyle.PointPick
            };

            var xform = e.Viewport.GetPickTransform(e.WindowPoint);

            pick_context.SetPickTransform(xform);

            Line pick_line;

            e.Viewport.GetFrustumLine(e.WindowPoint.X, e.WindowPoint.Y, out pick_line);

            pick_context.PickLine = pick_line;

            // try picking one of the gumballs
            if (x_height_plus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.X_plus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }

            else if (x_height_minus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.X_minus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }

            else if (y_height_plus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.Y_plus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }

            else if (y_height_minus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.Y_minus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }
            else if (z_height_plus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.Z_plus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }

            else if (z_height_minus_dc.PickGumball(pick_context, this))
            {
                m_base_origin = m_Box.Z_minus_plane.ClosestPoint(m_Box.Center);
                m_base_point  = e.Point;
            }
        }