added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,81 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>MaterialProperties.dll</Assembly>
<ClientId>69ddbdbf-769b-4b24-a6c2-f1747929f54c</ClientId>
<FullClassName>Revit.SDK.Samples.MaterialProperties.CS.MaterialProperties</FullClassName>
<Text>Material Properties (CS)</Text>
<Description>Get the material physical properties of the selected beam, column or brace.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,669 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Data;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Material = Autodesk.Revit.DB.Material;
namespace Revit.SDK.Samples.MaterialProperties.CS
{
/// <summary>
/// get the material physical properties of the selected beam, column or brace
/// get all material types and their sub types to the user and then change the material type of the selected beam to the one chosen by the user
/// with a selected concrete beam, column or brace, change its unit weight to 145 P/ft3
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
public class MaterialProperties : Autodesk.Revit.UI.IExternalCommand
{
const double ToMetricUnitWeight = 0.010764; //coefficient of converting unit weight from internal unit to metric unit
const double ToMetricStress = 0.334554; //coefficient of converting stress from internal unit to metric unit
const double ToImperialUnitWeight = 6.365827; //coefficient of converting unit weight from internal unit to imperial unit
const double ChangedUnitWeight = 14.5; //the value of unit weight of selected component to be set
Autodesk.Revit.UI.UIApplication m_revit = null;
Hashtable m_allMaterialMap = new Hashtable(); //hashtable contains all materials with index of their ElementId
FamilyInstance m_selectedComponent = null; //selected beam, column or brace
Parameter m_currentMaterial = null; //current material of selected beam, column or brace
Material m_cacheMaterial;
ArrayList m_steels = new ArrayList(); //arraylist of all materials belonging to steel type
ArrayList m_concretes = new ArrayList(); //arraylist of all materials belonging to concrete type
/// <summary>
/// get the material type of selected element
/// </summary>
public StructuralAssetClass CurrentType
{
get
{
Material material = CurrentMaterial as Material;
int materialId = 0;
if (material != null)
{
materialId = material.Id.IntegerValue;
}
if (materialId <= 0)
{
return StructuralAssetClass.Generic;
}
Autodesk.Revit.DB.Material materialElem = (Autodesk.Revit.DB.Material)m_allMaterialMap[materialId];
if (null == materialElem)
{
return StructuralAssetClass.Generic;
}
return GetMaterialType(materialElem);
}
}
/// <summary>
/// get the material attribute of selected element
/// </summary>
public object CurrentMaterial
{
get
{
m_cacheMaterial = GetCurrentMaterial();
return m_cacheMaterial;
}
}
/// <summary>
/// arraylist of all materials belonging to steel type
/// </summary>
public ArrayList SteelCollection
{
get
{
return m_steels;
}
}
/// <summary>
/// arraylist of all materials belonging to concrete type
/// </summary>
public ArrayList ConcreteCollection
{
get
{
return m_concretes;
}
}
/// <summary>
/// three basic material types in Revit
/// </summary>
public ArrayList MaterialTypes
{
get
{
ArrayList typeAL = new ArrayList();
typeAL.Add("Undefined");
typeAL.Add("Basic");
typeAL.Add("Generic");
typeAL.Add("Metal");
typeAL.Add("Concrete");
typeAL.Add("Wood");
typeAL.Add("Liquid");
typeAL.Add("Gas");
typeAL.Add("Plastic");
return typeAL;
}
}
/// <summary>
/// Implement this method as an external command for Revit.
/// </summary>
/// <param name="commandData">An object that is passed to the external application
/// which contains data related to the command,
/// such as the application object and active view.</param>
/// <param name="message">A message that can be set by the external application
/// which will be displayed if a failure or cancellation is returned by
/// the external command.</param>
/// <param name="elements">A set of elements to which the external application
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
/// <returns>Return the status of the external command.
/// A result of Succeeded means that the API external method functioned as expected.
/// Cancelled can be used to signify that the user cancelled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Autodesk.Revit.UI.UIApplication revit = commandData.Application;
m_revit = revit;
if (!Init())
{
// there must be exactly one beam, column or brace selected
TaskDialog.Show("Revit", "You should select only one beam, structural column or brace.");
return Autodesk.Revit.UI.Result.Failed;
}
Transaction documentTransaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "Document");
documentTransaction.Start();
MaterialPropertiesForm displayForm = new MaterialPropertiesForm(this);
try
{
displayForm.ShowDialog();
}
catch
{
TaskDialog.Show("Revit", "Sorry that your command failed.");
return Autodesk.Revit.UI.Result.Failed;
}
documentTransaction.Commit();
return Autodesk.Revit.UI.Result.Succeeded;
}
/// <summary>
/// get a datatable contains parameters' information of certain element
/// </summary>
/// <param name="o">Revit element</param>
/// <param name="substanceKind">the material type of this element</param>
/// <returns>datatable contains parameters' names and values</returns>
public DataTable GetParameterTable(object o, StructuralAssetClass substanceKind)
{
//create an empty datatable
DataTable parameterTable = CreateTable();
//if failed to convert object
Autodesk.Revit.DB.Material material = o as Autodesk.Revit.DB.Material;
if (material == null)
{
return parameterTable;
}
Parameter temporaryAttribute = null; // hold each parameter
string temporaryValue = ""; // hold each value
#region Get all material element parameters
//- Behavior
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_BEHAVIOR);
switch (temporaryAttribute.AsInteger())
{
case 0:
AddDataRow(temporaryAttribute.Definition.Name, "Isotropic", parameterTable);
break;
case 1:
AddDataRow(temporaryAttribute.Definition.Name, "Orthotropic", parameterTable);
break;
default:
AddDataRow(temporaryAttribute.Definition.Name, "None", parameterTable);
break;
}
//- Young's Modulus
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD1);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD2);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD3);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
// - Poisson Modulus
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD1);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD2);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD3);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
// - Shear Modulus
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD1);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD2);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD3);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Thermal Expansion Coefficient
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF1);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF2);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF3);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Unit Weight
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_UNIT_WEIGHT);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Bending Reinforcement
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_BENDING_REINFORCEMENT);
if (null != temporaryAttribute)
{
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
}
//- Shear Reinforcement
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_REINFORCEMENT);
if (null != temporaryAttribute)
{
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
}
//- Resistance Calc Strength
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_RESISTANCE_CALC_STRENGTH);
if (null != temporaryAttribute)
{
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
}
// For Steel only:
if (StructuralAssetClass.Metal == substanceKind)
{
//- Minimum Yield Stress
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_MINIMUM_YIELD_STRESS);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Minimum Tensile Strength
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_MINIMUM_TENSILE_STRENGTH);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Reduction Factor
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_REDUCTION_FACTOR);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
}
// For Concrete only:
if (StructuralAssetClass.Concrete == substanceKind)
{
//- Concrete Compression
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_CONCRETE_COMPRESSION);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Lightweight
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_LIGHT_WEIGHT);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
//- Shear Strength Reduction
temporaryAttribute = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_STRENGTH_REDUCTION);
temporaryValue = temporaryAttribute.AsValueString();
AddDataRow(temporaryAttribute.Definition.Name, temporaryValue, parameterTable);
}
#endregion
return parameterTable;
}
/// <summary>
/// Update cache material
/// </summary>
/// <param name="obj">new material</param>
public void UpdateMaterial(object obj)
{
if (null == obj)
{
throw new ArgumentNullException();
}
{
m_cacheMaterial = obj as Material;
}
}
/// <summary>
/// set the material of selected component
/// </summary>
public void SetMaterial()
{
if (null == m_cacheMaterial || null == m_currentMaterial)
{
return;
}
Autodesk.Revit.DB.ElementId identity = m_cacheMaterial.Id;
m_currentMaterial.Set(identity);
}
/// <summary>
/// change unit weight of selected component to 14.50 kN/m3
/// </summary>
public bool ChangeUnitWeight()
{
Autodesk.Revit.DB.Material material = GetCurrentMaterial();
if (material == null)
{
return false;
}
Parameter weightPara = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_UNIT_WEIGHT);
weightPara.Set(ChangedUnitWeight / ToMetricUnitWeight);
return true;
}
/// <summary>
/// firstly, check whether only one beam, column or brace is selected
/// then initialize some member variables
/// </summary>
/// <returns>is the initialize successful</returns>
private bool Init()
{
//selected 0 or more than 1 component
if (m_revit.ActiveUIDocument.Selection.GetElementIds().Count != 1)
{
return false;
}
try
{
GetSelectedComponent();
//selected component isn't beam, column or brace
if (m_selectedComponent == null)
{
return false;
}
//initialize some member variables
GetAllMaterial();
return true;
}
catch
{
return false;
}
}
/// <summary>
/// get current material of selected component
/// </summary>
private Autodesk.Revit.DB.Material GetCurrentMaterial()
{
if (null != m_cacheMaterial)
return m_cacheMaterial;
int identityValue = 0;
if (m_currentMaterial != null)
identityValue = m_currentMaterial.AsElementId().IntegerValue; //get the value of current material's ElementId
//material has no value
if (identityValue <= 0)
{
return null;
}
Autodesk.Revit.DB.Material material = (Autodesk.Revit.DB.Material)m_allMaterialMap[identityValue];
return material;
}
/// <summary>
/// get selected beam, column or brace
/// </summary>
/// <returns></returns>
private void GetSelectedComponent()
{
ElementSet componentCollection = new ElementSet();
foreach (ElementId elementId in m_revit.ActiveUIDocument.Selection.GetElementIds())
{
componentCollection.Insert(m_revit.ActiveUIDocument.Document.GetElement(elementId));
}
if (componentCollection.Size != 1)
{
return;
}
//if the selection is a beam, column or brace, find out its parameters for display
foreach (object o in componentCollection)
{
FamilyInstance component = o as FamilyInstance;
if (component == null)
{
continue;
}
if (component.StructuralType == StructuralType.Beam
|| component.StructuralType == StructuralType.Brace
|| component.StructuralType == StructuralType.Column)
{
//get selected beam, column or brace
m_selectedComponent = component;
}
//selection is a beam, column or brace, find out its parameters
foreach (object p in component.Parameters)
{
Parameter attribute = p as Parameter;
if (attribute == null)
{
continue;
}
string parameterName = attribute.Definition.Name;
// The "Beam Material" and "Column Material" family parameters have been replaced
// by the built-in parameter "Structural Material".
//if (parameterName == "Column Material" || parameterName == "Beam Material")
if (parameterName == "Structural Material")
{
//get current material of selected component
m_currentMaterial = attribute;
break;
}
}
}
}
/// <summary>
/// get all materials exist in current document
/// </summary>
/// <returns></returns>
private void GetAllMaterial()
{
FilteredElementCollector collector = new FilteredElementCollector(m_revit.ActiveUIDocument.Document);
FilteredElementIterator i = collector.OfClass(typeof(Material)).GetElementIterator();
i.Reset();
bool moreValue = i.MoveNext();
while (moreValue)
{
Autodesk.Revit.DB.Material material = i.Current as Autodesk.Revit.DB.Material;
if (material == null)
{
moreValue = i.MoveNext();
continue;
}
//get the type of the material
StructuralAssetClass materialType = GetMaterialType(material);
//add materials to different ArrayList according to their types
switch (materialType)
{
case StructuralAssetClass.Metal:
{
m_steels.Add(new MaterialMap(material));
break;
}
case StructuralAssetClass.Concrete:
{
m_concretes.Add(new MaterialMap(material));
break;
}
default:
{
break;
}
}
//map between materials and their elementId
m_allMaterialMap.Add(material.Id.IntegerValue, material);
moreValue = i.MoveNext();
}
}
/// <summary>
/// Create an empty table with parameter's name column and value column
/// </summary>
/// <returns></returns>
private DataTable CreateTable()
{
// Create a new DataTable.
DataTable propDataTable = new DataTable("ParameterTable");
// Create parameter column and add to the DataTable.
DataColumn paraDataColumn = new DataColumn();
paraDataColumn.DataType = System.Type.GetType("System.String");
paraDataColumn.ColumnName = "Parameter";
paraDataColumn.Caption = "Parameter";
paraDataColumn.ReadOnly = true;
// Add the column to the DataColumnCollection.
propDataTable.Columns.Add(paraDataColumn);
// Create value column and add to the DataTable.
DataColumn valueDataColumn = new DataColumn();
valueDataColumn.DataType = System.Type.GetType("System.String");
valueDataColumn.ColumnName = "Value";
valueDataColumn.Caption = "Value";
valueDataColumn.ReadOnly = false;
propDataTable.Columns.Add(valueDataColumn);
return propDataTable;
}
/// <summary>
/// add one row to datatable of parameter
/// </summary>
/// <param name="parameterName">name of parameter</param>
/// <param name="parameterValue">value of parameter</param>
/// <param name="parameterTable">datatable to be added row</param>
private void AddDataRow(string parameterName, string parameterValue, DataTable parameterTable)
{
DataRow newRow = parameterTable.NewRow();
newRow["Parameter"] = parameterName;
newRow["Value"] = parameterValue;
parameterTable.Rows.Add(newRow);
}
/// <summary>
/// Get the material type via giving material.
/// According to my knowledge, the material type can be retrieved by two ways now:
/// 1. If the PropertySetElement exists, retrieve it by PHY_MATERIAL_PARAM_CLASS parameter. (via PropertySetElement class)
/// 2. If it's indenpendent, retrieve it by PHY_MATERIAL_PARAM_TYPE parameter(via Material class)
/// </summary>
/// <param name="material"></param>
/// <returns></returns>
private StructuralAssetClass GetMaterialType(Material material)
{
if (material.StructuralAssetId != ElementId.InvalidElementId)
{
PropertySetElement propElem = m_revit.ActiveUIDocument.Document.GetElement(material.StructuralAssetId) as PropertySetElement;
Parameter propElemPara = propElem.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_CLASS);
if (propElemPara != null)
{
return (StructuralAssetClass)propElemPara.AsInteger();
}
}
return StructuralAssetClass.Undefined;
//ElementId propElemId = material.GetMaterialAspectPropertySet(MaterialAspect.Structural);
//if (ElementId.InvalidElementId == propElemId)
//{
// Parameter independentPara = material.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_TYPE);
// if (null == independentPara)
// {
// return MaterialType.Generic;
// }
// return (MaterialType)independentPara.AsInteger();
//}
//PropertySetElement propElem = m_revit.ActiveUIDocument.Document.GetElement(propElemId) as PropertySetElement;
//Parameter propElemPara = propElem.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_CLASS);
//if (null == propElemPara)
//{
// return MaterialType.Generic;
//}
//return (MaterialType)propElemPara.AsInteger();
}
}
/// <summary>
/// assistant class contains material and its name
/// </summary>
public class MaterialMap
{
string m_materialName;
Autodesk.Revit.DB.Material m_material;
/// <summary>
/// constructor without parameter is forbidden
/// </summary>
private MaterialMap() { }
/// <summary>
/// constructor
/// </summary>
/// <param name="material"></param>
public MaterialMap(Autodesk.Revit.DB.Material material)
{
m_materialName = material.Name;
m_material = material;
}
/// <summary>
/// Get the material name
/// </summary>
public string MaterialName
{
get
{
return m_materialName;
}
}
/// <summary>
/// Get the material
/// </summary>
public Autodesk.Revit.DB.Material Material
{
get
{
return m_material;
}
}
}
}
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4AD14A32-1CFA-4843-A645-E34FA2868F57}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>MaterialProperties</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>MaterialProperties</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="MaterialProperties.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="MaterialPropertiesForm.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="MaterialPropertiesForm.resx">
<DependentUpon>MaterialPropertiesForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Project>
@@ -0,0 +1,361 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.MaterialProperties.CS
{
/// <summary>
/// Summary description for MaterialPropFrm.
/// </summary>
public class MaterialPropertiesForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label typeLable;
private System.Windows.Forms.ComboBox typeComboBox;
private System.Windows.Forms.ComboBox subTypeComboBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button applyButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.DataGrid parameterDataGrid;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private MaterialPropertiesForm()
{
}
/// <summary>
/// material properties from
/// </summary>
/// <param name="dataBuffer">material properties from Revit</param>
public MaterialPropertiesForm(MaterialProperties dataBuffer)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
parameterDataGrid.PreferredColumnWidth = parameterDataGrid.Width / 2 - 2;
m_dataBuffer = dataBuffer;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
private MaterialProperties m_dataBuffer = null;
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.typeLable = new System.Windows.Forms.Label();
this.typeComboBox = new System.Windows.Forms.ComboBox();
this.subTypeComboBox = new System.Windows.Forms.ComboBox();
this.parameterDataGrid = new System.Windows.Forms.DataGrid();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.applyButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.parameterDataGrid)).BeginInit();
this.SuspendLayout();
//
// typeLable
//
this.typeLable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.typeLable.Location = new System.Drawing.Point(24, 16);
this.typeLable.Name = "typeLable";
this.typeLable.Size = new System.Drawing.Size(80, 23);
this.typeLable.TabIndex = 0;
this.typeLable.Text = "Material Type:";
//
// typeComboBox
//
this.typeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.typeComboBox.Location = new System.Drawing.Point(112, 16);
this.typeComboBox.Name = "typeComboBox";
this.typeComboBox.Size = new System.Drawing.Size(264, 21);
this.typeComboBox.TabIndex = 2;
this.typeComboBox.SelectedIndexChanged += new System.EventHandler(this.typeComboBox_SelectedIndexChanged);
//
// subTypeComboBox
//
this.subTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.subTypeComboBox.Location = new System.Drawing.Point(112, 48);
this.subTypeComboBox.MaxDropDownItems = 30;
this.subTypeComboBox.Name = "subTypeComboBox";
this.subTypeComboBox.Size = new System.Drawing.Size(264, 21);
this.subTypeComboBox.TabIndex = 3;
this.subTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.subTypeComboBox_SelectedIndexChanged);
//
// parameterDataGrid
//
this.parameterDataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.parameterDataGrid.CaptionVisible = false;
this.parameterDataGrid.DataMember = "";
this.parameterDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.parameterDataGrid.Location = new System.Drawing.Point(16, 88);
this.parameterDataGrid.Name = "parameterDataGrid";
this.parameterDataGrid.ReadOnly = true;
this.parameterDataGrid.RowHeadersVisible = false;
this.parameterDataGrid.Size = new System.Drawing.Size(480, 380);
this.parameterDataGrid.TabIndex = 4;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(104, 480);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = "&OK";
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(192, 480);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 6;
this.cancelButton.Text = "&Cancel";
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// applyButton
//
this.applyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.applyButton.Location = new System.Drawing.Point(280, 480);
this.applyButton.Name = "applyButton";
this.applyButton.Size = new System.Drawing.Size(75, 23);
this.applyButton.TabIndex = 7;
this.applyButton.Text = "&Apply";
this.applyButton.Click += new System.EventHandler(this.applyButton_Click);
//
// changeButton
//
this.changeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.changeButton.Location = new System.Drawing.Point(368, 480);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(128, 23);
this.changeButton.TabIndex = 8;
this.changeButton.Text = "Change &Unit Weight";
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// MaterialPropertiesForm
//
this.AcceptButton = this.okButton;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(512, 512);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.applyButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.parameterDataGrid);
this.Controls.Add(this.subTypeComboBox);
this.Controls.Add(this.typeComboBox);
this.Controls.Add(this.typeLable);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MaterialPropertiesForm";
this.ShowInTaskbar = false;
this.Text = "Material Properties";
this.Load += new System.EventHandler(this.MaterialPropFrm_Load);
((System.ComponentModel.ISupportInitialize)(this.parameterDataGrid)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MaterialPropFrm_Load(object sender, System.EventArgs e)
{
LoadCurrentMaterial();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void typeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
if ((StructuralAssetClass)typeComboBox.SelectedIndex == StructuralAssetClass.Metal)
{
applyButton.Enabled = true;
changeButton.Enabled = true;
subTypeComboBox.Enabled = true;
subTypeComboBox.DataSource = m_dataBuffer.SteelCollection;
subTypeComboBox.DisplayMember = "MaterialName";
subTypeComboBox.ValueMember = "Material";
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, (StructuralAssetClass)typeComboBox.SelectedIndex);
}
else if ((StructuralAssetClass)typeComboBox.SelectedIndex == StructuralAssetClass.Concrete)
{
applyButton.Enabled = true;
changeButton.Enabled = true;
subTypeComboBox.Enabled = true;
subTypeComboBox.DataSource = m_dataBuffer.ConcreteCollection;
subTypeComboBox.DisplayMember = "MaterialName";
subTypeComboBox.ValueMember = "Material";
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, (StructuralAssetClass)typeComboBox.SelectedIndex);
}
else
{
applyButton.Enabled = false;
changeButton.Enabled = false;
subTypeComboBox.DataSource = new ArrayList();
subTypeComboBox.Enabled = false;
parameterDataGrid.DataSource = new DataTable();
}
}
/// <summary>
/// change the content in datagrid according to selected material type
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void subTypeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (null != subTypeComboBox.SelectedValue)
{
m_dataBuffer.UpdateMaterial(subTypeComboBox.SelectedValue);
}
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, (StructuralAssetClass)typeComboBox.SelectedIndex);
}
/// <summary>
/// close form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, System.EventArgs e)
{
this.Close();
}
/// <summary>
/// set selected element's material to current selection and close form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void okButton_Click(object sender, System.EventArgs e)
{
if (null != subTypeComboBox.SelectedValue)
{
m_dataBuffer.UpdateMaterial(subTypeComboBox.SelectedValue);
m_dataBuffer.SetMaterial();
}
this.Close();
}
/// <summary>
/// set selected element's material to current selection
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void applyButton_Click(object sender, System.EventArgs e)
{
if (null != subTypeComboBox.SelectedValue)
{
m_dataBuffer.UpdateMaterial(subTypeComboBox.SelectedValue);
m_dataBuffer.SetMaterial();
}
}
/// <summary>
/// change unit weight all instances of the elements that use this material
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void changeButton_Click(object sender, System.EventArgs e)
{
TaskDialog.Show("Revit", "This will change the unit weight of all instances that use this material in current document.");
if (!m_dataBuffer.ChangeUnitWeight())
{
TaskDialog.Show("Revit", "Failed to change the unit weight.");
return;
}
LoadCurrentMaterial();
}
/// <summary>
/// update display data to selected element's material
/// </summary>
private void LoadCurrentMaterial()
{
typeComboBox.DataSource = m_dataBuffer.MaterialTypes;
typeComboBox.SelectedIndex = (int)m_dataBuffer.CurrentType;
if (null == m_dataBuffer.CurrentMaterial || (m_dataBuffer.CurrentType != StructuralAssetClass.Metal
&& m_dataBuffer.CurrentType != StructuralAssetClass.Concrete))
{
return;
}
Autodesk.Revit.DB.Material tmp = m_dataBuffer.CurrentMaterial as Autodesk.Revit.DB.Material;
if (null == tmp)
return;
subTypeComboBox.SelectedValue = tmp;
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, (StructuralAssetClass)typeComboBox.SelectedIndex);
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>