VectorImage AddPolygon
Adds a polygon shape to the vector image
Overloads
public void AddPolygon(IEnumerable<Point3D> vertices) |
Return value
void |
Parameters
IEnumerable<Point3D> | vertices | A list of vertices which define the polygon |
Example
Copy
scanDocument = scanDeviceManager.CreateScanDocument(GetselectedDeviceUniqueName(), DistanceUnit.Millimeters, false);
if (scanDocument != null)
{
VectorImage vectorImage = scanDocument.CreateVectorImage("image1", DistanceUnit.Millimeters);
vectorImage.SetMarkSpeed(1000);
vectorImage.SetJumpSpeed(2000);
vectorImage.SetJumpDelay(100);
vectorImage.SetMarkDelay(100);
//Set Laser Delays
vectorImage.SetLaserOnDelay(10);
vectorImage.SetLaserOffDelay(10);
List<Point3D> listPoint = new List<Point3D>();
listPoint.Add(new Point3D(-10, -40, 0));
listPoint.Add(new Point3D(-10, 10, 0));
listPoint.Add(new Point3D(-30, 10, 0));
listPoint.Add(new Point3D(0, 50, 0));
listPoint.Add(new Point3D(30, 10, 0));
listPoint.Add(new Point3D(10, 10, 0));
listPoint.Add(new Point3D(10, -40, 0));
vectorImage.AddPolygon(listPoint);
//Initializing Hatch Shape Object
HatchShape hatchshape = new HatchShape();
//Adding Polygon to hatchshape
hatchshape.AddPolygon(listPoint);
//Adding Hatch pattern to hatch shape
hatchshape.AddHatchPatternLine(0, HatchLineBorderGapDirection.Inward,
2.54f, ((float)Math.PI / 4), 0, 0, HatchLineStyle.Hatch2Times, false, HatchOffsetAlgorithm.DirectOffset, HatchCornerStyle.Sharp);
//Adding Hatch shape to VectorImage
vectorImage.AddHatchShape(hatchshape, 0);
scanDocument.Scripts.Add(new ScanningScriptChunk("defaultScript", "ScanAll()"));
try
{
scanDocument.StartScanning();
}
catch
{
}