Exemple #1
0
        public void Execute(UIApplication app)
        {
            UIDocument uiDoc = app.ActiveUIDocument;
            Document   doc   = uiDoc.Document;

            this.application = app.Application;

            Debug("[STREAMVR] EXECUTING STREAMING SERVER EVENT!1!!");

            this.Converter              = new GenericConverter(Debug);
            this.Command_GetAll         = new GetAll(Debug, this.Converter);
            this.Command_Get            = new Get(Debug, this.Converter);
            this.Command_Set            = new Set(Debug, uiDoc, this.Converter);
            this.Command_Paint          = new Paint(Debug, this.Converter);
            this.Command_Create         = new Create(Debug, this.Converter);
            this.Command_Export         = new Export(Debug, this.Converter, StreamVRApp.Instance.ModelServerURL);
            this.Command_ExportMaterial = new ExportMaterial(Debug, this.Converter, StreamVRApp.Instance.ModelServerURL);
            this.Command_Delete         = new Delete(Debug, this.Converter);

            Message request = StreamVRApp.Instance.CurrentRequest;

            Debug("[STREAMVR] REQUEST: " + JsonConvert.SerializeObject(request));

            Message response = HandleClientRequest(doc, request);

            StreamVRApp.Instance.CurrentResponse = response;
        }
Exemple #2
0
 public _IClosure4_333(GenericReflector _enclosing, int id, IGenericConverter converter
                       , string name)
 {
     this._enclosing = _enclosing;
     this.id         = id;
     this.converter  = converter;
     this.name       = name;
 }
        public void RegisterNetTypeHandler(NetTypeHandler handler)
        {
            handler.RegisterReflector(_reflector);
            IGenericConverter converter = (handler is IGenericConverter) ? (IGenericConverter
                                                                            )handler : null;

            RegisterBuiltinHandler(handler.GetID(), handler, true, handler.GetName(), converter
                                   );
        }
Exemple #4
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uiDoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uiDoc.Document;

            this.application = commandData.Application.Application;

            this.Converter      = new GenericConverter(Debug);
            this.Command_GetAll = new GetAll(Debug, this.Converter);
            this.Command_Get    = new Get(Debug, this.Converter);
            this.Command_Set    = new Set(Debug, uiDoc, this.Converter);
            this.Command_Paint  = new Paint(Debug, this.Converter);
            this.Command_Create = new Create(Debug, this.Converter);
            this.Command_Export = new Export(Debug, this.Converter);

            this.serverUrl     = "192.168.0.119:7002";
            this.userName      = this.application.Username;
            this.roomCode      = "123456";
            this.startingViews = GetView3Ds(doc);
            this.startingView  = this.startingViews.FirstOrDefault(e => e.Name == "3D View 3");

            Debug("SERVER CONN");
            Debug(serverUrl);
            Debug(userName);
            Debug(roomCode);

            StreamVRUI startUI = CreateUI(false);
            bool?      start   = startUI.ShowDialog();

            if (start != true)
            {
                return(Result.Cancelled);
            }

            this.serverUrl    = startUI.ServerURL;
            this.roomCode     = startUI.RoomCode;
            this.startingView = this.startingViews.FirstOrDefault(v => v.Name == startUI.StartingView);

            this.CreateShutdownForm();

            this.ListenForMessages(uiDoc);

            return(Result.Succeeded);
        }
Exemple #5
0
		private void RegisterBuiltinHandler(int id, IBuiltinTypeHandler typeHandler, bool
			 registerPrimitiveClass, string primitiveName, IGenericConverter converter)
		{
			typeHandler.RegisterReflector(_reflector);
			if (primitiveName == null)
			{
				primitiveName = typeHandler.ClassReflector().GetName();
			}
			if (registerPrimitiveClass)
			{
				_reflector.RegisterPrimitiveClass(id, primitiveName, converter);
			}
			IReflectClass classReflector = typeHandler.ClassReflector();
			PrimitiveTypeMetadata classMetadata = new PrimitiveTypeMetadata(Container(), typeHandler
				, id, classReflector);
			Map(id, classMetadata, classReflector);
			if (typeHandler is PrimitiveHandler)
			{
				IReflectClass primitiveClassReflector = ((PrimitiveHandler)typeHandler).PrimitiveClassReflector
					();
				if (primitiveClassReflector != null)
				{
					MapPrimitive(0, classMetadata, primitiveClassReflector);
				}
			}
		}
Exemple #6
0
 /// <summary>Registers primitive class</summary>
 /// <param name="id">class id</param>
 /// <param name="name">class name</param>
 /// <param name="converter">class converter</param>
 public virtual void RegisterPrimitiveClass(int id, string name, IGenericConverter
                                            converter)
 {
     WithLock(new _IClosure4_333(this, id, converter, name));
 }
Exemple #7
0
		internal virtual void SetConverter(IGenericConverter converter)
		{
			_converter = converter;
		}
Exemple #8
0
 public Set(Action <string> log, UIDocument uiDocument, IGenericConverter converter)
 {
     _log        = log;
     _uiDocument = uiDocument;
     _converter  = converter;
 }
Exemple #9
0
 public _IClosure4_333(GenericReflector _enclosing, int id, IGenericConverter converter
     , string name)
 {
     this._enclosing = _enclosing;
     this.id = id;
     this.converter = converter;
     this.name = name;
 }
Exemple #10
0
 public Create(Action <string> log, IGenericConverter converter)
 {
     _log       = log;
     _converter = converter;
 }
        private void RegisterBuiltinHandler(int id, IBuiltinTypeHandler typeHandler, bool
                                            registerPrimitiveClass, string primitiveName, IGenericConverter converter)
        {
            typeHandler.RegisterReflector(_reflector);
            if (primitiveName == null)
            {
                primitiveName = typeHandler.ClassReflector().GetName();
            }
            if (registerPrimitiveClass)
            {
                _reflector.RegisterPrimitiveClass(id, primitiveName, converter);
            }
            IReflectClass         classReflector = typeHandler.ClassReflector();
            PrimitiveTypeMetadata classMetadata  = new PrimitiveTypeMetadata(Container(), typeHandler
                                                                             , id, classReflector);

            Map(id, classMetadata, classReflector);
            if (typeHandler is PrimitiveHandler)
            {
                IReflectClass primitiveClassReflector = ((PrimitiveHandler)typeHandler).PrimitiveClassReflector
                                                            ();
                if (primitiveClassReflector != null)
                {
                    MapPrimitive(0, classMetadata, primitiveClassReflector);
                }
            }
        }
 public void Add(IGenericConverter converter)
 {
     converters.AddFirst(converter);
 }
 public void AddConverter(IGenericConverter converter)
 {
     _converters.Add(converter);
     _converterCache.Clear();
 }
Exemple #14
0
        public virtual Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uiDoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uiDoc.Document;

            this.application = commandData.Application.Application;

            Debug("[STREAMVR] EXECUTING STREAMING SERVER EVENT!1!!");

            this.Converter = new GenericConverter(Debug);

            Debug("Exporting to " + StreamVRApp.Instance.ModelServerURL);
            IBaseCommand command = new ExportMaterial(Debug, this.Converter, StreamVRApp.Instance.ModelServerURL);

            IEnumerable <string> materials = new FilteredElementCollector(doc).
                                             OfClass(typeof(Material)).
                                             Select(e => e.Id.ToString());

            int success    = 0;
            int noMaterial = 0;
            int failure    = 0;

            Debug("EXPORTING " + materials.Count() + " MATERIALS");

            foreach (string id in materials)
            {
                try
                {
                    Message response = command.Execute(doc, new Message
                    {
                        Type  = "EXPORT_MATERIAL",
                        Reply = null,
                        Data  = JsonConvert.SerializeObject(new
                        {
                            Id = id
                        })
                    });

                    if (response.Type == "EMPTY")
                    {
                        noMaterial++;
                        continue;
                    }

                    if (response.Type == "ERROR")
                    {
                        throw new Exception(response.Data);
                    }

                    Debug(response.Data);
                    success++;
                }
                catch (Exception e)
                {
                    Debug($"Error 2 {id} {e.ToString()}");
                    failure++;
                }
            }

            Debug("EXPORT RESULTS " + JsonConvert.SerializeObject(new
            {
                Successes    = success,
                NoExportable = noMaterial,
                Failures     = failure
            }));

            TaskDialog mainDialog = new TaskDialog("Export Report");

            mainDialog.MainInstruction = "Export Report";
            mainDialog.MainContent     = $"Successes: {success}\nNot Exportable: {noMaterial}\nFailures: {failure}";
            TaskDialogResult tResult = mainDialog.Show();

            return(Result.Succeeded);
        }
Exemple #15
0
 public Export(Action <string> log, IGenericConverter converter, string modelServerUrl)
 {
     _log            = log;
     _converter      = converter;
     _modelServerUrl = modelServerUrl;
 }
Exemple #16
0
 /// <summary>Registers primitive class</summary>
 /// <param name="id">class id</param>
 /// <param name="name">class name</param>
 /// <param name="converter">class converter</param>
 public virtual void RegisterPrimitiveClass(int id, string name, IGenericConverter
     converter)
 {
     WithLock(new _IClosure4_333(this, id, converter, name));
 }
 internal virtual void SetConverter(IGenericConverter converter)
 {
     _converter = converter;
 }
Exemple #18
0
 public GetAll(Action <string> log, IGenericConverter converter)
 {
     _log       = log;
     _converter = converter;
 }