本文整理汇总了C#中UV_DLP_3D_Printer.SliceBuildConfig类的典型用法代码示例。如果您正苦于以下问题:C# SliceBuildConfig类的具体用法?C# SliceBuildConfig怎么用?C# SliceBuildConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SliceBuildConfig类属于UV_DLP_3D_Printer命名空间,在下文中一共展示了SliceBuildConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SliceBuildConfig
private String m_preliftcode; // inserted before each slice
#endregion Fields
#region Constructors
/*
Copy constructor
*/
public SliceBuildConfig(SliceBuildConfig source)
{
dpmmX = source.dpmmX; // dots per mm x
dpmmY = source.dpmmY; // dots per mm y
xres = source.xres;
yres = source.yres; // the resolution of the output image
ZThick = source.ZThick; // thickness of the z layer - slicing height
layertime_ms = source.layertime_ms; // time to project image per layer in milliseconds
firstlayertime_ms = source.firstlayertime_ms;
blanktime_ms = source.blanktime_ms;
plat_temp = source.plat_temp; // desired platform temperature in celsius
exportgcode = source.exportgcode; // export the gcode file when slicing
exportsvg = source.exportsvg; // export the svg slices when building
exportimages = source.exportimages; // export image slices when building
m_headercode = source.m_headercode; // inserted at beginning of file
m_footercode = source.m_footercode; // inserted at end of file
m_preliftcode = source.m_preliftcode; // inserted between each slice
m_postliftcode = source.m_postliftcode; // inserted between each slice
liftdistance = source.liftdistance;
direction = source.direction;
numfirstlayers = source.numfirstlayers;
XOffset = source.XOffset;
YOffset = source.YOffset;
raise_time_ms = source.raise_time_ms;
}
开发者ID:Elph,项目名称:UVDLPSlicerController,代码行数:34,代码来源:SliceBuildConfig.cs
示例2: GetNumberOfSlices
public int GetNumberOfSlices(SliceBuildConfig sp, Object3d obj)
{
try
{
obj.FindMinMax();
int numslices = (int)((obj.m_max.z - obj.m_min.z) / sp.ZThick);
return numslices;
}
catch (Exception)
{
return 0;
}
}
开发者ID:tojoevan,项目名称:UVDLPSlicerController,代码行数:13,代码来源:Slicer.cs
示例3: GetNumberOfSlices
/// <summary>
/// This will get the number of slices in the scene from the specified slice config
/// This uses the Scene object from the app, we slice with individual objects though
/// </summary>
/// <param name="sp"></param>
/// <returns></returns>
public int GetNumberOfSlices(SliceBuildConfig sp)
{
try
{
//UVDLPApp.Instance().CalcScene();
MinMax mm = UVDLPApp.Instance().Engine3D.CalcSceneExtents(); // get the scene min/max
//int numslices = (int)((UVDLPApp.Instance().Scene.m_max.z - UVDLPApp.Instance().Scene.m_min.z) / sp.ZThick);
int numslices = (int)((mm.m_max - mm.m_min) / sp.ZThick);
return numslices;
}
catch (Exception)
{
m_cancel = true;
return 0;
}
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:22,代码来源:Slicer.cs
示例4: RenderOutlines
private void RenderOutlines(Graphics g, SliceBuildConfig sp)
{
//optimize the polylines to join short segements into longer segments in correct winding order
Optimize();
Pen pen_inset = null;
Pen pen_outset = null;
//create the appropriate pen
pen_inset = new Pen(UVDLPApp.Instance().m_appconfig.m_foregroundcolor, (float)sp.m_outlinewidth_inset);
pen_inset.Alignment = PenAlignment.Inset;
pen_outset = new Pen(UVDLPApp.Instance().m_appconfig.m_foregroundcolor, (float)sp.m_outlinewidth_outset);
pen_outset.Alignment = PenAlignment.Outset;
//outset lines by definition will not meet at the corners, try to add some rounding to account for this.
pen_outset.EndCap = LineCap.Round;
pen_outset.StartCap = LineCap.Round;
//get the half resolution for offsetting
int hxres = sp.xres / 2;
int hyres = sp.yres / 2;
// iterate through all the polylines in m_opsegs
//m_opsegs now contains 0 or more 3d polylines
foreach(PolyLine3d pln in m_opsegs)
{
Point[] pntlst = new Point[pln.m_points.Count];
//iterate through all the 3d points in this polyline segment
for (int c = 0; c < pln.m_points.Count ; c++)
{
// we must project these to 2d similar to Get2dLines
//3d to 2d conversion
Point3d p3d1 = (Point3d)pln.m_points[c];
Point pnt2d = new Point();
pnt2d.X = (int)(p3d1.x * sp.dpmmX);
pnt2d.Y = (int)(p3d1.y * sp.dpmmY);
// 2d offseting
pnt2d.X = (int)(pnt2d.X) + sp.XOffset + hxres;
pnt2d.Y = (int)(pnt2d.Y) + sp.YOffset + hyres;
pntlst[c] = pnt2d; // set the item in the array
}
//now render it
g.DrawPolygon(pen_inset, pntlst);
if (sp.m_outlinewidth_outset > 0)
{
g.DrawPolygon(pen_outset, pntlst);
}
}
// dispose of the pen
pen_inset.Dispose();
pen_outset.Dispose();
}
开发者ID:gobrien4418,项目名称:UVDLPSlicerController,代码行数:48,代码来源:Slice.cs
示例5: UVDLPApp
private UVDLPApp()
{
m_supportmode = eSupportEditMode.eNone;
SceneFileName = "";
m_callbackhandler = new CallbackHandler();
m_appconfig = new AppConfig();
m_printerinfo = new MachineConfig();
m_buildparms = new SliceBuildConfig();
m_deviceinterface = new DeviceInterface();
m_buildmgr = new BuildManager();
m_slicer = new Slicer();
m_slicer.m_slicemethod = Slicer.eSliceMethod.eNormalCount;// configure the slicer to user the new normal count - Thanks Shai!!!
m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
//m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding
//m_flexslice = new FlexSlice();
m_gcode = new GCodeFile(""); // create a blank gcode to start with
m_supportconfig = new SupportConfig();
m_supportgenerator = new SupportGenerator();
m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent);
CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent);
m_proj_cmd_lst = new prjcmdlst();
m_plugins = new List<PluginEntry>(); // list of user plug-ins
m_pluginstates = PluginStates.Instance(); // initialize the plugin state singleton
m_undoer = new Undoer();
m_2d_graphics = new C2DGraphics();
m_gui_config = new GuiConfigManager();
m_AuxBuildCmds = AuxBuildCmds.Instance(); // make sure the singleton doesn't go away...
m_sequencemanager = SequenceManager.Instance();
m_exporter = new frmExport();
m_exporter.RegisterExporter(new B9JExporter());
}
开发者ID:gobrien4418,项目名称:UVDLPSlicerController,代码行数:31,代码来源:UVDLPApp.cs
示例6: Render2dlines
private void Render2dlines(Graphics g, ArrayList lines, SliceBuildConfig sp)
{
try
{
Point pnt1 = new Point(); // create some points for drawing
Point pnt2 = new Point();
//Pen pen = new Pen(Color.White, 1);
Pen pen = new Pen(UVDLPApp.Instance().m_appconfig.m_foregroundcolor, 1);
//Brush
//Pen p2 = new Pen(
int hxres = sp.xres / 2;
int hyres = sp.yres / 2;
foreach (Line2d ln in lines)
{
Point2d p1 = (Point2d)ln.p1;
Point2d p2 = (Point2d)ln.p2;
pnt1.X = (int)(p1.x) + sp.XOffset + hxres;
pnt1.Y = (int)(p1.y) + sp.YOffset + hyres;
pnt2.X = (int)(p2.x) + sp.XOffset + hxres;
pnt2.Y = (int)(p2.y) + sp.YOffset + hyres;
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawLine(pen, pnt1, pnt2);
}
}
catch (Exception ex)
{
DebugLogger.Instance().LogError(ex.Message);
}
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:32,代码来源:Slice.cs
示例7: ResizeImage
/*
private static Bitmap ResizeImage(Bitmap imgToResize, Size size)
{
try
{
Bitmap b = new Bitmap(size.Width, size.Height);
using (Graphics g = Graphics.FromImage((Image)b))
{
//g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(imgToResize, 0, 0, size.Width, size.Height);
}
return b;
}
catch { return null; }
}
*/
/// <summary>
/// This new slicing function renders into a pre-allocated bitmap
/// </summary>
/// <param name="sp"></param>
/// <param name="bmp"></param>
public void RenderSlice(SliceBuildConfig sp, ref Bitmap bmp)
{
try
{
Graphics graph = Graphics.FromImage(bmp);
Point pnt1 = new Point(); // create some points for drawing
Point pnt2 = new Point();
Pen pen = new Pen(UVDLPApp.Instance().m_appconfig.m_foregroundcolor, 1);
//convert all to 2d lines
int hxres = sp.xres / 2;
int hyres = sp.yres / 2;
ArrayList lines2d = Get2dLines(sp);
if (lines2d.Count == 0)
return;
Render2dlines(graph, lines2d, sp);
// find the x/y min/max
MinMax_XY mm = CalcMinMax_XY(lines2d);
// iterate from the ymin to the ymax
for (int y = mm.ymin; y < mm.ymax; y++) // this needs to be in scaled value
{
// get a line of lines that intersect this 2d line
ArrayList intersecting = GetIntersecting2dYLines(y, lines2d);
// get the list of point intersections
ArrayList points = GetIntersectingPoints(y, intersecting);
// sort the points in increasing x order
//SortXIncreasing(points);
points.Sort();
// draw the X-Spans (should be even number)
// For a given pair of intersectin points
// (Xi, Y), (Xj, Y)
// −> Fill ceiling(Xi) to floor(Xj)
if (points.Count % 2 == 0) // is even
{
for (int cnt = 0; cnt < points.Count; cnt += 2) // increment by 2
{
Point2d p1 = (Point2d)points[cnt];
Point2d p2 = (Point2d)points[cnt + 1];
pnt1.X = (int)(p1.x + sp.XOffset + hxres);
pnt1.Y = (int)(p1.y + sp.YOffset + hyres);
pnt2.X = (int)(p2.x + sp.XOffset + hxres);
pnt2.Y = (int)(p2.y + sp.YOffset + hyres);
//graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawLine(pen, pnt1.X, pnt1.Y, pnt2.X, pnt2.Y);
}
}
else // flag error
{
DebugLogger.Instance().LogRecord("Row y=" + y + " odd # of points = " + points.Count + " - Model may have holes");
}
}
}
catch (Exception ex)
{
DebugLogger.Instance().LogError(ex.Message);
}
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:81,代码来源:Slice.cs
示例8: Slice
// this function takes the object, the slicing parameters,
// and the output directory. it generates the object slices
// and saves them in the directory
public SliceFile Slice(SliceBuildConfig sp, Object3d obj, String outdir)
{
m_obj = obj;
m_cancel = false;
// create new slice file
m_sf = new SliceFile(sp);
m_slicethread = new Thread(new ThreadStart(slicefunc));
m_slicethread.Start();
isslicing = true;
return m_sf;
}
开发者ID:tojoevan,项目名称:UVDLPSlicerController,代码行数:14,代码来源:Slicer.cs
示例9: Get2dLines
// this function converts all the 3d polyines to 2d lines so we can process everything
private ArrayList Get2dLines(SliceBuildConfig sp)
{
ArrayList lst = new ArrayList();
foreach (PolyLine3d ply in m_segments)
{
Line2d ln = new Line2d();
//get the 3d points of the line
Point3d p3d1 = (Point3d)ply.m_points[0];
Point3d p3d2 = (Point3d)ply.m_points[1];
//convert them to 2d (probably should add an offset to center them)
ln.p1.x = (int)(p3d1.x * sp.dpmmX);// +hxres;
ln.p1.y = (int)(p3d1.y * sp.dpmmY);// +hyres;
ln.p2.x = (int)(p3d2.x * sp.dpmmX);// +hxres;
ln.p2.y = (int)(p3d2.y * sp.dpmmY);// +hyres;
lst.Add(ln);
}
return lst; // return the list
}
开发者ID:hammil,项目名称:UVDLPSlicerController,代码行数:19,代码来源:Slice.cs
示例10: DetermineInteriorExterior
/// <summary>
/// This function will iterate through the optimized loops
/// and determine if they are interior or exterior and tag them appropriately
/// </summary>
public void DetermineInteriorExterior(SliceBuildConfig config)
{
List<PolyLine3d> allsegments = new List<PolyLine3d>();
foreach (PolyLine3d pln in m_opsegs)
{
pln.tag = PolyLine3d.TAG_INTERIOR; // mark it as interior
List<PolyLine3d> segments = pln.Split(); // split them, retaining the parent
allsegments.AddRange(segments);
}
List<Line2d> lines2d = Get2dLines(config, allsegments);
// find the x/y min/max
MinMax_XY mm = Slice.CalcMinMax_XY(lines2d);
// iterate from the ymin to the ymax
for (int y = mm.ymin; y < mm.ymax; y++) // this needs to be in scaled value
{
// get a line of lines that intersect this 2d line
List<Line2d> intersecting = Slice.GetIntersecting2dYLines(y, lines2d);
// get the list of point intersections
List<Point2d> points = Slice.GetIntersectingPoints(y, intersecting);
// sort the points in increasing x order
points.Sort();
if (points.Count % 2 == 0) // is even
{
for (int cnt = 0; cnt < points.Count; cnt += 2) // increment by 2
{
// the first point is always an exterior - really? why?
Point2d p1 = (Point2d)points[cnt];
if (p1.m_parent != null)
{
p1.m_parent.tag = PolyLine3d.TAG_EXTERIOR; // mark as exterior
}
// the second point could be an exterior or interior
Point2d p2 = (Point2d)points[cnt + 1];
}
}
else // flag error
{
DebugLogger.Instance().LogRecord("Row y=" + y + " odd # of points = " + points.Count + " - Model may have holes");
}
}// for y = startminY to endY
}
开发者ID:hesam89,项目名称:UVDLPSlicerController,代码行数:45,代码来源:Slice.cs
示例11: CopyFrom
public void CopyFrom(SliceBuildConfig source)
{
dpmmX = source.dpmmX; // dots per mm x
dpmmY = source.dpmmY; // dots per mm y
xres = source.xres;
yres = source.yres; // the resolution of the output image
ZThick = source.ZThick; // thickness of the z layer - slicing height
layertime_ms = source.layertime_ms; // time to project image per layer in milliseconds
firstlayertime_ms = source.firstlayertime_ms;
blanktime_ms = source.blanktime_ms;
plat_temp = source.plat_temp; // desired platform temperature in celsius
// exportgcode = source.exportgcode; // export the gcode file when slicing
exportsvg = source.exportsvg; // export the svg slices when building
export = source.export; // export image slices when building
m_headercode = source.m_headercode; // inserted at beginning of file
m_footercode = source.m_footercode; // inserted at end of file
m_preliftcode = source.m_preliftcode; // inserted between each slice
m_postliftcode = source.m_postliftcode; // inserted between each slice
m_preslicecode = source.m_preslicecode; // inserted before each slice
m_mainliftcode = source.m_mainliftcode; // inserted before postlift and after prelift. its the main lift code
liftdistance = source.liftdistance;
direction = source.direction;
numfirstlayers = source.numfirstlayers;
XOffset = source.XOffset;
YOffset = source.YOffset;
slidetiltval = source.slidetiltval;
antialiasing = source.antialiasing;
usemainliftgcode = source.usemainliftgcode;
liftfeedrate = source.liftfeedrate;
liftretractrate = source.liftretractrate;
aaval = source.aaval;//
//m_generateautosupports = source.m_generateautosupports;
m_exportopt = source.m_exportopt;
m_flipX = source.m_flipX;
m_flipY = source.m_flipY;
m_notes = source.m_notes;
m_resinprice = source.m_resinprice;
}
开发者ID:BenjaminRaymond,项目名称:UVDLPSlicerController,代码行数:39,代码来源:SliceBuildConfig.cs
示例12: Slice
// standard scene slicing
// this function takes the object, the slicing parameters,
// and the output directory. it generates the object slices
// and saves them in the directory
public SliceFile Slice(SliceBuildConfig sp)//, Object3d obj)
{
// create new slice file
m_sf = new SliceFile(sp);
m_sf.m_modeltype = Slicing.SliceFile.ModelType.eScene;
if (sp.export == false)
{
m_sf.m_mode = SliceFile.SFMode.eImmediate;
}
m_slicethread = new Thread(new ThreadStart(slicefunc));
m_slicethread.Start();
isslicing = true;
return m_sf;
}
开发者ID:pingnagan,项目名称:UVDLPSlicerController,代码行数:18,代码来源:Slicer.cs
示例13: ShowCalibration
/// <summary>
/// Make and show a new calibration image
/// modificado por boris
/// </summary>
/// <param name="xres"></param>
/// <param name="yres"></param>
/// <param name="sc"></param>
public void ShowCalibration(int xres, int yres, SliceBuildConfig sc)
{
// if (m_calibimage == null) // blank image is null, create it
{
//xres = 1024;
//yres = 768;
m_calibimage = new Bitmap(xres,yres);
m_calibimage.Tag = BuildManager.SLICE_CALIBRATION;
// fill it with black
using (Graphics gfx = Graphics.FromImage(m_calibimage))
using (SolidBrush brush = new SolidBrush(Color.DarkSlateBlue))
{
gfx.FillRectangle(brush, 0, 0, xres, yres);
int xpos = 0, ypos = 0;
Pen pen = new Pen(new SolidBrush(Color.White));
var radio = 25;
var radX = (int)(radio * sc.dpmmX);
var rady = (int)(radio * sc.dpmmY);
gfx.DrawEllipse(pen, new Rectangle((xres / 2) - radX/2, (yres / 2)- rady/2, radX, rady));
gfx.DrawString("Prueba\r\nCALIBRACION", new Font("Verdana", 70), new SolidBrush(Color.DarkRed), 30, 30);
for(xpos = 0; xpos < xres; xpos += (int)(sc.dpmmX*10.0))
{
Point p1 = new Point(xpos,0);
Point p2 = new Point(xpos,yres);
gfx.DrawLine(pen, p1, p2);
}
for (ypos = 0; ypos < yres; ypos += (int)(sc.dpmmY*10.0))
{
Point p1 = new Point(0, ypos);
Point p2 = new Point(xres, ypos);
gfx.DrawLine(pen, p1, p2);
}
}
}
PrintLayer(m_calibimage, SLICE_CALIBRATION, SLICE_CALIBRATION);
}
开发者ID:tojoevan,项目名称:BGC-CW,代码行数:45,代码来源:BuildManager.cs
示例14: frmSliceOptions
public frmSliceOptions(ref SliceBuildConfig config)
{
m_config = config;
InitializeComponent();
}
开发者ID:ramkanna,项目名称:UVDLPSlicerController,代码行数:5,代码来源:frmSliceOptions.cs
示例15: UVDLPApp
private UVDLPApp()
{
m_appconfig = new AppConfig();
m_printerinfo = new MachineConfig();
m_buildparms = new SliceBuildConfig();
m_deviceinterface = new DeviceInterface();
m_buildmgr = new BuildManager();
m_slicer = new Slicer();
m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
m_flexslice = new FlexSlice();
m_gcode = null;
}
开发者ID:brots,项目名称:UVDLPSlicerController,代码行数:12,代码来源:UVDLPApp.cs
示例16: Slice
//, Object3d obj)
// this function takes the object, the slicing parameters,
// and the output directory. it generates the object slices
// and saves them in the directory
public SliceFile Slice(SliceBuildConfig sp)
{
//m_obj = obj;
m_cancel = false;
// create new slice file
m_sf = new SliceFile(sp);
if (sp.export == false)
{
m_sf.m_mode = SliceFile.SFMode.eImmediate;
}
m_slicethread = new Thread(new ThreadStart(slicefunc));
m_slicethread.Start();
isslicing = true;
return m_sf;
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:19,代码来源:Slicer.cs
示例17: SliceImmediate
/// <summary>
/// This function will immediately return a bitmap slice at the specified Z-Level
/// </summary>
/// <param name="zlev"></param>
/// <returns></returns>
public Bitmap SliceImmediate(float curz)
{
try
{
//first take care of scaling up the output bitmap paramters size, so we can re-sample later
double scaler = 1.5; // specify the scale factor
m_saved.CopyFrom(m_sf.m_config);// save the orginal
if (m_sf.m_config.antialiasing == true)
{
scaler = m_sf.m_config.aaval;
m_sf.m_config.dpmmX *= scaler;
m_sf.m_config.dpmmY *= scaler;
m_sf.m_config.xres = (int)(scaler * m_sf.m_config.xres);
m_sf.m_config.yres = (int)(scaler * m_sf.m_config.yres);
}
SliceBuildConfig sbf = new SliceBuildConfig(m_sf.m_config); // save it
Bitmap bmp = new Bitmap(m_sf.m_config.xres, m_sf.m_config.yres); // create a new bitmap on a per-slice basis
Graphics graph = Graphics.FromImage(bmp);
graph.Clear(UVDLPApp.Instance().m_appconfig.m_backgroundcolor);//clear the image for rendering
//convert all to 2d lines
Bitmap savebm = null;
// check for cancelation
foreach (Object3d obj in UVDLPApp.Instance().Engine3D.m_objects)
{
savebm = bmp; // need to set this here in case it's not rendered
if (curz >= obj.m_min.z && curz <= obj.m_max.z) // only slice from the bottom to the top of the objects
{
ArrayList lstply = GetZPolys(obj, curz);//get a list of polygons at this slice z height that potentially intersect
ArrayList lstintersections = GetZIntersections(lstply, curz);//iterate through all the polygons and generate x/y line segments at this 3d z level
Slice sl = new Slice();//create a new slice
sl.m_segments = lstintersections;// Set the list of intersections
sl.RenderSlice(m_sf.m_config, ref bmp);
savebm = bmp;
}
}
if (m_sf.m_config.antialiasing == true) // we're using anti-aliasing here, so resize the image
{
savebm = ResizeImage(bmp,new Size(m_saved.xres,m_saved.yres));
}
if (m_sf.m_config.m_flipX == true)
{
savebm = ReflectX(savebm);
}
if (m_sf.m_config.m_flipY == true)
{
savebm = ReflectY(savebm);
}
//restore the original size
m_sf.m_config.CopyFrom(m_saved);
return savebm;
}
catch (Exception ex)
{
string s = ex.StackTrace;
DebugLogger.Instance().LogRecord(ex.Message);
return null;
}
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:67,代码来源:Slicer.cs
示例18: SliceBuildConfig
private String m_preslicecode; // inserted before each slice
#endregion Fields
#region Constructors
/*
Copy constructor
*/
public SliceBuildConfig(SliceBuildConfig source)
{
CopyFrom(source);
}
开发者ID:tojoevan,项目名称:BGC-CW,代码行数:13,代码来源:SliceBuildConfig.cs
示例19: RenderSlice
public Bitmap RenderSlice(SliceBuildConfig sp)
{
// create a new bitmap that will be used to draw into
//Bitmap bmp = new Bitmap(sp.xres, sp.yres);
double scaler = 1.5; // specofy the scale factor
if (sp.antialiasing == true)
{
scaler = sp.aaval;
}
else
{
scaler = 1.0; // no scaling
}
double sdpmmx = sp.dpmmX; // save the original dots per mm
double sdpmmy = sp.dpmmY;
sp.dpmmX *= scaler;// scaler them up.
sp.dpmmY *= scaler;
//Re-sample to a higher resolution so we can smooth later
int ox, oy;
ox = sp.xres; // save the original resolution
oy = sp.yres;
double xs, ys;
xs = ((double)sp.xres) * scaler; // scale them up
ys = ((double)sp.yres) * scaler;
sp.xres = (int) xs;
sp.yres = (int) ys;
Bitmap bmp = new Bitmap(sp.xres, sp.yres);
//Bitmap bmp = new Bitmap((int)xs,(int)ys);
Graphics graph = Graphics.FromImage(bmp);
Point pnt1 = new Point(); // create some points for drawing
Point pnt2 = new Point();
Pen pen = new Pen(Color.White,1);
graph.Clear(Color.Black);
//convert all to 2d lines
int hxres = sp.xres / 2;
int hyres = sp.yres / 2;
ArrayList lines2d = Get2dLines(sp);
Render2dlines(graph, lines2d,sp);
// find the x/y min/max
MinMax_XY mm = CalcMinMax_XY(lines2d);
// iterate from the ymin to the ymax
for (int y = mm.ymin; y < mm.ymax; y++) // this needs to be in scaled value
{
// get a line of lines that intersect this 2d line
ArrayList intersecting = GetIntersecting2dYLines(y, lines2d);
// get the list of point intersections
ArrayList points = GetIntersectingPoints(y,intersecting);
// sort the points in increasing x order
//SortXIncreasing(points);
points.Sort();
// draw the X-Spans (should be even number)
// For a given pair of intersectin points
// (Xi, Y), (Xj, Y)
// −> Fill ceiling(Xi) to floor(Xj)
if (points.Count % 2 == 0) // is even
{
for (int cnt = 0; cnt < points.Count; cnt += 2) // increment by 2
{
Point2d p1 = (Point2d)points[cnt];
Point2d p2 = (Point2d)points[cnt+1];
pnt1.X = (int)(p1.x + sp.XOffset + hxres);
pnt1.Y = (int)(p1.y + sp.YOffset + hyres);
pnt2.X = (int)(p2.x + sp.XOffset + hxres);
pnt2.Y = (int)(p2.y + sp.YOffset + hyres);
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawLine(pen, pnt1.X,pnt1.Y, pnt2.X,pnt2.Y);
}
}
else // flag error
{
DebugLogger.Instance().LogRecord("Row y=" + y + " odd # of points = " + points.Count+ " - Model may have holes");
}
}
//Rescale the image to re-sample it from a higher res to soften the lines with bicubic interpolation.
sp.dpmmX = sdpmmx;
sp.dpmmY = sdpmmy;
sp.xres = ox;
sp.yres = oy;
if (sp.antialiasing == true) // we're using anti-aliasing here, so resize the image
{
return ReflectY(ResizeImage(bmp, new Size(ox, oy)));
}
else
{
return ReflectY(bmp);
}
//return bmp;
}
开发者ID:hammil,项目名称:UVDLPSlicerController,代码行数:97,代码来源:Slice.cs
示例20: CopyFrom
public void CopyFrom(SliceBuildConfig source)
{
dpmmX = source.dpmmX; // dots per mm x
dpmmY = source.dpmmY; // dots per mm y
xres = source.xres;
yres = source.yres; // the resolution of the output image
ZThick = source.ZThick; // thickness of the z layer - slicing height
layertime_ms = source.layertime_ms; // time to project image per layer in milliseconds
firstlayertime_ms = source.firstlayertime_ms;
blanktime_ms = source.blanktime_ms;
plat_temp = source.plat_temp; // desired platform temperature in celsius
// exportgcode = source.exportgcode; // export the gcode file when slicing
exportsvg = source.exportsvg; // export the svg slices when building
export = source.export; // export image slices when building
exportpng = source.exportpng;
m_headercode = source.m_headercode; // inserted at beginning of file
m_footercode = source.m_footercode; // inserted at end of file
m_preslicecode = source.m_preslicecode; // inserted before each slice
m_liftcode = source.m_liftcode; // its the main lift code
liftdistance = source.liftdistance;
direction = source.direction;
numfirstlayers = source.numfirstlayers;
XOffset = source.XOffset;
YOffset = source.YOffset;
slidetiltval = source.slidetiltval;
antialiasing = source.antialiasing;
usemainliftgcode = source.usemainliftgcode;
liftfeedrate = source.liftfeedrate;
bottomliftfeedrate = source.bottomliftfeedrate;
liftretractrate = source.liftretractrate;
aaval = source.aaval;//
//m_generateautosupports = source.m_generateautosupports;
m_exportopt = source.m_exportopt;
m_flipX = source.m_flipX;
m_flipY = source.m_flipY;
m_notes = source.m_notes;
m_resinprice = source.m_resinprice;
selectedInk = source.selectedInk;
m_createoutlines = source.m_createoutlines;
m_outlinewidth_inset = source.m_outlinewidth_inset;
m_outlinewidth_outset = source.m_outlinewidth_outset;
if (source.inks != null)
{
inks = new Dictionary<string, InkConfig>();
foreach (KeyValuePair<string, InkConfig> entry in source.inks)
{
inks[entry.Key] = entry.Value;
}
}
minExposure = source.minExposure;
exposureStep = source.exposureStep;
exportpreview = source.exportpreview;
userParams = source.userParams;
}
开发者ID:tojoevan,项目名称:BGC-CW,代码行数:56,代码来源:SliceBuildConfig.cs
注:本文中的UV_DLP_3D_Printer.SliceBuildConfig类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论