예제 #1
0
 private void RunScript(Brep x, bool y, int v, int u, ref object A)
 {
     Mesh[] meshes = Mesh.CreateFromBrep(x, MeshingParameters.Smooth);
     Mesh M = new Mesh();
     foreach (Mesh partialMesh in meshes)
     {
         M.Append(partialMesh);
     }
     m_shapes.Add(M);
     InitializeStreamBitmap(u, v);
     Print(str);
     Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial();
     mat.SetTransparencyTexture(str, true);
     mat.BackTransparency = 0;
     m_materials.Clear();
     m_materials.Add(mat);
 }
예제 #2
0
    private void RunScript(Brep x, Curve y, int V, int U, ref object A)
    {
        Graphics g = Graphics.FromImage(bitmap1);
        g.FillRectangle(new SolidBrush(Color.White), 0, 0, u, v);
        System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.Black);

        float step1 = u / U;
        float step2 = v / V;
        for (float i = 25; i < u - 25; i += step1)
        {
            for (float j = 25; j < v - 25; j += step2)
            {
                double Umin = x.Faces[0].Domain(0).Min;
                double Umax = x.Faces[0].Domain(0).Max;
                double Vmin = x.Faces[0].Domain(1).Min;
                double Vmax = x.Faces[0].Domain(1).Max;
                Point3d pos = x.Faces[0].PointAt(i / u * (Umax - Umin) + Umin, j / v * (Vmax - Vmin) + Vmin);
                double t; float R;
                if (y.ClosestPoint(pos, out t, 200))
                {
                    double dis = y.PointAt(t).DistanceTo(pos);
                    dis /= 200;
                    R = (float)(1 / dis * 2);
                    //  Print(R.ToString());
                    if (R > 40) R = 40;
                    ;
                }
                else { R = 20; }
                g.FillEllipse(myBrush, i - R, v - j - R, R * 2, R * 2);
            }
        }

        myBrush.Dispose();
        str = @"C:\maps\temp1.jpg";
        bitmap1.Save(str);
        Print(str);
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        Mesh[] meshes = Mesh.CreateFromBrep(x, MeshingParameters.Smooth);
        Mesh M = new Mesh();
        foreach (Mesh partialMesh in meshes)
        {
            M.Append(partialMesh);
        }
        m_shapes.Add(M);

        Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial();
        mat.SetTransparencyTexture(str, true);
        mat.BackTransparency = 0;
        m_materials.Clear();
        m_materials.Add(mat);
    }