Article | 70001732 |
Type | HowTo |
Product | WebJS |
Version | 7 |
Date Added | 4/8/2020 12:00:00 AM |
Fixed | 8.8005.0.3 (4/8/2020 12:00:00 AM) |
Submitted by | hanlijun |
Summary
How can i create a polyline with bulges and hatch it in WebControl.
Solution
Example: Create a new polyline figure with bulges and hatch it:
var pntArray = [[0, 0, 0], [5, 5, 0], [7, 7, 0, -1], [7, 5, 0], [5, 0, 0], [0, 0, 0]];//An array of vertexes that define the polyline.Each item is an array of x,y,z,bulge. // Bulge is the forth element of a vertex and it can be a negative number for clockwise arc or positive number for anti-clockwise arc. var pLine = vdcanvas.AddPolyline(pntArray, true); var ph = vdcanvas.AddPolyHatch([pLine], null, true);// add our figure in our polyhatch object ph.HatchProperties = vdcanvas.createNewHatchProperties("u20", vdConst.colorFromString("255,255,0,255"), vdConst.colorFromString("255,0,0,255"), 1.0, 0.0);// create new hatch properties (HatchPatternName, FillBkColor, FillColor,hatchscale, hatchangle) ph.HatchProperties.DrawBoundary = true;//By default is false so the boundary is not be drawn vdcanvas.UpdateFig(ph);//update the figure in order to get the changes vdcanvas.DrawEntity(ph); // draw the figure setTimeout(vdcanvas.redraw); // post a redraw in order to see the hatch on the canvas