コード例 #1
0
ファイル: Class1.cs プロジェクト: hunterchristian/masonv2
        public static void PrintInscriptionsToDXFFile(List <BrickInscription> inscriptions)
        {
            foreach (BrickInscription inscription in inscriptions)
            {
                string brickEditionNumberStr = "#" + inscription.BrickEditionNumber.ToString();

                double brickEditionNumberWidthInInches = BrickInscription.GetTextWidthInInches(brickEditionNumberStr, 0.16557F);
                double countryWidthInInches            = BrickInscription.GetTextWidthInInches(inscription.Country);

                List <EntityObject> entities = new List <EntityObject>();

                MText donorName  = BrickInscription.CreateMTextAtPosition(inscription.DonorName, 0.41, 0.45);
                MText lylric1    = BrickInscription.CreateMTextAtPosition(inscription.LyricLine1, 0.41, 3.01);
                MText lylric2    = BrickInscription.CreateMTextAtPosition(inscription.LyricLine2, 0.41, 2.61);
                MText lylric3    = BrickInscription.CreateMTextAtPosition(inscription.LyricLine3, 0.41, 2.20);
                MText lylric4    = BrickInscription.CreateMTextAtPosition(inscription.LyricLine4, 0.41, 1.79);
                MText artistName = BrickInscription.CreateMTextAtPosition(inscription.ArtistName, 3.12, 1.14);
                Text  country    = BrickInscription.CreateTextAtPosition(inscription.Country, 5.13 - countryWidthInInches, 0.45);
                country.Alignment = TextAlignment.BaselineRight;
                Text brickEditionNumber = BrickInscription.CreateTextAtPosition(brickEditionNumberStr, 5.23 - brickEditionNumberWidthInInches, 3.22, 0.16557);
                brickEditionNumber.Alignment = TextAlignment.BaselineRight;

                entities.Add(donorName);
                entities.Add(lylric1);
                entities.Add(lylric2);
                entities.Add(lylric3);
                entities.Add(lylric4);
                entities.Add(artistName);
                entities.Add(country);
                entities.Add(brickEditionNumber);

                string docName = BrickInscription.GenerateFileNameFromInscription(inscription);
                BrickInscription.CreateDXFDocumentWithEntities(docName, entities);
            }
        }
コード例 #2
0
ファイル: Class1.cs プロジェクト: hunterchristian/masonv2
        public static List <BrickInscription> ParseBrickInscriptionsFromCSV(string csvFilePath, int brickEditionNumber)
        {
            List <BrickInscription> inscriptions = new List <BrickInscription>();

            using (TextFieldParser parser = new TextFieldParser(csvFilePath))
            {
                parser.TextFieldType = FieldType.Delimited;
                parser.SetDelimiters(",");

                string[] headerRow = parser.ReadFields();
                int      indexOfArtistNameColumn = BrickInscription.GetIndexOfArtistNameInHeaderRow(headerRow);
                while (!parser.EndOfData)
                {
                    //Process row
                    string[]         fields      = parser.ReadFields();
                    BrickInscription inscription = new BrickInscription(
                        fields[indexOfArtistNameColumn],
                        fields[indexOfArtistNameColumn + 1],
                        fields[indexOfArtistNameColumn + 2],
                        fields[indexOfArtistNameColumn + 3],
                        fields[indexOfArtistNameColumn + 4],
                        fields[indexOfArtistNameColumn + 5],
                        fields[indexOfArtistNameColumn + 6],
                        brickEditionNumber
                        );

                    inscriptions.Add(inscription);

                    brickEditionNumber++;
                }
            }

            return(inscriptions);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: hunterchristian/masonv2
        public static int Main(string[] args)
        {
            MessageBox.Show("Please select the CSV file containing the brick orders. Click OK to show file browser.", "Mason");
            string csvFilePath = Program.GetFilePathOfCSV();

            int brickEditionNumber = Program.ShowDialog(
                "Please enter a starting index for the brick edition numbers, e.g. 106",
                "Brick starting number"
                );

            List <BrickInscription> inscriptions = BrickInscription.ParseBrickInscriptionsFromCSV(csvFilePath, brickEditionNumber);

            BrickInscription.PrintInscriptionsToDXFFile(inscriptions);

            MessageBox.Show("Brick inscription generation complete. You can find the brick inscriptions in the following folder: " + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\generatedDXF", "Mason");

            return(0);
        }
コード例 #4
0
ファイル: Class1.cs プロジェクト: hunterchristian/masonv2
 private static string GenerateFileNameFromInscription(BrickInscription inscription)
 {
     return("#" + inscription.BrickEditionNumber.ToString() + "_" + inscription.DonorName + "_" + inscription.ArtistName + "_" + DateTime.Now.ToString("MM-dd-yyyy-h-mmtt") + new Random().Next().ToString() + ".dxf");
 }