示例#1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <Curve>  centerlines   = new List <Curve>();
            List <Mesh>   gsa           = new List <Mesh>();
            List <Mesh>   cavepanels    = new List <Mesh>();
            List <Curve>  grid          = new List <Curve>();
            List <Curve>  basegrid      = new List <Curve>();
            List <string> text          = new List <string>();
            List <Curve>  textlocations = new List <Curve>();
            string        path          = "";
            bool          run           = false;

            if (!DA.GetDataList(0, centerlines))
            {
                return;
            }
            if (!DA.GetDataList(1, gsa))
            {
                return;
            }
            if (!DA.GetDataList(2, cavepanels))
            {
                return;
            }
            if (!DA.GetDataList(3, grid))
            {
                return;
            }
            if (!DA.GetDataList(4, basegrid))
            {
                return;
            }
            if (!DA.GetData(5, ref path))
            {
                return;
            }
            if (!DA.GetData(6, ref run))
            {
                return;
            }
            if (!DA.GetDataList(7, text))
            {
                return;
            }
            if (!DA.GetDataList(8, textlocations))
            {
                return;
            }
            if (run)
            {
                DXFwriter writer = new DXFwriter();
                writeLines(writer, centerlines, "centrelines", 1);
                writeLines(writer, grid, "grid", 60);
                writeLines(writer, basegrid, "basegrid", 78);
                writeMeshes(writer, gsa, "gsamesh", 150);
                writeMeshes(writer, cavepanels, "cavepanels", 250);
                writeText(writer, text, textlocations);
                writer.finishAndWrite(path);
            }
        }
示例#2
0
 private void writeLines(DXFwriter writer, List <Curve> lines, string layer, int col)
 {
     foreach (Curve c in lines)
     {
         writer.DXFLines(c.PointAtStart, c.PointAtEnd, layer, col);
     }
 }
示例#3
0
 private void writeText(DXFwriter writer, List <string> text, List <Curve> locations)
 {
     for (int t = 0; t < text.Count; t++)
     {
         Vector3d v   = locations[t].PointAtEnd - locations[t].PointAtStart;
         double   rot = Vector3d.VectorAngle(Vector3d.XAxis, v) * 57.2958;
         writer.DXFText(text[t], locations[t].PointAtStart.X, locations[t].PointAtStart.Y, locations[t].PointAtStart.Z, "text", 1000, 0, rot);
     }
 }
示例#4
0
        private void writeMeshes(DXFwriter writer, List <Mesh> meshes, string layer, int col)
        {
            Random r = new Random();

            foreach (Mesh m in meshes)
            {
                if (layer == "cavepanels")
                {
                    col = 12 + r.Next(24) * 10;
                }
                if (m != null)
                {
                    writer.DXFPolyfaceMesh(m, layer, col);
                }
            }
        }