Example #1
0
        public static List <Elms> Read(string ifcFileName)
        {
            var manager = new IfcManager.Core.IfcManager();

            if (!FileOp.isFileExist(ifcFileName))
            {
                Message.Message Msg = new Message.Message(); Msg.F("IFC.Read: no file", ifcFileName);
            }

            log.Info("TRACE: Read(\"" + ifcFileName + "\"");

            manager.init(ifcFileName, schemaName);

            List <IfcManager.Core.IfcManager.IfcElement> elements = new List <IfcManager.Core.IfcManager.IfcElement>();

            elements = manager.getElementsByProperty("NetVolume");
            IFC.MergeIfcToElmAttSet(elements);

            elements.Clear();
            elements = manager.getElementsByProperty("Weight");
            IFC.MergeIfcToElmAttSet(elements);

            elements.Clear();
            elements = manager.getElementsByMaterials();
            IFC.MergeIfcToElmAttSet(elements);

            elements.Clear();
            elements = manager.getElementsByProperty("Profile");
            IFC.MergeIfcToElmAttSet(elements);

            List <ElmAttributes.ElmAttSet> result = new List <ElmAttributes.ElmAttSet>();

            result = ElmAttributes.ElmAttSet.Elements.Values.ToList();
            foreach (var elm in result)
            {
                string[] matToSplit = elm.mat.Split('/');
                switch (matToSplit.Count())
                {
                case 2:
                    elm.mat_type = matToSplit[0];
                    elm.mat      = matToSplit[1];
                    break;

                case 1:
                    elm.mat_type = "STEEL";
                    elm.prf      = elm.mat; // А400 - это арматура; почемуто ее марку указывают как материал
                                            //..здесь еще надо разобраться с ГОСТ-5781
                                            //..и присвоить значения элемента mat, prf и др
                    break;

                default:
                    Message.Message Msg = new Message.Message(); Msg.F("IFC error Material Parse", elm.mat);
                    break;
                }
            }
            result.Sort();
            return(result);
        }
Example #2
0
        static int Main(string[] args)
        {
            var manager = new IfcManager.Core.IfcManager();

//            args = new String[3];
//            args[0] = "out-2.ifc";
//            args[1] = "-p";
//            args[2] = "Weight";
//            args[2] = "-xml";

            if (args.Length < 2)
            {
                System.Console.WriteLine("Please enter file name.");
                System.Console.WriteLine("Usage: \tIfcManagerAppl <file name> -c [<-xml> or <-ifcxml>] // convert to ifcxml (for IFC2X3) or xml (for IFC4) \r\n" +
                                         "\t\t\tor\r\n" +
                                         "\tIfcManagerAppl <fileName> -p <propertyName> // find of element(s) containing property");
                return(1);
            }
            else
            {
                try
                {
                    manager.init(args[0]);
                    switch (args[1])
                    {
                    case "-c": manager.convertIfcFile(args[0], (args.Length > 2) ? args[2] : "-ifcxml");
                        break;

                    case "-p":
                        List <String> objectNameList = manager.getElementsByProperty((args.Length > 2) ? args[2] : null);
                        printList(objectNameList);
                        break;

                    default: System.Console.WriteLine("Error: incorrect key");
                        break;
                    }
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine("Error: " + ex.Message);
                }
                finally
                {
                    manager.closeModel();
                }
                return(0);
            }
        }