コード例 #1
0
 protected override MeshGeometry3D Tessellate()
 {
     var builder = new MeshBuilder();
     builder.AddPipe(Point1, Point2, InnerDiameter, Diameter, ThetaDiv);
     return builder.ToMesh();
 }
コード例 #2
0
        protected override MeshGeometry3D Tessellate()
        {
            double width = Columns*grid - margin*2;
            double length = Rows*grid - margin*2;
            double height = Height*plateThickness;
            var builder = new MeshBuilder(true, true);

            for (int i = 0; i < Columns; i++)
                for (int j = 0; j < Rows; j++)
                {
                    var o = new Point3D((i + 0.5)*grid, (j + 0.5)*grid, height);
                    builder.AddCone(o, new Vector3D(0, 0, 1), knobDiameter/2, knobDiameter/2, knobHeight, false, true,
                                    Divisions);
                    builder.AddPipe(new Point3D(o.X, o.Y, o.Z - wallThickness), new Point3D(o.X, o.Y, wallThickness),
                                    knobDiameter, outerDiameter, Divisions);
                }

            builder.AddBox(new Point3D(Columns * 0.5 * grid, Rows * 0.5 * grid, height - wallThickness / 2), length, width,
                          wallThickness,
                          MeshBuilder.BoxFaces.All);
            builder.AddBox(new Point3D(margin + wallThickness / 2, Rows * 0.5 * grid, height / 2 - wallThickness / 2), length,
                           wallThickness, height - wallThickness,
                           MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
            builder.AddBox(
                new Point3D(Columns * grid - margin - wallThickness / 2, Rows * 0.5 * grid, height / 2 - wallThickness / 2), length,
                wallThickness, height - wallThickness,
                MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
            builder.AddBox(new Point3D(Columns * 0.5 * grid, margin + wallThickness / 2, height / 2 - wallThickness / 2),
                           wallThickness, width, height - wallThickness,
                           MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
            builder.AddBox(
                new Point3D(Columns * 0.5 * grid, Rows * grid - margin - wallThickness / 2, height / 2 - wallThickness / 2),
                wallThickness, width, height - wallThickness,
                MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);

            return builder.ToMesh();
        }