public static ulong AddHatchToFigure(vdDocument activeDocument, Vertexes vertexs, int lineColor, int hatchColor, VdConstSplineFlag splineFlag) { if (null == vertexs || vertexs.Count < 3) { return(0); } //We will create a vdPolyline object and add it to the Active Layout which is the basic Model Layout always existing in a Document. VectorDraw.Professional.vdFigures.vdPolyline onepoly = new VectorDraw.Professional.vdFigures.vdPolyline(); //We set the document where the polyline is going to be added.This is important for the vdPolyline in order to obtain initial properties with setDocumentDefaults. onepoly.SetUnRegisterDocument(activeDocument); onepoly.setDocumentDefaults(); //The two previus steps are important if a vdFigure object is going to be added to a document. //Now we will change some properties of the polyline. onepoly.VertexList = vertexs; onepoly.Flag = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE; // onepoly.SPlineFlag = VectorDraw.Professional.Constants.VdConstSplineFlag.SFlagQUADRATIC; onepoly.SPlineFlag = splineFlag; //相当于上一句话 onepoly.PenColor.SystemColor = Color.FromArgb(lineColor); //onepoly.PenColor.SystemColor = Color.Yellow; //Now we will change the hacth properties of this polyline.Hatch propertis have all curve figures(circle,arc,ellipse,rect,polyline). //Initialize the hatch properties object. onepoly.HatchProperties = new VectorDraw.Professional.vdObjects.vdHatchProperties(); //And change it's properties onepoly.HatchProperties.FillMode = VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid; onepoly.HatchProperties.FillColor.SystemColor = Color.FromArgb(hatchColor); //onepoly.HatchProperties.FillColor.ColorIndex = 122; //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout). activeDocument.ActiveLayOut.Entities.AddItem(onepoly); // gPoint gp1 = new gPoint(vertexs[0].x, vertexs[0].y); // gPoint gp2 = new gPoint(vertexs[2].x, vertexs[2].y); // activeDocument.ActiveLayOut.ZoomWindow(gp1,gp2 ); return(onepoly.Handle.Value); }
private static ulong AddAreaHatch(vdDocument activeDocument, List <LJJSPoint> hatchPtLst, int areaLineColor, int areaHatchColor, VdConstSplineFlag splineFlag) { Vertexes hatcharea = new Vertexes(); if (null != hatchPtLst && hatchPtLst.Count() > 0) { for (int i = 0; i < hatchPtLst.Count(); i++) { gPoint gpt = new gPoint(hatchPtLst[i].XValue, hatchPtLst[i].YValue); hatcharea.Add(gpt); } return(VectorDrawHelper.AddHatchToFigure(activeDocument, hatcharea, areaLineColor, areaHatchColor, splineFlag)); } return(0); }
public static ulong BuildSpineWithSolidHatch(vdDocument activeDocument, Vertexes vertexs, VdConstPlineFlag pLineFlag, VdConstSplineFlag spLineFlag, int hatchColor, string toolTip) { VectorDraw.Professional.vdFigures.vdPolyline onepoly = new VectorDraw.Professional.vdFigures.vdPolyline(); //We set the document where the polyline is going to be added.This is important for the vdPolyline in order to obtain initial properties with setDocumentDefaults. onepoly.SetUnRegisterDocument(activeDocument); onepoly.setDocumentDefaults(); onepoly.VertexList = vertexs; onepoly.ToolTip = toolTip; onepoly.Flag = pLineFlag; onepoly.SPlineFlag = spLineFlag; onepoly.PenColor.SystemColor = Color.FromArgb(hatchColor); //Now we will change the hacth properties of this polyline.Hatch propertis have all curve figures(circle,arc,ellipse,rect,polyline). //Initialize the hatch properties object. onepoly.HatchProperties = new VectorDraw.Professional.vdObjects.vdHatchProperties(); //And change it's properties onepoly.HatchProperties.FillMode = VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid; onepoly.HatchProperties.FillColor.SystemColor = Color.FromArgb(hatchColor); //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout). activeDocument.ActiveLayOut.Entities.AddItem(onepoly); return(onepoly.Handle.Value); }