private void onMaterialComboChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e) { resetSchema(e); // update barTypeCombo // update strength field if (schema.Material != null) { double yield = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(schema.Material).MinimumYieldStress; yield = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(yield, DisplayUnitType.DUT_PASCALS); e.Editor.SetValue("MinimumYieldStress", yield, DisplayUnitType.DUT_PASCALS); IList <ElementId> barsIds = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetListRebarForMaterial(e.Document, schema.Material.Id); List <RebarBarType> barTypesSource = (from elementId in barsIds select e.Document.GetElement(elementId) as RebarBarType).ToList(); var btypes = barTypesSource.Select(s => new { myDiam = s.BarDiameter, mybType = s }).OrderBy(s => s.myDiam); List <RebarBarType> bars = btypes.Select(s => s.mybType).ToList(); RebarBarType currentBar = schema.RebarBarType; e.Editor.SetAttribute("RebarBarType", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ComboBoxAttribute.PropertyDataSource, bars, DisplayUnitType.DUT_UNDEFINED); if (currentBar == null || !barsIds.Contains(currentBar.Id)) { e.Editor.SetValue("RebarBarType", null, DisplayUnitType.DUT_UNDEFINED); } else { e.Editor.SetValue("RebarBarType", currentBar, DisplayUnitType.DUT_UNDEFINED); onBarChange(e); } } else { e.Editor.SetValue("MinimumYieldStress", 0.0, DisplayUnitType.DUT_PASCALS); } }
private void resetMaterialCombo(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e) { resetSchema(e); IList <ElementId> materials = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetListMaterialOfRebars(e.Document); e.Editor.SetAttribute("Material", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ComboBoxAttribute.PropertyDataSource, materials, DisplayUnitType.DUT_UNDEFINED); e.Editor.SetValue("Material", schema.Material, DisplayUnitType.DUT_UNDEFINED); onMaterialComboChange(e); }
private void onChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e) { CalculationPointsSelectorSchema pointsSelectorSchema = new CalculationPointsSelectorSchema(); pointsSelectorSchema.SetProperties(e.Entity as Autodesk.Revit.DB.ExtensibleStorage.Entity); CalculationPointsSelectorSchema.DivisionType divisionType = pointsSelectorSchema.ElementDivisionType; bool isUniformDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Points, isUserSegmentDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Segments; e.Editor.SetAttribute("UniformDistribution", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUniformDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED); e.Editor.SetAttribute("UserSegmentDivision", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUserSegmentDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED); }
private void onBarChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e) { resetSchema(e); if (schema.RebarBarType != null) { double diameter = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(schema.RebarBarType.BarDiameter, DisplayUnitType.DUT_METERS); e.Editor.SetValue("BarDiameter", diameter, DisplayUnitType.DUT_METERS); e.Editor.SetValue("DeformationType", schema.RebarBarType.DeformationType == RebarDeformationType.Plain ? Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Plain : Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Deformed, DisplayUnitType.DUT_UNDEFINED); } else { e.Editor.SetValue("BarDiameter", 0.0, DisplayUnitType.DUT_METERS); e.Editor.SetValue("DeformationType", Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Unknown, DisplayUnitType.DUT_UNDEFINED); } }
private void resetSchema(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e) { schema = new RCSteelParametersSchema(e.Entity as Entity, e.Document); }