public void SetFederationEnvironment(XbimReferencedModel refModel)
 {
     var federationColours = new XbimColourMap(StandardColourMaps.Federation);
     var key = refModel.DocumentInformation.DocumentOwner.RoleName();
     _colour = federationColours[key];
     
 }
 public void SetFederationEnvironment(XbimReferencedModel refModel)
 {
     
 }
Пример #3
0
 public FederatedModelItem(XbimReferencedModel refModel)
 {
     this.refModel = refModel;
 }
 public XbimReferencedModelViewModel(XbimReferencedModel model)
 {
     ReferencedModel = model;
 }
        /// <summary>
        /// Validates all data and creates model. 
        /// Provide a "XbimModel model = DataContext as XbimModel;"
        /// </summary>
        /// <returns>Returns XbimReferencedModel == null </returns>
        public bool TryBuild(XbimModel model)
        {
            //it's already build, so no need to recreate it
            if (ReferencedModel != null)
                return true;

            if (string.IsNullOrWhiteSpace(Name))
                return false;
            else
            {
                string ext = System.IO.Path.GetExtension(Name).ToLowerInvariant();
                using (XbimModel refM = new XbimModel())
                {
                    if (ext != ".xbim")
                    {
                        refM.CreateFrom(Name, null, null, true);
                        XbimMesher.GenerateGeometry(refM);
                        Name = System.IO.Path.ChangeExtension(Name, "xbim");
                    }
                }

                _xbimReferencedModel = model.AddModelReference(Name, OrganisationName, OrganisationRole);
            }

            if (_xbimReferencedModel != null)
            {
                //refresh all
                OnPropertyChanged("Identifier");
                OnPropertyChanged("Name");
                OnPropertyChanged("OrganisationName");
                OnPropertyChanged("OrganisationRole");
            }
            return ReferencedModel != null;
        }
        /// <summary>
        /// Validates all data and creates model. 
        /// Provide a "XbimModel model = DataContext as XbimModel;"
        /// </summary>
        /// <returns>Returns XbimReferencedModel == null </returns>
        public bool TryBuild(XbimModel model)
        {
            //it's already build, so no need to recreate it
            if (ReferencedModel != null)
                return true;

		    if (string.IsNullOrWhiteSpace(Name))
                return false;
            var ext = Path.GetExtension(Name).ToLowerInvariant();
            using (var refM = new XbimModel())
            {
                var xbimName = Path.ChangeExtension(Name, "xbim");
                if (ext != ".xbim" && !File.Exists(xbimName))
                {
                    refM.CreateFrom(Name, null, null, true);
                    var m3D = new Xbim3DModelContext(refM);
                    m3D.CreateContext(geomStorageType: XbimGeometryType.PolyhedronBinary, progDelegate: null, adjustWCS: false);
                    Name = Path.ChangeExtension(Name, "xbim");
                }
                Name = xbimName;
            }
            _xbimReferencedModel = model.AddModelReference(Name, OrganisationName, OrganisationRole);

            if (_xbimReferencedModel == null) 
                return ReferencedModel != null;
            //refresh all
            OnPropertyChanged("Identifier");
            OnPropertyChanged("Name");
            OnPropertyChanged("OrganisationName");
            OnPropertyChanged("OrganisationRole");
            return ReferencedModel != null;
        }