public override void Render(Graphics2D graphics2D, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions) { double radius = Radius(renderInfo.LayerScale); Vector2 position = new Vector2(this.position.x, this.position.y); if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); position = position + offset; } renderInfo.Transform.transform(ref position); Color retractionColor = new Color(Color.Red, 200); if (extrusionAmount > 0) { // unretraction retractionColor = new Color(Color.Blue, 200); } // render the part using opengl if (graphics2D is Graphics2DOpenGL graphics2DGl) { graphics2DGl.DrawAACircle(position, radius, retractionColor); } else { Ellipse extrusion = new Ellipse(position, radius); graphics2D.Render(extrusion, retractionColor); } } }
protected Vector3Float GetEnd(GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.HideExtruderOffsets) == RenderType.HideExtruderOffsets) { Vector3Float end = this.end; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); end.x += (float)offset.x; end.y += (float)offset.y; return(end); } return(this.end); }
protected Vector3Float GetStart(GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.HideExtruderOffsets) == RenderType.HideExtruderOffsets) { Vector3Float start = this.start; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); start.x += (float)offset.x; start.y += (float)offset.y; return(start); } return(this.start); }
protected Vector3Float GetEnd(GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.HideExtruderOffsets) == RenderType.HideExtruderOffsets) { Vector3Float end = this.end; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); end.x += (float)offset.x; end.y += (float)offset.y; return end; } return this.end; }
protected Vector3Float GetStart(GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.HideExtruderOffsets) == RenderType.HideExtruderOffsets) { Vector3Float start = this.start; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); start.x += (float)offset.x; start.y += (float)offset.y; return start; } return this.start; }
protected Vector3Float GetEnd(GCodeRenderInfo renderInfo) { if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector3Float end = this.end; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); end.X += (float)offset.X; end.Y += (float)offset.Y; return(end); } return(this.end); }
protected Vector3Float GetStart(GCodeRenderInfo renderInfo) { if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector3Float start = this.start; Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); start.X += (float)offset.X; start.Y += (float)offset.Y; return(start); } return(this.start); }
public override void CreateRender3DData(VectorPOD <ColorVertexData> colorVertexData, VectorPOD <int> indexData, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions) { Vector3 position = new Vector3(this.position); if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); position = position + new Vector3(offset); } // retract and unretract are the extruder color Color color = renderInfo.GetMaterialColor(extruderIndex); // except for extruder 0 where they are the red and blue we are familiar with if (extruderIndex == 0) { if (extrusionAmount > 0) { color = Color.Blue; } else { color = Color.Red; } } if (extrusionAmount > 0) { // unretraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, 1.3), position + new Vector3(0, 0, .3), Radius(1), 5, color); } else { // retraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, .3), position + new Vector3(0, 0, 1.3), Radius(1), 5, color); } } }
public override void CreateRender3DData(VectorPOD <ColorVertexData> colorVertexData, VectorPOD <int> indexData, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions) { Vector3 position = new Vector3(this.position); if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); position = position + new Vector3(offset); } RGBA_Bytes color = MeshViewerWidget.GetMaterialColor(extruderIndex + 1); if (extruderIndex == 0) { if (extrusionAmount > 0) { color = RGBA_Bytes.Blue; } else { color = RGBA_Bytes.Red; } } if (extrusionAmount > 0) { // unretraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, 1.3), position + new Vector3(0, 0, .3), Radius(1), 5, color); } else { // retraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, .3), position + new Vector3(0, 0, 1.3), Radius(1), 5, color); } } }