protected override void OnDynamicDraw(GetPointDrawEventArgs e) { IAction action = Core.Instance.Actions.CurrentAction; if (action != null) { PreviewParameters pParam; if (SelectionPoints == null) { Point3d basePt; TryGetBasePoint(out basePt); pParam = new PreviewParameters(true, null, FromRC.Convert(e.CurrentPoint), FromRC.Convert(basePt)); } else { IList <Vector> sPts = new List <Vector>(); foreach (Vector pt in SelectionPoints) { sPts.Add(pt); // Draw points: e.Display.DrawPoint(ToRC.Convert(pt), PointStyle.X, 3, System.Drawing.Color.Orange); } sPts.Add(FromRC.Convert(e.CurrentPoint)); pParam = new PreviewParameters(true, null, sPts); } DisplayLayer previewLayer = action.PreviewLayer(pParam); if (previewLayer != null) { var rParam = new RhinoRenderingParameters(e); previewLayer.Draw(rParam); } } base.OnDynamicDraw(e); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); if (From == Point3d.Unset) { return; } var cPlane = e.RhinoDoc.Views.ActiveView.ActiveViewport.ConstructionPlane(); Line = new Line(From, e.CurrentPoint); var yAxis = Vector3d.CrossProduct(Line.Direction, cPlane.ZAxis); if (Flip.CurrentValue) { yAxis.Reverse(); } var plane = new Plane(From, Line.Direction, yAxis); yAxis.Unitize(); var sideLength = Area.CurrentValue / Line.Length; Rectangle = new Rectangle3d(plane, Line.Length, sideLength); var color = e.RhinoDoc.Layers.CurrentLayer.Color; e.Display.DrawPolyline(Rectangle.ToPolyline(), color); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); Point3d Origin = new_brep.UserDictionary.GetPoint3d("CurrentPosition"); Vector3d OriginVector = new_brep.UserDictionary.GetVector3d("CurrentDirection"); Point3d currentpoint = e.CurrentPoint; Vector3d normal_on_mesh = base_mesh.NormalAt(base_mesh.ClosestMeshPoint(currentpoint, 0)); Brep moved_brep = new_brep.DuplicateBrep(); if (OriginVector.IsParallelTo(normal_on_mesh) == 0) { double RotationAngle = Vector3d.VectorAngle(OriginVector, normal_on_mesh); Vector3d RoationAxis = Vector3d.CrossProduct(OriginVector, normal_on_mesh); moved_brep.Rotate(RotationAngle, RoationAxis, Origin); } moved_brep.Translate(currentpoint - Origin); e.Display.DrawBrepWires(moved_brep, System.Drawing.Color.Red); Rhino.Display.DisplayMaterial material = new Rhino.Display.DisplayMaterial(System.Drawing.Color.Red); e.Display.DrawBrepShaded(moved_brep, material); moved_brep.Dispose(); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { m_Box.Draw(e.Display); // Disable default GetPoint drawing by not calling the base class // implementation. All aspects of gumball display are handled by // GumballDisplayConduit }
void FirstRotationPoint_DynamicDraw(object sender, GetPointDrawEventArgs e) { if (m_circle.IsValid) { System.Drawing.Color color = Rhino.ApplicationSettings.AppearanceSettings.TrackingColor; e.Display.DrawCircle(m_circle, color); } }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (CanDraw) { e.Display.DrawCircle(Circle, DrawColor); } base.OnDynamicDraw(e); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (m_circle.IsValid) { e.Display.DrawCircle(m_circle, AppearanceSettings.TrackingColor); } base.OnDynamicDraw(e); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); var cplane = e.RhinoDoc.Views.ActiveView.ActiveViewport.ConstructionPlane(); var radius = m_center_point.DistanceTo(e.CurrentPoint); var circle = new Circle(cplane, m_center_point, radius); e.Display.DrawCircle(circle, System.Drawing.Color.Black); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (ClosestPoint.IsValid) { e.Display.DrawPoint(ClosestPoint, AppearanceSettings.DefaultObjectColor); } // Do not call base class... //base.OnDynamicDraw(e); }
/// <summary> /// OnDynamicDraw override /// </summary> protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (m_draw) { foreach (var obj in m_objects) { e.Display.DrawObject(obj, m_xform); } } }
/// <summary> /// DynamicDraw event handler /// </summary> void OnDynamicDraw(object sender, GetPointDrawEventArgs e) { if (m_draw) { if (null != m_obj) { e.Display.DrawObject(m_obj, m_xform); } } }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); var xform = e.Viewport.GetTransform(CoordinateSystem.World, CoordinateSystem.Screen); var current_point = e.CurrentPoint; current_point.Transform(xform); var screen_point = new Point2d(current_point.X, current_point.Y); var msg = string.Format("screen {0:F}, {1:F}", current_point.X, current_point.Y); e.Display.Draw2dText(msg, System.Drawing.Color.Blue, screen_point, false); }
/// <summary> /// Draw the current offset and an arrow from the closest point on any of the polylines to the potential offset. /// </summary> /// <param name="e">Current argument for the event.</param> /// <example> /// <code source="examples\vbnet\ex_getpointdynamicdraw.vb" lang="vbnet" /> /// <code source="examples\cs\ex_getpointdynamicdraw.cs" lang="cs" /> /// <code source="examples\py\ex_getpointdynamicdraw.py" lang="py" /> /// </example> protected override void OnDynamicDraw(GetPointDrawEventArgs e) { // calculate closest point. if (!HasDynamicPreview) { return; } // enable dynamic preview; foreach (var polyline in _result) { e.Display.DrawPolyline(polyline, System.Drawing.Color.Blue, 2); } // draw the previous default/offset result base.OnDynamicDraw(e); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); if (From == Point3d.Unset) { return; } var cPlane = e.RhinoDoc.Views.ActiveView.ActiveViewport.ConstructionPlane(); var line = CalculateAndSetLines(From, e.CurrentPoint, cPlane); var color = e.RhinoDoc.Layers.CurrentLayer.Color; e.Display.DrawLine(LineLeft, color); e.Display.DrawLine(LineRight, color); e.Display.DrawDottedLine(line, color); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); Point3d current_point = e.CurrentPoint; Brep new_new_brep = RotateBrep(new_brep, base_mesh, current_point, start_point); Color color = My_object_functions.GetColor(new_new_brep); double radius = current_point.DistanceTo(center_point); Circle circle = new Circle(plane, center_point, radius); Line line1 = new Line(current_point, center_point); Line line2 = new Line(center_point, start_point - center_point, radius); e.Display.DrawBrepWires(new_new_brep, color); Rhino.Display.DisplayMaterial material = new Rhino.Display.DisplayMaterial(color); e.Display.DrawBrepShaded(new_new_brep, material); e.Display.DrawCircle(circle, System.Drawing.Color.Black); e.Display.DrawLine(line1, System.Drawing.Color.Black); //e.Display.DrawLine(line2, System.Drawing.Color.Black); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { base.OnDynamicDraw(e); Point3d current_point = e.CurrentPoint; List <Sphere> pin_ball_list; Brep new_new_brep = MoveBrep(new_brep, base_mesh, current_point, out pin_ball_list); Color color = My_object_functions.GetColor(new_new_brep); for (int i = 0; i < pin_ball_list.Count; i++) { e.Display.DrawSphere(pin_ball_list[i], System.Drawing.Color.Red); } e.Display.DrawBrepWires(new_new_brep, color); Rhino.Display.DisplayMaterial material = new Rhino.Display.DisplayMaterial(color); e.Display.DrawBrepShaded(new_new_brep, material); }
/// <summary> /// GetPoint.OnDynamicDraw override /// </summary> protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (m_draw_arrow && m_draw_arrow_point.IsValid) { var line = new Line(m_draw_arrow_point, e.CurrentPoint); if (line.IsValid) { if (m_show_simple_arrow) { var direction = line.To - line.From; direction.Unitize(); e.Display.DrawLine(line, DynamicDrawColor); e.Display.DrawDirectionArrow(line.To, direction, DynamicDrawColor); } else { e.Display.DrawArrow(line, DynamicDrawColor); } } } base.OnDynamicDraw(e); }
void DynamicDraw(object sender, GetPointDrawEventArgs e) { try { Point3d to = e.CurrentPoint; if (to.IsValid) { int toIndex = _crvTopology.GetClosestNode(to); if (toIndex != -1) { e.Display.DrawPoint(_crvTopology.VertexAt(toIndex), PointStyle.X, 7, Color.Azure); if (_fromIndex != -1 && toIndex != _fromIndex) { var c = _pathSearchMethod.Cross(_fromIndex, toIndex); if (c != null) { e.Display.DrawCurve(c, Color.Black, 3); } } } } if (_fromIndex != -1) { e.Display.DrawPoint(_crvTopology.VertexAt(_fromIndex), PointStyle.X, 7, Color.Azure); } } catch (Exception ex) { _getPoint.DynamicDraw -= DynamicDraw; RhinoApp.WriteLine("An error happened in the display pipeline: {0}, {1}", ex.GetType().Name, ex.Message); } }
void GetSecondRotationPoint_DynamicDraw(object sender, GetPointDrawEventArgs e) { if (Transform.IsValid && m_arc.IsValid) { System.Drawing.Color color = Rhino.ApplicationSettings.AppearanceSettings.DefaultObjectColor; e.Display.DrawArc(m_arc, color); Vector3d v0 = m_arc.StartPoint - m_arc.Center; v0 *= 1.5; e.Display.DrawLine(m_arc.Center, m_arc.Center + v0, color); v0 = m_arc.EndPoint - m_arc.Center; v0 *= 1.5; Vector3d v1 = (e.CurrentPoint - m_arc.Center); if (v1.SquareLength > v0.SquareLength) { v0 = v1; } e.Display.DrawLine(m_arc.Center, m_arc.Center + v0, color); e.Display.DrawPoint(m_arc.StartPoint, color); e.Display.DrawPoint(m_arc.Center, color); } }
void gp_DynamicDraw(object sender, GetPointDrawEventArgs e) { Point3d basePt; if (e.Source.TryGetBasePoint(out basePt)) { // Format distance as string double distance = basePt.DistanceTo(e.CurrentPoint); string text = string.Format("{0:0.000}", distance); // Get world-to-screen coordinate transformation Transform xform = e.Viewport.GetTransform(Rhino.DocObjects.CoordinateSystem.World, Rhino.DocObjects.CoordinateSystem.Screen); // Transform point from world to screen coordinates Point3d screenPt = xform * e.CurrentPoint; // Offset point so text does not overlap cursor screenPt.X += 5.0; screenPt.Y -= 5.0; // Draw the string e.Display.Draw2dText(text, Color.Black, new Point2d(screenPt.X, screenPt.Y), false); } }
/// <summary> /// Draw the current offset and an arrow from the closest point on any of the polylines to the potential offset. /// </summary> /// <param name="e"></param> protected override void OnDynamicDraw(GetPointDrawEventArgs e) { // calculate closest point. if (!HasDynamicPreview) { return; } Point3d cp = ClosestPoint(e.CurrentPoint); SetBasePoint(cp, true); Vector3d dir = e.CurrentPoint - cp; e.Display.DrawArrow(new Line(cp, dir), System.Drawing.Color.Brown); e.Display.DrawArrow(new Line(cp, -dir), System.Drawing.Color.Brown); // enable dynamic preview; foreach (var polyline in _offset) { e.Display.DrawPolyline(polyline, System.Drawing.Color.Blue, 2); } // draw the previous default/offset result base.OnDynamicDraw(e); }
protected override void OnDynamicDraw(GetPointDrawEventArgs e) { if (Transform.IsValid && m_arc.IsValid) { var color = Rhino.ApplicationSettings.AppearanceSettings.DefaultObjectColor; e.Display.DrawArc(m_arc, color); var v0 = m_arc.StartPoint - m_arc.Center; v0 *= 1.5; e.Display.DrawLine(m_arc.Center, m_arc.Center + v0, color); v0 = m_arc.EndPoint - m_arc.Center; v0 *= 1.5; var v1 = (e.CurrentPoint - m_arc.Center); if (v1.SquareLength > v0.SquareLength) { v0 = v1; } e.Display.DrawLine(m_arc.Center, m_arc.Center + v0, color); if (m_angle < 0.0) { e.Display.DrawPoint(m_arc.EndPoint, color); } else { e.Display.DrawPoint(m_arc.StartPoint, color); } e.Display.DrawPoint(m_arc.Center, color); Rhino.UI.StatusBar.SetPointPane(e.CurrentPoint); Rhino.UI.StatusBar.SetDistancePane(m_angle * 180.0 / Math.PI); } base.OnDynamicDraw(e); }
/// <summary> /// Get point converter /// </summary> /// <param name="args"></param> public RhinoRenderingParameters(GetPointDrawEventArgs args) : this((DrawEventArgs)args) { CursorPosition = FromRC.Convert(args.CurrentPoint); }