private vdPolyface CreatePolyFaceFromCurve(vdPolyline curvePath, double diameter) { var pf = new vdPolyface(); pf.SetUnRegisterDocument(vDraw.ActiveDocument); pf.setDocumentDefaults(); var circle = new vdCircle { Radius = diameter / 2.0 }; vdCurve path = curvePath; if (curvePath.VertexList.Count == 2) { var line = new vdLine(); line.SetUnRegisterDocument(vDraw.ActiveDocument); line.setDocumentDefaults(); line.StartPoint = curvePath.getStartPoint(); line.EndPoint = curvePath.getEndPoint(); path = line; } pf.Generate3dPathSection(path, circle, new gPoint(0, 0, 0), 6, 1); pf.SmoothAngle = 45; pf.PenColor.ColorIndex = 2; vDraw.ActiveDocument.ActiveLayOut.Entities.Add(pf); return(pf); }
private vdPolyface AddMeshToEntities(vdEntities entities, MeshData mesh) { vdPolyface onepolyface = new vdPolyface(); onepolyface.SetUnRegisterDocument(vDraw.ActiveDocument); onepolyface.setDocumentDefaults(); // 顶点数组输入 foreach (PointData point in mesh.Vertexes) { onepolyface.VertexList.Add(point.X * Tools.Ft2MmScale, point.Y * Tools.Ft2MmScale, point.Z * Tools.Ft2MmScale); } // 面片索引输入 foreach (TriangleIndexData index in mesh.TriangleIndexes) { onepolyface.AddFaceItem(index.V1 + 1, index.V2 + 1, index.V3 + 1, index.V1 + 1, -1); } onepolyface.SmoothAngle = 45; onepolyface.Layer = vDraw.ActiveDocument.Layers.FindName(mesh.MaterialName); entities.Add(onepolyface); if (ExportSetting.SystemSetting.IsExportTextureFile) { var material = Materials.Find(m => m.Name == mesh.MaterialName); if (material != null && !string.IsNullOrEmpty(material.GetValidMapFile())) { var img = vDraw.ActiveDocument.Images.FindName(Path.GetFileNameWithoutExtension(material.GetValidMapFile())); if (img != null) { onepolyface.PenColor.SystemColor = Color.Gray; onepolyface.PenColor.MaterialImage = img; Matrix mtx = new Matrix(); mtx.IdentityMatrix(); mtx.ScaleMatrix(0.001, 0.001, 1); onepolyface.PenColor.MaterialMatrix = mtx; } } } onepolyface.Invalidate(); onepolyface.Update(); return(onepolyface); }
private void AddPipeToEntities(vdEntities entities, double diameter, gPoint ptStart, gPoint ptEnd, string layerName) { var pf = new vdPolyface(); pf.SetUnRegisterDocument(vDraw.ActiveDocument); pf.setDocumentDefaults(); var line = new vdLine(ptStart, ptEnd); var circle = new vdCircle { Radius = diameter / 2.0 }; pf.Generate3dPathSection(line, circle, new gPoint(0, 0, 0), 6, 1); pf.Layer = vDraw.ActiveDocument.Layers.FindName(layerName); pf.SmoothAngle = 45; entities.Add(pf); }