Exemplo n.º 1
0
        public void DrawBlocks(Database db, IEnumerable <InsertBlockBase> blocks)
        {
            //setup default layers
            var defultLayers = new LayerCreator();

            defultLayers.Layers();

            var insertBlockTable = new InsertBlockTable(db);

            foreach (var block in blocks)
            {
                insertBlockTable.InsertBlock(block);
            }

            MoveToBottom.SendToBackBlock();
            //MoveToBottom.SendToBackLine();
            SendClass.SendRegen();
            SendClass.SendZoomExtents();
        }
Exemplo n.º 2
0
        public void BlockSearch()
        {
            var    db = Application.DocumentManager.MdiActiveDocument.Database;
            var    blockDeserialize = new BlockDeserializer();
            string path             = @"E:\Jszomor\source\repos\jszomorCAD\jCAD.PID_Builder\Autocad PID blocks work in progress.dwg";
            // Copy blocks from sourcefile into opened file
            var copyBlock = new CopyBlock();

            #region btrNamesToCopy
            var eqType = new[] {
                "aeration diffuzer",
                "arrow",
                "alkalinity_chamber",
                "blower",
                "break",
                "chamber",
                "chamber circular",
                "chamber description",
                "channel",
                "channel gate",
                "channel2",
                "clarifier circular",
                "Clarifier Equipment",
                "clarifier longitudial",
                "collector",
                "controll tag e",
                "digester",
                "digester cap",
                "drum filter",
                "filter",
                "filter2",
                "Gas equipments",
                "gas flame",
                "gas holder",
                "grease_coll_chmbr",
                "heating",
                "instrumentairheaderarrow",
                "instrumentation tag",
                "leachet_coll_chmbr",
                "moister trap",
                "TWT",
                "ozone unit",
                //"PID-PS-FRAME",
                "pipe",
                "pipe2",
                "poli dosing",
                "pump",
                "mixer",
                "pr_cl_chmbr",
                "reactor",
                "RefALSewage",
                "RefALPoly",
                "RefALPotable",
                "RefALRecSludge",
                "RefARRecSludge",
                "RefALTransport",
                "RefARRawSludge",
                "RefARSewage",
                "RefARNaturalGas",
                "RefALRawSludge",
                "RefPIDEfluent",
                "RefPIDInfluent",
                "RefAL1AirToBiofilter",
                "RefAL1AirfromSludge",
                "RefAR1AirfromSludge",
                "RefAL2UtilityWater",
                "RefAR2UtilityWater",
                "RefAR3UtilityWater",
                "RefAL3UtilityWater",
                "RefAR4Leachate",
                "RefAL5Leachate",
                "RefAL6WasteSludge",
                "RefAR6WasteSludge",
                "RefAL7WasteAir",
                "RefAR7WasteAir",
                "RefAR10Sludge",
                "RefAR12Gas",
                "RefAR13Sludge",
                "RefAR14Water",
                "RefAL15Water",
                "RefAR16Water",
                "RefAL17Water",
                "RefAR18Water",
                "RefAL19Water",
                "RefAL22WasteSludge",
                "RefAR22WasteSludge",
                "RefAL23Leachate",
                "RefAR24UtilityWater",
                "RefAL25UtilityWater",
                "RefAR25UtilityWater",
                "RefAR26Leachate",
                "RefAL26Leachate",
                "sand trap",
                "screen",
                "screening press",
                "sst2_chmbr",
                "sst2Dig",
                "screening press",
                "sludge dewatering",
                "tank - vessel",
                "valve",
                "Vortex_grit_chamber",
                "Vortex_sand_chamber",
                "vortexEQ"
            };
            #endregion

            string[] btrNamesToCopy = eqType.Distinct().ToArray();

            copyBlock.CopyBlockTable(db, path, btr =>
            {
                System.Diagnostics.Debug.Print(btr.Name);
                return(btrNamesToCopy.Contains(btr.Name));
            });

            var defultLayers = new LayerCreator();
            defultLayers.Layers();

            var insertBlock = new InsertBlock(db);
            var filePath    = @"E:\Jszomor\source\repos\jszomorCAD\jCAD.PID_Builder\JsonPIDBuild.json";
            var jsonPID     = blockDeserialize.ReadJsonData(filePath);

            //var sBlockName = jsonPID.Blocks.Select(b => b.Misc.BlockName);
            var blockNames =
                from b in jsonPID.Blocks
                select b.Misc.BlockName;

            foreach (var blockName in btrNamesToCopy)
            {
                try
                {
                    insertBlock.PlaceBlocksByName(jsonPID, blockName);
                    //MoveToBottom.SendToBackBlock();
                }
                catch (ArgumentNullException)
                {
                    // ignore
                }
            }

            var    insertBlockTable = new BlockTableRead(db);
            string fileName         = "JsonPIDBuildCopy.json";
            insertBlockTable.ReadBtrForSeri(db, fileName);
            //var blockDeserialize = new BlockDeserialize();
            //var eqType = blockDeserialize.BlockSearch("Name");

            //System.Diagnostics.Debug.Print($"BlockName: {eqType}");
        }