public static ulong AddHatchImageToFigure(vdDocument activeDocument, Vertexes vertexs, string toolTip, string imagePath, double hatchScale, vdXProperties xProperties) { //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(); onepoly.ToolTip = toolTip; if (null != xProperties && xProperties.Count > 0) { for (int i = 0; i < xProperties.Count; i++) { onepoly.XProperties.AddItem(xProperties[i]); } } onepoly.VertexList = vertexs; onepoly.Flag = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE; //Initialize the hatch properties object. onepoly.HatchProperties = new VectorDraw.Professional.vdObjects.vdHatchProperties(); //And change it's properties onepoly.HatchProperties.FillMode = VectorDraw.Professional.Constants.VdConstFill.VdFillModeImage; onepoly.HatchProperties.HatchScale = hatchScale; onepoly.HatchProperties.DrawBoundary = false; string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + imagePath; onepoly.HatchProperties.HatchImage = activeDocument.Images.Add(path); activeDocument.ActiveLayOut.Entities.AddItem(onepoly); return(onepoly.Handle.Value); }
public static void AddAreaHatch(vdDocument activeDocument, LJJSHatch ljjsHatch, Vertexes fillArea) { if (null == fillArea || fillArea.Count < 3) { return; } //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 = fillArea; onepoly.Flag = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE; // onepoly.SPlineFlag = VectorDraw.Professional.Constants.VdConstSplineFlag.SFlagQUADRATIC; onepoly.PenColor.SystemColor = Color.FromArgb(ljjsHatch.PenColor); //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 = ConvertToVDFillMode(ljjsHatch.FillMode); if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchPattern)) { if (!string.IsNullOrEmpty(ljjsHatch.HatchPattern)) { onepoly.HatchProperties.HatchPattern = activeDocument.HatchPatterns.FindName(ljjsHatch.HatchPattern); } } if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchBlock)) { if (!string.IsNullOrEmpty(ljjsHatch.HatchBlk)) { onepoly.HatchProperties.HatchBlock = activeDocument.Blocks.FindName(ljjsHatch.HatchBlk); } } onepoly.HatchProperties.FillColor.SystemColor = Color.FromArgb(ljjsHatch.FillColor); onepoly.HatchProperties.FillBkColor.SystemColor = Color.FromArgb(ljjsHatch.FillBKColor); onepoly.HatchProperties.DrawBoundary = ljjsHatch.IsDrawBoundary; onepoly.HatchProperties.HatchScale = ljjsHatch.HatchScale; onepoly.PenColor.SystemColor = Color.FromArgb(ljjsHatch.PenColor); onepoly.PenWidth = ljjsHatch.PenWidth; //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout). activeDocument.ActiveLayOut.Entities.AddItem(onepoly); //fc //gPoint g1 = new gPoint(0, 0); //gPoint g2 = new gPoint(0, 10); //activeDocument.ActiveLayOut.ZoomWindow(g1ff,g2 ); }
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); }
public static void AddPolyHatch(vdDocument activeDocument, List <List <LJJSPoint> > hatchBoundary, LJJSHatch ljjsHatch) { vdCurves curves = new vdCurves(); List <vdCurves> curvelst = new List <vdCurves>(); for (int i = 0; i < hatchBoundary.Count; i++) { List <LJJSPoint> tmpLst = hatchBoundary[i]; VectorDraw.Professional.vdFigures.vdPolyline tmppoly = new VectorDraw.Professional.vdFigures.vdPolyline(); for (int j = 0; j < tmpLst.Count; j++) { tmppoly.VertexList.Add(new gPoint(tmpLst[j].XValue, tmpLst[j].YValue)); } curves.AddItem(tmppoly); } curvelst.Add(curves); if (curves.Count > 0) { VectorDrawHatchHelper.AddPolyHatch(activeDocument, ljjsHatch, curvelst); } }
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); }
public static ulong CommonPolyLine(vdDocument activeDocument, List <gPoint> polyLineLst, double penWidth, Color color) { VectorDraw.Professional.vdFigures.vdPolyline onepoly = new VectorDraw.Professional.vdFigures.vdPolyline(); onepoly.SetUnRegisterDocument(activeDocument); onepoly.setDocumentDefaults(); onepoly.PenWidth = penWidth; vdColor LineColor = new vdColor(color); onepoly.PenColor = LineColor; if (polyLineLst != null) { for (int i = 0; i < polyLineLst.Count; i++) { onepoly.VertexList.Add(new gPoint(polyLineLst[i].x, polyLineLst[i].y)); } activeDocument.ActiveLayOut.Entities.AddItem(onepoly); return(onepoly.Handle.Value); } else { return(0); } }