Beispiel #1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            //var path = @"v109_lod1-door_bl1.rbm";
            var path = @"seagull_lod1-body.rbm";

            var model = new ModelFile();

            this._ModelPath = Path.GetDirectoryName(path);
            using (var input = File.OpenRead(path))
            {
                model.Deserialize(input);
            }

            this._Model = model;
            int i = this._Model.Blocks.Count;

            foreach (var block in model.Blocks)
            {
                ListViewItem item = new ListViewItem();
                item.Text = i.ToString(System.Globalization.CultureInfo.InvariantCulture) + ": " + block.GetType().Name;
                item.Tag  = block;
                this.blockListView.Items.Add(item);
                i++;
            }

            this.SetupCamera();
        }
Beispiel #2
0
        private void OnAddModelFile(object sender, EventArgs e)
        {
            if (this.modelOpenFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this._ModelPath = Path.GetDirectoryName(this.modelOpenFileDialog.FileName);

            var model = new ModelFile();

            using (var input = File.OpenRead(this.modelOpenFileDialog.FileName))
            {
                model.Deserialize(input);
            }

            int i = this._Model.Blocks.Count;

            foreach (var block in model.Blocks)
            {
                this._Model.Blocks.Add(block);

                ListViewItem item = new ListViewItem();
                item.Text = i.ToString(System.Globalization.CultureInfo.InvariantCulture) + ": " + block.GetType().Name;
                item.Tag  = block;
                this.blockListView.Items.Add(item);
                i++;
            }

            this.SetupCamera();
        }
Beispiel #3
0
 public void ParseNotModelFile2_Deserialize_ShouldThrowException()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         var filePath  = Path.Combine(GetTestDir(), "LinkXML1.txt");
         var modelFile = ModelFile.Deserialize(filePath);
     });
 }
Beispiel #4
0
        public void ParseModelFile2_Deserialize_ShouldParse()
        {
            var filePath  = Path.Combine(GetTestDir(), "ModelFileXML2.txt");
            var modelFile = ModelFile.Deserialize(filePath);

            Assert.AreEqual("IFCZIPModel.ifcZIP", modelFile.Name);
            Assert.AreEqual("files/Models/0eafb97a-621b-4565-9e2f-c78ab2c0c5f9.ifcZIP", modelFile.Location);
        }
Beispiel #5
0
        public void ParseModelFile1_Deserialize_ShouldParse()
        {
            var filePath  = Path.Combine(GetTestDir(), "ModelFileXML1.txt");
            var modelFile = ModelFile.Deserialize(filePath);

            Assert.AreEqual("StpFile.stp", modelFile.Name);
            Assert.AreEqual("files/Models/845f3197-4722-4248-b160-c6451f18db52.stp", modelFile.Location);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            var  mode     = Mode.Unknown;
            bool showHelp = false;

            var options = new OptionSet
            {
                { "e|export", "convert from binary to OBJ", v => SetOption(v, ref mode, Mode.Export) },
                { "i|import", "convert from OBJ to binary", v => SetOption(v, ref mode, Mode.Import) },
                { "h|help", "show this message and exit", v => showHelp = v != null },
            };
            List <string> extras;

            try
            {
                extras = options.Parse(args);
                if (extras.Count < 1)
                {
                    throw new NotSupportedException("you should provide a file as parameter");
                }
            }
            catch (OptionException e)
            {
                Console.Write("{0}: ", GetExecutableName());
                Console.WriteLine(e.Message);
                Console.WriteLine("Try `{0} --help' for more information.", GetExecutableName());
                return;
            }

            string inputPath = extras[0];

            if (mode == Mode.Unknown)
            {
                if (Path.GetExtension(extras[0]) == ".rbm")
                {
                    mode = Mode.Export;
                }
            }

            if (mode == Mode.Export)
            {
                using (var input = File.OpenRead(inputPath))
                {
                    ModelFile mdl = new ModelFile();
                    mdl.Deserialize(input);
                }
            }
            else
            {
                throw new NotImplementedException("TODO");
            }
        }