Esempio n. 1
0
        protected void UpdateAssetElementFromInputs(DB.AppearanceAssetElement assetElement, T assetData)
        {
            // open asset for editing
            using (var scope = new DB.Visual.AppearanceAssetEditScope(assetElement.Document))
            {
                var editableAsset = scope.Start(assetElement.Id);

                UpdateAssetFromData(editableAsset, assetData);

                // commit the changes after all changes has been made
                scope.Commit(true);
            }
        }
Esempio n. 2
0
 public AppearanceAsset(DB.AppearanceAssetElement asset) : base(asset)
 {
 }
Esempio n. 3
0
        public static Dictionary <string, object> GetMaterialProperties(string materialname)
        {
            Revit.Elements.Material mat = Revit.Elements.Material.ByName(materialname);

            RVT.Material material = (RVT.Material)mat.InternalElement;


            // Get the active Document
            Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument;

            string appearancename = "None";
            List <Autodesk.Revit.DB.Parameter> appearances = new List <Autodesk.Revit.DB.Parameter>();

            if (material.AppearanceAssetId != Autodesk.Revit.DB.ElementId.InvalidElementId)
            {
                RVT.AppearanceAssetElement appearance = (RVT.AppearanceAssetElement)document.GetElement(material.AppearanceAssetId);
                appearancename = appearance.Name;

                foreach (RVT.Parameter parameter in appearance.Parameters)
                {
                    if (!appearances.Contains(parameter))
                    {
                        appearances.Add(parameter);
                    }
                }
            }

            string thermalname = "None";
            List <Autodesk.Revit.DB.Parameter> thermals = new List <Autodesk.Revit.DB.Parameter>();

            if (material.ThermalAssetId != Autodesk.Revit.DB.ElementId.InvalidElementId)
            {
                RVT.PropertySetElement thermal = (RVT.PropertySetElement)document.GetElement(material.ThermalAssetId);
                thermalname = thermal.Name;

                foreach (RVT.Parameter parameter in thermal.Parameters)
                {
                    if (!thermals.Contains(parameter))
                    {
                        thermals.Add(parameter);
                    }
                }
            }

            string structuralname = "None";
            List <Autodesk.Revit.DB.Parameter> structurals = new List <Autodesk.Revit.DB.Parameter>();

            if (material.StructuralAssetId != Autodesk.Revit.DB.ElementId.InvalidElementId)
            {
                RVT.PropertySetElement structural = (RVT.PropertySetElement)document.GetElement(material.StructuralAssetId);
                structuralname = structural.Name;

                foreach (RVT.Parameter parameter in structural.Parameters)
                {
                    if (!structurals.Contains(parameter))
                    {
                        structurals.Add(parameter);
                    }
                }
            }

            return(new Dictionary <string, object>
            {
                { "Name", material.Name },
                { "Id", material.Id.IntegerValue },
                { "Category", material.MaterialCategory },
                { "Class", material.MaterialClass },
                { "Transparency", material.Transparency },
                { "Smoothness", material.Smoothness },
                { "Shininess", material.Shininess },
                { "Color", material.Color },
                { "Appearance Name", appearancename },
                { "Appearance Parameters", appearances },
                { "Structural Name", structuralname },
                { "Structural Parameters", structurals },
                { "Thermal Name", thermalname },
                { "Thermal Parameters", thermals },
            });
        }