public override void OnPaint(ICADView iv, Display3D d3d) { if (this.ReturnStatus != CamBam.CAD.EditMode.ReturnStatusCode.Running) { return; } d3d.ModelTransform = Matrix4x4F.Identity; d3d.LineColor = Color.Chartreuse; d3d.DrawPoint(this.EditMode.CurrentPoint, 3f); if (!this.MoveSource.IsUndefined) { d3d.LineWidth = 0.0f; d3d.DrawPoint(this.MoveSource, 3f); if (!this.EditMode.CurrentPoint.IsUndefined) { Line3F line3F = new Line3F(this.MoveSource, this.EditMode.CurrentPoint); d3d.DrawLine(this.MoveSource, this.EditMode.CurrentPoint); PointF screen = this._ActiveView.DrawingToScreen(new Point3F((line3F.p1.X + line3F.p2.X) / 2.0, (line3F.p1.Y + line3F.p2.Y) / 2.0, (line3F.p1.Z + line3F.p2.Z) / 2.0)); if (this.Rr5GW2GfU == null) { this.Rr5GW2GfU = new Font(FontFamily.GenericSansSerif, 10f); } d3d.DrawText("moveDist=" + line3F.Length().ToString(), this.Rr5GW2GfU, Color.Chartreuse, Color.Transparent, (double)screen.X + 5.0, (double)screen.Y + 5.0, true); } } base.OnPaint(iv, d3d); }
public override void Paint(ICADView iv, Display3D d3d, Color arccolor, Color linecolor, bool selected) { // XXX: what this line for ? base._CADFile = iv.CADFile; if (_trajectories.Count == 0) { return; } foreach (Toolpath item in _toolpaths) { paint_toolpath(iv, d3d, arccolor, linecolor, item); } if (base._CADFile.ShowCutWidths) { paint_cut_widths(d3d); } if (base._CADFile.ShowRapids) { paint_rapids(d3d); } if (selected) { base.PaintStartPoint(iv, d3d); } }
private void paint_toolpath(ICADView iv, Display3D d3d, Color arccolor, Color linecolor, Toolpath path) { Polyline leadin = path.Leadin; Color chord_color = Color.FromArgb(128, CamBamConfig.Defaults.ToolpathRapidColor); if (leadin != null) { Matrix4x4F mx = new Matrix4x4F(); mx.Translate(0.0, 0.0, path.Bottom); if (Transform.Cached != null) { mx *= Transform.Cached; } d3d.ModelTransform = mx; d3d.LineWidth = 1F; leadin.Paint(d3d, arccolor, linecolor); base.PaintDirectionVector(iv, leadin, d3d, mx); } foreach (Sliced_path_item p in path.Trajectory) { Color acol = arccolor; Color lcol = linecolor; if (p.Item_type == Sliced_path_item_type.CHORD || p.Item_type == Sliced_path_item_type.SMOOTH_CHORD || p.Item_type == Sliced_path_item_type.SLICE_SHORTCUT) { if (!_should_draw_chords) { continue; } acol = chord_color; lcol = chord_color; } if (p.Item_type == Sliced_path_item_type.DEBUG_MEDIAL_AXIS) { acol = Color.Cyan; lcol = Color.Cyan; } Matrix4x4F mx = new Matrix4x4F(); mx.Translate(0.0, 0.0, path.Bottom); if (Transform.Cached != null) { mx *= Transform.Cached; } d3d.ModelTransform = mx; d3d.LineWidth = 1F; p.Paint(d3d, acol, lcol); base.PaintDirectionVector(iv, p, d3d, mx); } }
public ToolTraceEditmode(ICADView iv) : base(iv) { CreateTool(CamBamUI.MainUI.ActiveView.ActiveTool()); CreateLimits(); ProductionExpander.ToolChanged += ProductionExpander_ToolChanged; GRBLMachinePlugin.Position += GRBLMachinePlugin_Position; GRBLMachinePlugin.Speed += GRBLMachinePlugin_Speed; GRBLMachinePlugin.PropertyChanged += GRBLMachinePlugin_PropertyChanged; }
public MoveToLocationMode(ICADView iv) : base(iv) { this.MarkFileModified = false; this.EditMode = new PointSelectEditMode(iv); if (this.EditMode.ReturnStatus != CamBam.CAD.EditMode.ReturnStatusCode.Running) { this.ReturnStatus = this.EditMode.ReturnStatus; } else { this.MoveDestination = Point3F.Undefined; } }
// // ICADView // /// <summary> /// Extension to ZoomToFit /// /// Original does not take Toolpaths into account /// </summary> /// <param name="icadview"></param> public static void ZoomToFitEx(this ICADView icadview) { if (icadview.CADFile == null || icadview.ViewProjection == null) { return; } PointF empty = PointF.Empty; PointF point = PointF.Empty; Matrix4x4F matrix = new Matrix4x4F(icadview.ViewProjection.ViewMatrix4x4F); matrix.m[12] = 0; matrix.m[13] = 0; icadview.CADFile.GetScreenExtentsEx(ref empty, ref point, matrix); icadview.ViewProjection.ZoomToFitScreenPoints(empty, point); icadview.RefreshView(); }
/// <summary> /// Override for EditMode's OnPaint /// </summary> /// <param name="iv"></param> /// <param name="d3d"></param> public override void OnPaint(ICADView iv, Display3D d3d) { // paint the temporary replaced EditMode if (_orgEditMode != null) { _orgEditMode.OnPaint(iv, d3d); } // setup the drawing of the tool d3d.LineWidth = 2; if (GRBLMachinePlugin.Props.LaserModeEnable == EnabledDisabled.Enabled) { double transparency = GRBLMachinePlugin.Props.LaserTransparency; if (_rpm != 0) { transparency = 100f - (((double)_rpm / (double)GRBLMachinePlugin.Props.MaximumSpindleSpeed) * 100); } d3d.LineColor(Color.FromArgb((int)(255f * ((100f - transparency) / 100)), GRBLMachinePlugin.Props.LaserColor)); } else { d3d.LineColor(Color.FromArgb((int)(255f * ((100f - GRBLMachinePlugin.Props.ToolTransparency) / 100)), GRBLMachinePlugin.Props.ToolColor)); } d3d.LineStyle = LineStyle.Solid; // paint the tool _tool.Paint(d3d); // paint the bounding box if (_limitsOuter != null && GRBLMachinePlugin.Props.DrawLimits == EnabledDisabled.Enabled) { d3d.LineColor(Color.FromArgb((int)(255f * ((100f - GRBLMachinePlugin.Props.LimitsTransparency) / 100)), GRBLMachinePlugin.Props.LimitsColor)); _limitsTop.Paint(d3d); _limitsBottom.Paint(d3d); _limitsOuter.Paint(d3d); _limitsInner.Paint(d3d); } }
public static ToolDefinition ActiveTool(this ICADView view) { ToolDefinition tool = view.CADFile != null?view.CADFile.ActiveTool() : null; return(tool != null ? tool : (view.CADFile != null ? view.CADFile.FirstTool() : null)); }
public static ToolDefinition FirstTool(this ICADView view) { return(view.CADFile != null?view.CADFile.FirstTool() : null); }
public static MachineOp ActiveMOP(this ICADView view) { return(view.CADFile != null?view.CADFile.ActiveMOP() : null); }
public static MachineOp FirstMOP(this ICADView view) { CADFile file = view.CADFile; return(file != null?file.FirstMOP() : null); }
public static CAMPart ActivePart(this ICADView view) { return(view.CADFile != null?view.CADFile.ActivePart() : null); }
public static CAMPart FirstPart(this ICADView view) { CADFile file = view.CADFile; return(file != null?file.FirstPart() : null); }