Exemple #1
0
        public bool CreateLoftForm()
        {
            string    filePath    = this.csvFolderPath + FILE_NAME_FORM;
            CsvWriter csvWriter   = new CsvWriter();
            string    returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            double spaceX, spaceY, height;

            List <List <HbXYZ> > curves = new List <List <HbXYZ> >();

            for (int indexX = 0; indexX <= GridSizeX; indexX++)
            {
                List <HbXYZ> curve = new List <HbXYZ>();
                spaceX = indexX * FactorGrowX + CellSizeX;
                double lineX = indexX * spaceX;
                for (int indexY = 0; indexY <= GridSizeY; indexY++)
                {
                    height = CalculateHeight(indexX, indexY);
                    spaceY = indexY * FactorGrowY + CellSizeY;
                    double lineY = indexY * spaceY;
                    HbXYZ  point = new HbXYZ(lineX, lineY, height);
                    curve.Add(point);
                }
                curves.Add(curve);
            }
            csvWriter.AddLoftForm(curves);

            csvWriter.WriteFile();

            return(true);
        }
Exemple #2
0
        public bool CreateLines()
        {
            string    filePath  = this.csvFolderPath + FILE_NAME_LINE;
            CsvWriter csvWriter = new CsvWriter();

            csvWriter.Precision = 4;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            Spiral spiral = new Spiral(centerPoint);

            spiral.FactorA = FactorA;
            spiral.FactorB = FactorB;
            HbXYZ currentPoint, lastPoint = null;

            for (int i = 0; i < NumberOfPoints; i++)
            {
                XY xy = spiral.CalculatePoint(i);
                currentPoint = new HbXYZ(xy.X, xy.Y, 0.0);
                if (i > 0)
                {
                    csvWriter.AddModelLine(lastPoint, currentPoint);
                }
                lastPoint = currentPoint;
            }
            csvWriter.WriteFile();
            return(true);
        }
Exemple #3
0
        public bool CreateWalls()
        {
            string    filePath    = this.csvFolderPath + FILE_NAME_WALLS;
            CsvWriter csvWriter   = new CsvWriter();
            string    returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            HbXYZ point1, point2, point3, point4;

            csvWriter.SetWallHeight(FloorHeight - constantFloorThickness);
            XY p1, p2, p3, p4;

            for (int i = 1; i < NumberFloors; i++)
            {
                double elevationWall = (i - 1) * FloorHeight;
                Calculate(i, -2 * constantWallThickness, out p1, out p2, out p3, out p4);
                point1 = new HbXYZ(p1.X, p1.Y, elevationWall);
                point2 = new HbXYZ(p2.X, p2.Y, elevationWall);
                point3 = new HbXYZ(p3.X, p3.Y, elevationWall);
                point4 = new HbXYZ(p4.X, p4.Y, elevationWall);
                csvWriter.AddWall(point1, point2);
                csvWriter.AddWall(point2, point3);
                csvWriter.AddWall(point3, point4);
                csvWriter.AddWall(point4, point1);
            }
            csvWriter.WriteFile();
            return(true);
        }
Exemple #4
0
        // ************************************************** Public Functions ***********************************************
        public bool CreateGrids()
        {
            string    filePath  = this.csvFolderPath + FILE_NAME_GRID;
            CsvWriter csvWriter = new CsvWriter();

            csvWriter.Precision = 4;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            Spiral spiral = new Spiral(this.centerPoint);

            spiral.FactorA = FactorA;
            spiral.FactorB = FactorB;
            HbXYZ currentPoint;
            HbXYZ centerPoint = new HbXYZ(0.0, 0.0, 0.0);

            for (int i = 0; i <= NumberOfPoints; i++)
            {
                XY xy = spiral.CalculatePoint(i);
                currentPoint = new HbXYZ(2 * xy.X, 2 * xy.Y, 0.0);
                csvWriter.AddGrid(centerPoint, currentPoint);
                csvWriter.ModifyParameterSet("Name", (i + 1).ToString());
            }
            csvWriter.WriteFile();
            return(true);
        }
Exemple #5
0
        public bool CreateWalls()
        {
            string    filePath  = this.csvFolderPath + FILE_NAME_WALL;
            CsvWriter csvWriter = new CsvWriter();

            csvWriter.Precision = 4;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            Spiral spiral = new Spiral(centerPoint);

            spiral.FactorA = FactorA;
            spiral.FactorB = FactorB;
            for (int i = 0; i < NumberOfPoints; i++)
            {
                XY    xyStart  = spiral.CalculatePoint(i);
                XY    xyEnd    = spiral.CalculatePoint(i + 1);
                XY    xyMid    = spiral.CalculatePoint(i + 0.5);
                HbXYZ xyzStart = new HbXYZ(xyStart.X, xyStart.Y, 0.0);
                HbXYZ xyzEnd   = new HbXYZ(xyEnd.X, xyEnd.Y, 0.0);
                HbXYZ xyzMid   = new HbXYZ(xyMid.X, xyMid.Y, 0.0);
                csvWriter.AddWall(xyzStart, xyzEnd, xyzMid);
            }
            csvWriter.WriteFile();
            return(true);
        }
Exemple #6
0
        // ************************************************ RevitModelBuilder CSV file Functions *****************************************************
        public bool EstablishCsvLink(CsvWriter csvWriter, string folderPath, string fileName)
        {
            if (!folderPath.EndsWith(@"\"))
            {
                folderPath = folderPath + @"\";
            }
            if (!fileName.ToLower().EndsWith(".csv"))
            {
                fileName = fileName + ".csv";
            }
            string filePath    = folderPath + fileName;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                Print(returnValue);
                return(false);
            }
            Print("Connection to CSV file established.");

            // Read existing ElementIds if the file already exists.
            // Note that we are doing this by default and no user option is provided.  Alternatively we could have a user setting.
            if (File.Exists(filePath))
            {
                try {
                    returnValue = csvWriter.ReadElementIds();
                    if (returnValue != "")
                    {
                        Print(returnValue);
                        return(false);
                    }
                }
                catch (Exception exception) {
                    Print("Exception at Utility.EstablishCsvLink(): " + exception.Message);
                    return(false);
                }
            }


            return(true);
        }
Exemple #7
0
        private bool ProcessRecords()
        {
            this.errorMessageBuild = "One or more errors encountered:";
            this.errorMessageCount = 0;

            // Validation
            if (!Directory.Exists(this.pathCsvFolder))
            {
                System.Windows.Forms.MessageBox.Show("Folder for CSV files does not exist.  Halting process.", this.settings.ProgramName);
                return(false);
            }
            string pathCsvFile = this.pathCsvFolder + @"\" + this.csvFileName;  // Trailing "\" has already been removed from this.pathCsvFolder; ".csv" extension has been added to this.csvFileName.

            try {
                this.maxErrorsToShow = Convert.ToInt32(textBoxMaxErrors.Text);
            }
            catch {
                this.maxErrorsToShow  = 10;
                textBoxMaxErrors.Text = "10";
            }

            // Selection mode for elements.
            string selectionMode;

            if (radioButtonSelectCurrent.Checked)
            {
                selectionMode = "current";
            }
            else if (radioButtonSelectView.Checked)
            {
                selectionMode = "view";
            }
            else
            {
                selectionMode = "all";
            }

            // Rounding value
            int precision = 2;

            if (checkBoxRoundPoints.Checked)
            {
                try { precision = Convert.ToInt16(comboBoxDecimals.Text); }
                catch { } //Just leave at default value
            }
            else
            {
                precision = -1;   // -1 value indicates no rounding
            }
            // Prepare to create Set statemtents by blanking all of the settings so first one gets a Set statement
            this.elements.InitializeSettings();

            ProgressBar progressBarForm = null;

            try {
                // Start CsvWriter and create file.
                CsvWriter csvWriter = new CsvWriter();
                string    returnValue;
                returnValue = csvWriter.ConnectToFile(pathCsvFile);
                if (returnValue != "")
                {
                    System.Windows.Forms.MessageBox.Show(
                        "Error returned from 'CsvWriter.ConnectToFile()'.  Halting process.\n\n"
                        + "Internal message: " + returnValue, this.settings.ProgramName);
                    return(false);
                }

                DataTable dataTable = csvWriter.DataTable;

                // Setup columns and headings
                int row = 1;

                // Get the Revit selection
                ElementSet elementsToProcess = null;
                if (selectionMode == "current")
                {
                    // 2015 Deprecated
                    elementsToProcess = new ElementSet();
                    foreach (ElementId elementId in this.currentSelectionSet)
                    {
                        elementsToProcess.Insert(this.settings.DocumentDb.GetElement(elementId));
                    }
                    //elementsToProcess = this.currentSelectionSet;  // Saved from initial startup since the process of finding adaptive components loses the selection
                }
                else
                {
                    FilteredElementCollector collector;
                    if (selectionMode == "view")
                    {
                        collector = new FilteredElementCollector(this.settings.DocumentDb, this.settings.ActiveView.Id);
                    }
                    else    //"all" case
                    {
                        collector = new FilteredElementCollector(this.settings.DocumentDb);
                    }
                    ICollection <Element> elementsCollection = collector.WhereElementIsNotElementType().ToElements();
                    elementsToProcess = new ElementSet();
                    foreach (Element element in elementsCollection)
                    {
                        elementsToProcess.Insert(element);
                    }
                }

                // Process the selection
                if (elementsToProcess.Size == 0)
                {
                    System.Windows.Forms.MessageBox.Show("No elements selected.  Stopping process.", this.settings.ProgramName);
                    return(false);
                }
                row = 2;                      //Since headings was 1
                int            itemCount = 0; //Used to develop rowId value
                ConversionMode conversionMode;
                if (radioButtonConvertNone.Checked)
                {
                    conversionMode = ConversionMode.None;
                }
                else if (radioButtonConvertDetailLines.Checked)
                {
                    conversionMode = ConversionMode.DetailLines;
                }
                else if (radioButtonConvertModelLines.Checked)
                {
                    conversionMode = ConversionMode.ModelLines;
                }
                else
                {
                    conversionMode = ConversionMode.FilledRegions;   // radioButtonConvertFilledRegions.Checked case
                }
                //Start the progress bar
                int numberOfElements = elementsToProcess.Size;
                progressBarForm = new ProgressBar("Processing " + numberOfElements.ToString() + " elements.", numberOfElements + 1);
                progressBarForm.SetLabel("");
                progressBarForm.Show();
                progressBarForm.Increment();  //To avoid transparent look while waiting
                //int currentElement = 1;

                // Process the families
                bool userCancel = false;
                foreach (Element element in elementsToProcess)
                {
                    string      rowIdRoot   = itemCount.ToString();
                    OutputGroup outputGroup = new OutputGroup(rowIdRoot, element, precision, conversionMode, this.settings, this.elements);
                    if (!outputGroup.Valid)
                    {
                        ProcessError("Unable to export object: " + outputGroup.ErrorMessage);
                        continue;
                    }
                    foreach (OutputItem outputItem in outputGroup)
                    {
                        outputItem.AddDataRow(dataTable);

                        System.Windows.Forms.Application.DoEvents(); //Clunky (but effective) way to allow the user to cancel the loop
                        if (progressBarForm.Cancel == true)
                        {
                            userCancel = true;
                            break;
                        }
                        progressBarForm.SetValue(itemCount + 1);
                        progressBarForm.SetLabel(
                            "Processing item " + (itemCount + 1).ToString() + " of " + numberOfElements.ToString() + ": "
                            + outputItem.RowId + " - " + outputItem.Action + " - " + outputItem.Object);
                        progressBarForm.Refresh();

                        row++;
                    }
                    itemCount++;
                    if (userCancel)
                    {
                        break;
                    }
                }

                // Write the csv file
                returnValue = csvWriter.WriteFile();
                if (returnValue != "")
                {
                    System.Windows.Forms.MessageBox.Show(
                        "Error returned from 'CsvWriter.WriteFile()'.  Halting process.\n\n"
                        + "Internal message: " + returnValue, this.settings.ProgramName);
                    if (!(progressBarForm == null))
                    {
                        progressBarForm.Close();
                    }
                    return(false);
                }
                return(true);
            }
            catch (Exception exception) {
                System.Windows.Forms.MessageBox.Show("Error in 'ExcelToElements.ProcessRecords'.\nSystem message: " + exception.Message, this.settings.ProgramName);
                return(false);
            }

            finally {
                if (!(progressBarForm == null))
                {
                    progressBarForm.Close();
                }
                if ((this.errorMessageCount > 0 && checkBoxListErrors.Checked))
                {
                    DisplayErrors displayErrorsDialog = new DisplayErrors(this.errorMessageBuild);
                    displayErrorsDialog.ShowDialog();
                }
            }
        }
Exemple #8
0
        // ************************************************** Public Functions ***********************************************
        public bool CreateFamilyExtrusions()
        {
            string    filePath  = this.csvFolderPath + FILE_NAME_BUILDINGS;
            CsvWriter csvWriter = new CsvWriter();

            csvWriter.Precision = 4;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            //double segmentX = SizeX / DivisionsX;
            //double segmentY = SizeY / DivisionsY;
            double segmentX = 5;
            double segmentY = 5;

            // Boundary values
            double slopeTop = (ElevTopRight - ElevTopLeft) / SizeX;
            double slopeBot = (ElevBotRight - ElevBotLeft) / SizeX;

            double[] elevsTop = new double[DivisionsX];
            double[] elevsBot = new double[DivisionsX];
            for (int indexX = 0; indexX < DivisionsX; indexX++)
            {
                elevsTop[indexX] = ElevTopRight + indexX * segmentX * slopeTop;
                elevsBot[indexX] = ElevBotRight + indexX * segmentX * slopeBot;
            }

            // Arbitray approximation for height
            double elevTop = Math.Max(Math.Max(ElevTopLeft, ElevTopRight), Math.Max(ElevBotLeft, ElevBotRight));
            double elevBot = Math.Min(Math.Min(ElevTopLeft, ElevTopRight), Math.Min(ElevBotLeft, ElevBotRight));
            double height  = (elevTop - elevBot); // Arbitrary

            // Place three buildings
            double currentY = (SizeY * 0.50) - (4 * segmentY);
            double currentX;
            int    currentDivisionX;
            double elevation;

            currentX         = (SizeX * 0.25) - (4 * segmentX);
            currentDivisionX = Convert.ToInt32(Convert.ToDouble(DivisionsX) * 0.25); // using nearest integer
            elevation        = ((elevsTop[currentDivisionX] + elevsBot[currentDivisionX]) / 2) - (height * 0.25);
            if (!CreateOneFamilyExtrusion(csvWriter, segmentX, segmentY, elevation, height, currentX, currentY))
            {
                return(false);
            }
            currentX         = (SizeX * 0.50) - (4 * segmentX);
            currentDivisionX = Convert.ToInt32(Convert.ToDouble(DivisionsX) * 0.50); // using nearest integer
            elevation        = ((elevsTop[currentDivisionX] + elevsBot[currentDivisionX]) / 2) - (height * 0.25);
            if (!CreateOneFamilyExtrusion(csvWriter, segmentX, segmentY, elevation, height, currentX, currentY))
            {
                return(false);
            }
            currentX         = (SizeX * 0.75) - (4 * segmentX);
            currentDivisionX = Convert.ToInt32(Convert.ToDouble(DivisionsX) * 0.75); // using nearest integer
            elevation        = ((elevsTop[currentDivisionX] + elevsBot[currentDivisionX]) / 2) - (height * 0.25);
            if (!CreateOneFamilyExtrusion(csvWriter, segmentX, segmentY, elevation, height, currentX, currentY))
            {
                return(false);
            }

            csvWriter.WriteFile();

            return(true);
        }
Exemple #9
0
        public bool CreateTopographySurface()
        {
            string    filePath  = this.csvFolderPath + FILE_NAME_TOPO_SURF;
            CsvWriter csvWriter = new CsvWriter();

            csvWriter.Precision = 4;
            string returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            Random random = new System.Random();
            double segmentX = SizeX / DivisionsX;
            double segmentY = SizeY / DivisionsY;
            double currentX, currentY;
            double elevTop   = Math.Max(Math.Max(ElevTopLeft, ElevTopRight), Math.Max(ElevBotLeft, ElevBotRight));
            double elevBot   = Math.Min(Math.Min(ElevTopLeft, ElevTopRight), Math.Min(ElevBotLeft, ElevBotRight));
            int    elevRange = Convert.ToInt32((elevTop - elevBot) / 10) + 1; // An arbitrary value to use with the random factor

            // Boundary values
            double slopeTop = (ElevTopRight - ElevTopLeft) / SizeX;
            double slopeBot = (ElevBotRight - ElevBotLeft) / SizeX;

            double[] elevsTop = new double[DivisionsX];
            double[] elevsBot = new double[DivisionsX];
            for (int indexX = 0; indexX < DivisionsX; indexX++)
            {
                elevsTop[indexX] = ElevTopRight + indexX * segmentX * slopeTop;
                elevsBot[indexX] = ElevBotRight + indexX * segmentX * slopeBot;
            }

            // Points in rectangle
            List <HbXYZ> points = new List <HbXYZ>();

            for (int indexX = 0; indexX < DivisionsX; indexX++)
            {
                currentX = indexX * segmentX;
                double factorX = Math.Sin((currentX / SizeX) * Math.PI);
                //double factorX = Math.Sin((currentX / SizeX) * Math.PI * 2);
                double slopeVertical = (elevsTop[indexX] - elevsBot[indexX]) / SizeY;
                for (int indexY = 0; indexY < DivisionsY; indexY++)
                {
                    currentY = indexY * segmentY;
                    double factorY = Math.Cos((currentY / SizeY) * Math.PI);
                    //double factorY = Math.Cos((currentY / SizeY) * Math.PI * 2);
                    //double randomDouble = random.Next(0, elevRange);
                    double currentZ = elevsBot[indexX] + (indexY * segmentY * slopeVertical) + (RandomFactor * elevRange * (factorX * factorY + random.NextDouble() / 10));
                    points.Add(new HbXYZ(currentX, currentY, currentZ));
                }
            }

            // TopographySurface
            csvWriter.AddTopographySurface(points);

            csvWriter.WriteFile();

            return(true);
        }
Exemple #10
0
        // ************************************************** Public Functions ***********************************************
        public bool CreateStructure()
        {
            string    filePath    = this.csvFolderPath + FILE_NAME_STRUCTURE;
            CsvWriter csvWriter   = new CsvWriter();
            string    returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            csvWriter.SetBeamJustification("Top");

            HbXYZ point1A, point2A, point3A, point4A;
            HbXYZ point1B = new HbXYZ(0, 0, 0); HbXYZ point2B = new HbXYZ(0, 0, 0);
            HbXYZ point3B = new HbXYZ(0, 0, 0); HbXYZ point4B = new HbXYZ(0, 0, 0);
            //mModelBuilder.  beam tops?
            //double elevationFloor, elevationWall; //, x1, x2, x3, x4, y1, y2, y3, y4;
            XY p1, p2, p3, p4;

            for (int i = 0; i < NumberFloors; i++)
            {
                //Calculate(i, out elevationFloor, out elevationWall, out p1, out p2, out p3, out p4);
                double elevationBeam = i * FloorHeight - constantFloorThickness;
                Calculate(i, -4 * constantWallThickness, out p1, out p2, out p3, out p4);
                point1A = new HbXYZ(p1.X, p1.Y, elevationBeam);
                point2A = new HbXYZ(p2.X, p2.Y, elevationBeam);
                point3A = new HbXYZ(p3.X, p3.Y, elevationBeam);
                point4A = new HbXYZ(p4.X, p4.Y, elevationBeam);
                if (i != 0)
                {
                    csvWriter.AddColumn(point1B, point1A);
                    csvWriter.AddColumn(point2B, point2A);
                    csvWriter.AddColumn(point3B, point3A);
                    csvWriter.AddColumn(point4B, point4A);
                }
                csvWriter.AddBeam(point1A, point2A);
                csvWriter.AddBeam(point2A, point3A);
                csvWriter.AddBeam(point3A, point4A);
                csvWriter.AddBeam(point4A, point1A);
                point1B = new HbXYZ(point1A.X, point1A.Y, point1A.Z);
                point2B = new HbXYZ(point2A.X, point2A.Y, point2A.Z);
                point3B = new HbXYZ(point3A.X, point3A.Y, point3A.Z);
                point4B = new HbXYZ(point4A.X, point4A.Y, point4A.Z);
            }
            csvWriter.WriteFile();
            return(true);
        }
Exemple #11
0
        public bool CreateAdaptiveComponents()
        {
            string    filePath    = this.csvFolderPath + FILE_NAME_ADAPTIVE_COMPONENT;
            CsvWriter csvWriter   = new CsvWriter();
            string    returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            HbXYZ point1A, point2A, point3A, point4A;
            HbXYZ point1B = new HbXYZ(0, 0, 0); HbXYZ point2B = new HbXYZ(0, 0, 0);
            HbXYZ point3B = new HbXYZ(0, 0, 0); HbXYZ point4B = new HbXYZ(0, 0, 0);

            csvWriter.SetAdaptiveComponentType(ADAPTIVE_COMPONENT_TYPE, ADAPTIVE_COMPONENT_TYPE);
            XY p1, p2, p3, p4;

            for (int i = 0; i < NumberFloors; i++)
            {
                double elevationWall = i * FloorHeight;
                Calculate(i, 0, out p1, out p2, out p3, out p4);
                point1A = new HbXYZ(p1.X, p1.Y, elevationWall);
                point2A = new HbXYZ(p2.X, p2.Y, elevationWall);
                point3A = new HbXYZ(p3.X, p3.Y, elevationWall);
                point4A = new HbXYZ(p4.X, p4.Y, elevationWall);
                if (i != 0)
                {
                    csvWriter.AddAdaptiveComponent(point1A, point2A, point2B, point1B);
                    csvWriter.AddAdaptiveComponent(point2A, point3A, point3B, point2B);
                    csvWriter.AddAdaptiveComponent(point3A, point4A, point4B, point3B);
                    csvWriter.AddAdaptiveComponent(point4A, point1A, point1B, point4B);
                }
                point1B = new HbXYZ(point1A.X, point1A.Y, point1A.Z);
                point2B = new HbXYZ(point2A.X, point2A.Y, point2A.Z);
                point3B = new HbXYZ(point3A.X, point3A.Y, point3A.Z);
                point4B = new HbXYZ(point4A.X, point4A.Y, point4A.Z);
            }
            csvWriter.WriteFile();
            return(true);
        }
        // ************************************************** Public Functions ***********************************************
        public bool CreateFloors()
        {
            string    filePath    = this.csvFolderPath + FILE_NAME_FLOORS;
            CsvWriter csvWriter   = new CsvWriter();
            string    returnValue = csvWriter.ConnectToFile(filePath);

            if (returnValue != "")
            {
                MessageBox.Show(returnValue);
                return(false);
            }
            if (this.preserveId)
            {
                // Note that if file doesn't exist yet we ignore option to preserve ID values
                if (File.Exists(filePath))
                {
                    try {
                        returnValue = csvWriter.ReadElementIds();
                        if (returnValue != "")
                        {
                            MessageBox.Show(returnValue);
                            return(false);
                        }
                    }
                    catch (Exception exception) {
                        MessageBox.Show("Exception at csvWriter.ReadElementIds(): " + exception.Message);
                        return(false);
                    }
                }
            }

            HbXYZ point1, point2, point3, point4;
            int   floors = 60;

            for (int j = 0; j < floors; j++)
            {
                double elevationFloor = j * 10;
                double w = 100;
                double a = 1 + (floors - j) / 3;
                double b = (w - 3 * a) / 2;
                double c = 2 * a + b;

                point1 = new HbXYZ(0, 0, elevationFloor);
                point2 = new HbXYZ(w, 0, elevationFloor);
                point3 = new HbXYZ(w, w, elevationFloor);
                point4 = new HbXYZ(0, w, elevationFloor);
                csvWriter.DrawCurveArray();  // Outer loop always comes first
                csvWriter.DrawLine(point1, point2);
                csvWriter.DrawLine(point2, point3);
                csvWriter.DrawLine(point3, point4);
                csvWriter.DrawLine(point4, point1);

                point1 = new HbXYZ(0 + a, 0 + a, elevationFloor);
                point2 = new HbXYZ(a + b, 0 + a, elevationFloor);
                point3 = new HbXYZ(a + b, a + b, elevationFloor);
                point4 = new HbXYZ(0 + a, a + b, elevationFloor);
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point1, point2);
                csvWriter.DrawLine(point2, point3);
                csvWriter.DrawLine(point3, point4);
                csvWriter.DrawLine(point4, point1);

                point1 = new HbXYZ(0 + c, 0 + a, elevationFloor);
                point2 = new HbXYZ(c + b, 0 + a, elevationFloor);
                point3 = new HbXYZ(c + b, a + b, elevationFloor);
                point4 = new HbXYZ(0 + c, a + b, elevationFloor);
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point1, point2);
                csvWriter.DrawLine(point2, point3);
                csvWriter.DrawLine(point3, point4);
                csvWriter.DrawLine(point4, point1);

                point1 = new HbXYZ(0 + a, 0 + c, elevationFloor);
                point2 = new HbXYZ(a + b, 0 + c, elevationFloor);
                point3 = new HbXYZ(a + b, c + b, elevationFloor);
                point4 = new HbXYZ(0 + a, c + b, elevationFloor);
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point1, point2);
                csvWriter.DrawLine(point2, point3);
                csvWriter.DrawLine(point3, point4);
                csvWriter.DrawLine(point4, point1);

                point1 = new HbXYZ(0 + c, 0 + c, elevationFloor);
                point2 = new HbXYZ(c + b, 0 + c, elevationFloor);
                point3 = new HbXYZ(c + b, c + b, elevationFloor);
                point4 = new HbXYZ(0 + c, c + b, elevationFloor);
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point1, point2);
                csvWriter.DrawLine(point2, point3);
                csvWriter.DrawLine(point3, point4);
                csvWriter.DrawLine(point4, point1);

                csvWriter.AddFloor();
            }

            csvWriter.WriteFile();

            return(true);
        }
Exemple #13
0
        // ******************************************************** Private Functions ********************************************************
        private bool RunProcess()
        {
            Cursor.Current = Cursors.WaitCursor;
            try {
                CsvWriter csvWriter = new CsvWriter();

                // ********************************************************************************************************************************
                // ************************************* HummingbirdUtility Basic Function Signatures ***************************************
                // ********************************************************************************************************************************
                //
                // "Version" is a property of the ExcelWriter object.

                // Revit classes "XYZ", "Line", "Arc", "Ellipse", "NurbSpline", and "HermiteSpline" have corresponding classes in Hummingbird named
                // "HbXYZ", "HbLine", "HbArc", "HbEllipse", "HbNurbSpline", and "HbHermiteSpline" which derive from a parent class of "HbItem".
                // These have constructors:
                // HbXYZ(double x, double y, double z)
                // HbLine(HbXYZ pointStart, HbXYZ pointEnd)
                // HbArc(HbXYZ pointStart, HbXYZ pointEnd, HbXYZ pointMid)
                // HbEllipse(HbXYZ pointFirst, HbXYZ pointSecond, double radiusY, string mode)  radiusY is perpendicular to points; mode "Half" or "Full".
                // HbNurbSpline(List<HbXYZ> points)
                // HbHermiteSpline(List<HbXYZ> points)
                // (Note, these also have a default constructor with no parameters and properties that correspond to the parameters that must be set individually.)
                // They also have special functions specifically for use with Autodesk DesignScript
                // static HbXYZ New(double x, double y, double z)
                // static HbLine New(HbXYZ pointStart, HbXYZ pointEnd)
                // static HbArc New(HbXYZ pointStart, HbXYZ pointEnd, HbXYZ pointMid)
                // static HbEllipse New(HbXYZ pointFirst, HbXYZ pointSecond, double radiusY, string mode)  radiusY is perpendicular to points; mode "Half" or "Full".
                // static HbNurbSpline New(List<HbXYZ> points)
                // static HbHermiteSpline New(List<HbXYZ> points)
                // There are also some list functions that workaround the lack of a native "List" object in DesignScript
                // HbItemList()
                // static void Add(HbItemList list, HbItem hbItem)
                // HbItemListList()
                // static void Add(HbItemListList listList, HbItemList list)
                //
                // The following are methods of the ExcelWriter object.
                //
                // List of worksheet names:
                // List<string> GetWorksheetNames()
                //
                // Set Actions:
                // void SetLevel(string levelName)
                // void SetWallType(string wallTypeName)
                // void SetWallHeight(double height)
                // void SetFloorType(string floorTypeName)
                // void SetFamilyType(string familyName, string typeName)
                // void SetFamilyFlipped(bool flipHand, bool flipFacing)
                // void SetFamilyMirrored(bool mirrorX, bool mirrorY)
                // void SetFamilyRotation(double rotation)
                // void SetColumnMode(string mode, string familyName, string typeName)
                // void SetColumnHeight(double height)
                // void SetColumnRotation(double rotation)
                // void SetBeamType(string familyName, string typeName)
                // void SetBeamJustification(string justification) {
                // void SetBeamRotation(double rotation) {
                // void SetAdaptiveComponentType(string familyName, string typeName)
                // void SetFamilyExtrusionHeight(double height)
                // void SetMullionType(string familyName, string typeName)
                //
                // Add Actions:
                // void AddGrid(HbXYZ point1, HbXYZ point2)                  // Line case
                // void AddGrid(HbXYZ point1, HbXYZ point2, HbXYZ point3)    // Arc case (point1 = start; point2 = end; point3 = any point in arc.)
                // void AddLevel(double elevation, string name = null) {     // name is optional
                // void AddDetailLine(HbXYZ point1, HbXYZ point2)
                // void AddDetailArc(HbXYZ point1, HbXYZ point2, HbXYZ point3)
                // void AddDetailEllipse(HbXYZ point1, HbXYZ point2, double radiusY, string mode)
                // void AddDetailNurbsSpline(HbXYZ point1, HbXYZ point2, HbXYZ point3 = null, HbXYZ point4 = null) // points 3 and 4 are optional
                // void AddDetailNurbsSpline(List<HbXYZ> points)
                // void AddDetailCurves(List<HbItem> curves)
                // void AddModelLine(HbXYZ point1, HbXYZ point2)
                // void AddModelArc(HbXYZ point1, HbXYZ point2, HbXYZ point3)
                // void AddModelEllipse(HbXYZ point1, HbXYZ point2, double radiusY, string mode)
                // void AddModelNurbsSpline(HbXYZ point1, HbXYZ point2, HbXYZ point3 = null, HbXYZ point4 = null) // points 3 and 4 are optional
                // void AddModelNurbsSpline(List<HbXYZ> points)
                // void AddModelCurves(List<HbItem> curves)
                // void AddTopographySurface(HbXYZ point1, HbXYZ point2, HbXYZ point3, HbXYZ point4 = null) {
                // void AddTopographySurface(List<HbXYZ> points) {

                // void AddWall(HbXYZ point1, HbXYZ point2)                   // Straight line in plan.
                // void AddWall(HbXYZ point1, HbXYZ point2, HbXYZ point3)  // Arc in plan
                // void AddWall(List<HbItem> curvesList)                         // List of lines, arcs, ellipses, or splines in plan
                // void AddWall(List<List<HbItem>> curvesList)                   // List of Lists controls profile in elevation
                // void AddFloor(HbXYZ point1, HbXYZ point2, HbXYZ point3, HbXYZ point4)
                // void AddFloor(List<List<HbItem>> curvesList)
                // void AddFamilyInstance(HbXYZ point1)
                // void AddColumn(HbXYZ point1)
                // void AddColumn(HbXYZ point1, HbXYZ point2)
                // void AddBeam(HbXYZ point1, HbXYZ point2)
                // void AddAdaptiveComponent(HbXYZ point1, HbXYZ point2 = null, HbXYZ point3 = null, HbXYZ point4 = null)   // points 2, 3, and 4 are optional
                // void AddAdaptiveComponent(List<HbXYZ> points)
                // void AddAreaBoundaryLine(HbXYZ point1, HbXYZ point2)                                // Line case
                // void AddAreaBoundaryLine(HbXYZ point1, HbXYZ point2, HbXYZ point3)               // Arc case
                // void AddAreaBoundaryLine(HbXYZ point1, HbXYZ point2, double radiusY, string mode)   // Ellipse case
                // void AddAreaBoundaryLine(List<HbXYZ> points)                                           // Spline case
                // void AddAreaBoundaryLine(List<HbItem> curves)                                          // List of lines, arcs, ellipses, or splines in plan
                // void AddRoomSeparationLine(HbXYZ point1, HbXYZ point2)                              // Line case
                // void AddRoomSeparationLine(HbXYZ point1, HbXYZ point2, HbXYZ point3)             // Arc case
                // void AddRoomSeparationLine(HbXYZ point1, HbXYZ point2, double radiusY, string mode) // Ellipse case
                // void AddRoomSeparationLine(List<HbXYZ> points)                                         // Spline case
                // void AddRoomSeparationLine(List<HbItem> curves)                                        // List of lines, arcs, ellipses, or splines in plan
                // void AddArea(HbXYZ point1);
                // void AddRoom(HbXYZ point1);
                // void AddReferencePoint(HbXYZ point)
                // void AddCurveByPoints(List<HbXYZ> points)
                // void AddloftForm(List<List<HbXYZ>> points)
                // void AddFamilyExtrusion(List<List<HbItem>> curvesList, string nameFamily = null, HbXYZ pointInsert = null) {
                // void AddFamilyExtrusion(List<List<HbItem>> curvesList, HbXYZ pointInsert) {
                //
                // Modify Actions:
                // void ModifyParameterSet(string parameterName, string value)
                // void ModifyCurtainGridUAdd(double offsetPrimary);
                // void ModifyCurtainGridUAdd(double offsetPrimary, double offsetSecondary);
                // void ModifyCurtainGridVAdd(double offsetPrimary);
                // void ModifyCurtainGridVAdd(double offsetPrimary, double offsetSecondary);
                // void ModifyMullionUAdd(double offsetPrimary);
                // void ModifyMullionUAdd(double offsetPrimary, double offsetSecondary);
                // void ModifyMullionVAdd(double offsetPrimary);
                // void ModifyMullionVAdd(double offsetPrimary, double offsetSecondary);

                // ************************************************************************************************************************************
                // ************************************* RevitModelBuilderUtility Component Function Signatures ***************************************
                // ************************************************************************************************************************************
                //
                // Users will typically avoid using these in favor of the basic forms.  Provided here only for completeness
                //
                // Use-Add Actions:
                // void UsePoints(HbXYZ point1, HbXYZ point2 = null, HbXYZ point3 = null, HbXYZ point4 = null) { // points 2, 3, and 4 are optional
                // void UsePoints(List<HbXYZ> points) // General form of more than four points
                // void AddDetailNurbsSpline()  // Must follow UsePoints
                // void AddModelNurbsSpline()   // Must follow UsePoints
                // void AddAdaptiveComponent()  // Must follow UsePoints
                // void AddAreaBoundaryLine()   // Spline - Must follow UsePoints (Note: no simple form of spline is currently offered
                // void AddRoomSeparationLine() // Spline - Must follow UsePoints (Note: no simple form of spline is currently offered
                // void AddCurveByPoints()      // Must follow UsePoints
                // void AddTopographySurface()  // Must follow UsePoints
                //
                // Draw-Use-Add Actions:
                // (Also see UsePoints() above)
                // void DrawCurveArray()
                // void DrawLine(HbXYZ point1, HbXYZ point2)
                // void DrawArc(HbXYZ point1, HbXYZ point2, HbXYZ point3)
                // void AddWall()
                // void AddFloor()
                // void AddFamilyExtrusion(string nameFamily, HbXYZ pointInsert = null) {  // Must follow a Curve Array Set
                // void DrawCurveArray(List<HbItem> curves) {   // Combined form; curves must be HbItem type
                //
                // Model-Use-Add Actions:
                // (Also see UsePoints() above)
                // void ModelReferenceArray()  // Must be first statement
                // void AddLoftForm()          // Must follow ModelReferenceArray() and UsePoints()
                //

                // ****************************************************************************************************************
                // ******************************************* Start of Sample Code Section ***************************************
                // ****************************************************************************************************************
                //
                // This is the portion of the code that is typically emulated for a particular project use.

                // Sample Revit hb items and lists
                HbXYZ        point11 = new HbXYZ(0, 0, 0); HbXYZ point12 = new HbXYZ(10, 0, 0); HbXYZ point13 = new HbXYZ(20, 0, 0); HbXYZ point14 = new HbXYZ(15, 5, 0);
                HbXYZ        point21 = new HbXYZ(0, 10, 0); HbXYZ point22 = new HbXYZ(10, 10, 0); HbXYZ point23 = new HbXYZ(20, 10, 0); HbXYZ point24 = new HbXYZ(15, 15, 0);
                List <HbXYZ> pointsList1 = new List <HbXYZ>(); pointsList1.Add(point11); pointsList1.Add(point12); pointsList1.Add(point13); pointsList1.Add(point14);
                List <HbXYZ> pointsList2 = new List <HbXYZ>(); pointsList2.Add(point21); pointsList2.Add(point22); pointsList2.Add(point23); pointsList2.Add(point24);
                //List<HbXYZ> pointsList3 = new List<HbXYZ>(); pointsList3.Add(point21); pointsList3.Add(point22); pointsList3.Add(point23);
                //                                                   pointsList3.Add(point24); pointsList3.Add(point24); pointsList3.Add(point24);
                List <List <HbXYZ> > pointsListList = new List <List <HbXYZ> >(); pointsListList.Add(pointsList1); pointsListList.Add(pointsList2);
                HbLine       line1       = new HbLine(); line1.PointStart = point11; line1.PointEnd = point12;
                HbLine       line2       = new HbLine(); line2.PointStart = point21; line2.PointEnd = point22;
                HbArc        arc1        = new HbArc(); arc1.PointStart = point11; arc1.PointEnd = point12; arc1.PointMid = point13;
                HbArc        arc2        = new HbArc(); arc2.PointStart = point21; arc2.PointEnd = point22; arc2.PointMid = point23;
                HbNurbSpline nurbSpline1 = new HbNurbSpline(); nurbSpline1.Points.Add(point21); nurbSpline1.Points.Add(point12); nurbSpline1.Points.Add(point23);
                HbNurbSpline nurbSpline2 = new HbNurbSpline(); nurbSpline2.Points.Add(point11); nurbSpline2.Points.Add(point22); nurbSpline2.Points.Add(point13);
                HbNurbSpline nurbSpline3 = new HbNurbSpline(); nurbSpline3.Points.Add(point11); nurbSpline3.Points.Add(point22); nurbSpline3.Points.Add(point13);
                nurbSpline3.Points.Add(point11); nurbSpline3.Points.Add(point22); nurbSpline3.Points.Add(point13);
                List <HbCurve>         curvesList1    = new List <HbCurve>(); curvesList1.Add(line1); curvesList1.Add(arc1); curvesList1.Add(nurbSpline1);
                List <HbCurve>         curvesList2    = new List <HbCurve>(); curvesList2.Add(line2); curvesList2.Add(arc2); curvesList2.Add(nurbSpline3);
                List <List <HbCurve> > curvesListList = new List <List <HbCurve> >(); curvesListList.Add(curvesList1); curvesListList.Add(curvesList2);

                double levelElevation = 100;    //  for Level
                string levelName      = "A New Level";

                double radiusY = 10;   // for ellipse
                string mode    = "Full";

                double offsetPrimary   = 5; // for curtain gridds and mullions
                double offsetSecondary = 10;

                // Display the version
                MessageBox.Show("csvWriter.Version: " + csvWriter.Version);

                // Start .csv file
                textBoxCsvFolder.Text = textBoxCsvFolder.Text.Trim();
                if (!textBoxCsvFolder.Text.EndsWith(@"\"))
                {
                    textBoxCsvFolder.Text = textBoxCsvFolder.Text + @"\";
                }
                this.csvFolderPath      = textBoxCsvFolder.Text;
                textBoxCsvFileName.Text = textBoxCsvFileName.Text.Trim();
                if (!textBoxCsvFileName.Text.ToLower().EndsWith(".csv"))
                {
                    textBoxCsvFileName.Text = textBoxCsvFileName.Text + ".csv";
                }
                this.csvFileName = textBoxCsvFileName.Text;
                this.csvFilePath = this.csvFolderPath + this.csvFileName;
                string returnMMessage = csvWriter.ConnectToFile(this.csvFilePath);
                if (returnMMessage != "")
                {
                    MessageBox.Show(returnMMessage);
                    return(false);
                }

                // If checked, get ID values
                if (checkBoxPreserveId.Checked)
                {
                    // Note that if file doesn't exist yet we ignore option to preserve ID values
                    if (File.Exists(this.csvFilePath))
                    {
                        try {
                            string returnValue = csvWriter.ReadElementIds();
                            if (returnValue != "")
                            {
                                MessageBox.Show("csvWriter.ReadElementIds() failed: " + returnValue, PROGRAM_NAME);
                                return(false);
                            }
                        }
                        catch (Exception exception) {
                            MessageBox.Show("Exception in RunProcess() at csvWriter.ReadElementIds(): " + exception.Message, PROGRAM_NAME);
                            return(false);
                        }
                    }
                }

                // Set Actions:
                csvWriter.SetLevel("Level 1");
                csvWriter.SetWallType("WallTypeName");
                csvWriter.SetWallHeight(10);
                csvWriter.SetFloorType("FloorTypeName");
                csvWriter.SetFamilyType("FamilyFamilyName", "FamilyTypeName");
                csvWriter.SetFamilyFlipped(true, false);
                csvWriter.SetFamilyMirrored(false, true);
                csvWriter.SetFamilyRotation(45);
                csvWriter.SetColumnMode("Architectural", "ColumnFamilyName", "ColumnTypeName");
                csvWriter.SetColumnHeight(10);
                csvWriter.SetColumnRotation(45);
                csvWriter.SetBeamType("BeamFamilyName", "BeamTypeName");
                csvWriter.SetBeamJustification("Top");
                csvWriter.SetBeamRotation(45);
                csvWriter.SetAdaptiveComponentType("ACompFamilyName", "ACompTypeName");
                csvWriter.SetFamilyExtrusionHeight(40);
                csvWriter.SetMullionType("AMullionFamilyName", "AMullionTypeName");
                //
                // Add Actions:
                csvWriter.AddGrid(point11, point12);          // Line case
                csvWriter.AddGrid(point11, point12, point13); // Arc case
                levelElevation = 100;                         //  for Level
                csvWriter.AddLevel(levelElevation, levelName);
                csvWriter.AddLevel(levelElevation);           // name is optional
                csvWriter.AddDetailLine(point11, point12);
                csvWriter.AddDetailArc(point11, point12, point13);
                csvWriter.AddDetailEllipse(point11, point12, radiusY, mode);
                csvWriter.AddDetailNurbsSpline(point11, point12, point13, point14);
                csvWriter.AddDetailNurbsSpline(pointsList1);
                csvWriter.AddDetailCurves(curvesList1);
                csvWriter.AddDetailCurves(curvesList2);
                csvWriter.AddModelLine(point11, point12);
                csvWriter.AddModelArc(point11, point12, point13);
                csvWriter.AddModelEllipse(point11, point12, radiusY, mode);
                csvWriter.AddModelNurbsSpline(point11, point12);   // points 3 and 4 are optional
                csvWriter.AddModelNurbsSpline(point11, point12, point13);
                csvWriter.AddModelNurbsSpline(point11, point12, point13, point14);
                csvWriter.AddModelNurbsSpline(pointsList1);
                csvWriter.AddModelCurves(curvesList1);
                csvWriter.AddTopographySurface(point11, point12, point13);
                csvWriter.AddTopographySurface(point11, point12, point13, point14);
                csvWriter.AddTopographySurface(pointsList1);
                csvWriter.AddWall(point11, point12);
                csvWriter.AddWall(point11, point12, point13);
                csvWriter.AddWall(curvesList1);     // Plan list
                csvWriter.AddWall(curvesListList);  // Profile list of lists
                csvWriter.AddFloor(point11, point12, point13, point14);
                csvWriter.AddFloor(curvesListList);
                csvWriter.AddFamilyInstance(point11);
                csvWriter.AddColumn(point11);
                csvWriter.AddColumn(point11, point12);
                csvWriter.AddBeam(point11, point12);
                csvWriter.AddAdaptiveComponent(point11);  // points 2, 3, and 4 are optional
                csvWriter.AddAdaptiveComponent(point11, point12);
                csvWriter.AddAdaptiveComponent(point11, point12, point13);
                csvWriter.AddAdaptiveComponent(point11, point12, point13, point14);
                csvWriter.AddAdaptiveComponent(pointsList1);
                csvWriter.AddAreaBoundaryLine(point11, point12);                  // Line case
                csvWriter.AddAreaBoundaryLine(point11, point12, point13);         // Arc case
                csvWriter.AddAreaBoundaryLine(point11, point12, radiusY, mode);   // Ellipse case
                csvWriter.AddAreaBoundaryLine(pointsList1);                       // Spline case
                csvWriter.AddAreaBoundaryLine(curvesList1);                       // List of lines, arcs, ellipses, or splines in plan
                csvWriter.AddRoomSeparationLine(point11, point12);                // Line case
                csvWriter.AddRoomSeparationLine(point11, point12, point13);       // Arc case
                csvWriter.AddRoomSeparationLine(point11, point12, radiusY, mode); // Ellipse case
                csvWriter.AddRoomSeparationLine(pointsList1);                     // Spline case
                csvWriter.AddRoomSeparationLine(curvesList1);                     // List of lines, arcs, ellipses, or splines in plan
                csvWriter.AddArea(point11);
                csvWriter.AddRoom(point11);
                csvWriter.AddReferencePoint(point11);
                csvWriter.AddCurveByPoints(pointsList1);
                csvWriter.AddLoftForm(pointsListList);
                ////TODO Not handling this case for now.  It is not allowed in the specification and not sure how it got inot the sample data
                //csvWriter.AddFamilyExtrusion(curvesListList, "ExtrusionFamilyName", point11);
                //csvWriter.AddFamilyExtrusion(curvesListList, "ExtrusionFamilyName");
                //csvWriter.AddFamilyExtrusion(curvesListList, point11);
                //csvWriter.AddFamilyExtrusion(curvesListList);
                //
                // Modify Actions:
                csvWriter.ModifyParameterSet("ParameterName", "Value");
                csvWriter.ModifyCurtainGridUAdd(offsetPrimary);
                csvWriter.ModifyCurtainGridUAdd(offsetPrimary, offsetSecondary);
                csvWriter.ModifyCurtainGridVAdd(offsetPrimary);
                csvWriter.ModifyCurtainGridVAdd(offsetPrimary, offsetSecondary);
                csvWriter.ModifyMullionUAdd(offsetPrimary);
                csvWriter.ModifyMullionUAdd(offsetPrimary, offsetSecondary);
                csvWriter.ModifyMullionVAdd(offsetPrimary);
                csvWriter.ModifyMullionVAdd(offsetPrimary, offsetSecondary);

                // These commands can also be used but it is proably better to try to use one of the more compact forms above.

                // Use-Add Actions:
                csvWriter.UsePoints(point11, point12, point13, point14);
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddDetailNurbsSpline();
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddModelNurbsSpline();
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddAdaptiveComponent();
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddAreaBoundaryLine();   // Spline - Must follow UsePoints (Note: no simple form of spline is currently offered
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddRoomSeparationLine(); // Spline - Must follow UsePoints (Note: no simple form of spline is currently offered
                csvWriter.UsePoints(pointsList1);
                csvWriter.AddCurveByPoints();

                // Draw-Use-Add Actions:
                csvWriter.DrawCurveArray();          //This is non-combined form
                csvWriter.DrawLine(point11, point12);
                csvWriter.DrawArc(point11, point12, point13);
                csvWriter.AddWall();
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point11, point12);
                csvWriter.DrawArc(point11, point12, point13);
                csvWriter.AddFloor();
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point11, point12);
                csvWriter.DrawArc(point11, point12, point13);
                csvWriter.AddFamilyExtrusion("ExtrusionFamilyName", point11);
                csvWriter.DrawCurveArray();
                csvWriter.DrawLine(point11, point12);
                csvWriter.DrawArc(point11, point12, point13);
                csvWriter.AddFamilyExtrusion("ExtrusionFamilyName");
                csvWriter.DrawCurveArray(curvesList1);  //This is combined form
                csvWriter.AddFamilyExtrusion();

                // Model-Use-Add Actions:
                // (These examples are not complete)
                csvWriter.ModelReferenceArray();
                csvWriter.AddLoftForm();

                //  Write the file
                csvWriter.WriteFile();


                // ****************************************************************************************************************
                // ******************************************** End of Sample Code Section ****************************************
                // ****************************************************************************************************************

                MessageBox.Show("Process Completed", PROGRAM_NAME);

                return(true);
            }
            catch (Exception exception) {
                MessageBox.Show("Error in 'RunProcess()'.\nSystem message: " + exception.Message, PROGRAM_NAME);
                return(false);
            }
            finally {
                Cursor.Current = Cursors.Default;
            }
        }