// // (C) Copyright 2003-2010 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.Collections.Generic; using System.Text; using System.ComponentModel; using Autodesk.Revit; using Autodesk.Revit.DB; namespace Revit.SDK.Samples.Materials.CS { /// /// derived class of MaterialParameters /// public class MaterialGenericParameters : MaterialParameters { private MaterialGeneric m_materialGeneric;// reference to MaterialGeneric private List m_behaviorRelativeProperties;//list stores name of properties which is relavite with Behavior /// /// original Type : MaterialBehaviourType /// public LocalMaterialBehaviourType Behavior { get { LocalMaterialBehaviourType curBehavior = (LocalMaterialBehaviourType)GetParameterValue(BuiltInParameter.PHY_MATERIAL_PARAM_BEHAVIOR); if (m_behavior != curBehavior) { bool isReadonly = false; if (LocalMaterialBehaviourType.Isotropic == curBehavior) { isReadonly = true; } foreach (String propertyName in m_behaviorRelativeProperties) { SetPropertyReadOnly(this, propertyName, isReadonly); } m_behavior = curBehavior; } return m_behavior; } set { SetParameterValue(BuiltInParameter.PHY_MATERIAL_PARAM_BEHAVIOR, value); } } /// /// original Type : Double /// [DisplayName("Minimum Yield Stress")] public string MinimumYieldStress { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_MINIMUM_YIELD_STRESS); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_MINIMUM_YIELD_STRESS, value); } } #region PoissonRatio /// /// original Type : Double /// [RefreshPropertiesAttribute(RefreshProperties.All), DisplayName("Poisson Ratio X")] public string PoissonRatioX { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD1); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD1, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Poisson Ratio Y")] public string PoissonRatioY { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD2); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD2, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Poisson Ratio Z")] public string PoissonRatioZ { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD3); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_POISSON_MOD3, value); } } #endregion /// /// original Type : Double /// [DisplayName("Reduction Factor For Shear")] public string ReductionFactorForShear { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_REDUCTION_FACTOR); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_REDUCTION_FACTOR, value); } } #region ShearModulus /// /// original Type : Double /// [RefreshPropertiesAttribute(RefreshProperties.All), DisplayName("Shear Modulus X")] public string ShearModulusX { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD1); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD1, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Shear Modulus Y")] public string ShearModulusY { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD2); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD2, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Shear Modulus Z")] public string ShearModulusZ { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD3); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_SHEAR_MOD3, value); } } #endregion #region ThermalExpansionCoefficient /// /// original Type : Double /// [RefreshPropertiesAttribute(RefreshProperties.All), DisplayName("Thermal Expansion Coefficient X")] public string ThermalExpansionCoefficientX { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF1); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF1, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Thermal Expansion Coefficient Y")] public string ThermalExpansionCoefficientY { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF2); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF2, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Thermal Expansion Coefficient Z")] public string ThermalExpansionCoefficientZ { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF3); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_EXP_COEFF3, value); } } #endregion /// /// original Type : Double /// [DisplayName("Unit Weight")] public string UnitWeight { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_UNIT_WEIGHT); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_UNIT_WEIGHT, value); } } #region YoungModulus /// /// original Type : Double /// [RefreshPropertiesAttribute(RefreshProperties.All), DisplayName("Young Modulus X")] public string YoungModulusX { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD1); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD1, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Young Modulus Y")] public string YoungModulusY { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD2); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD2, value); } } /// /// original Type : Double /// [ReadOnlyAttribute(true), DisplayName("Young Modulus Z")] public string YoungModulusZ { get { return GetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD3); } set { SetParameterValueString(BuiltInParameter.PHY_MATERIAL_PARAM_YOUNG_MOD3, value); } } #endregion /// /// MaterialGenericParameters's constructor /// /// a instance of MaterialGeneric public MaterialGenericParameters(MaterialGeneric materialGeneric) :base(materialGeneric) { m_materialGeneric = materialGeneric; m_behaviorRelativeProperties = new List(); m_behaviorRelativeProperties.AddRange(new String[] { "ShearModulusY", "ShearModulusZ", "PoissonRatioY","PoissonRatioZ", "YoungModulusY","YoungModulusZ", "ThermalExpansionCoefficientY", "ThermalExpansionCoefficientZ"}); } } }