/// <summary> /// Assignes a color-based material to all of the site-subregions /// </summary> /// <param name="color">Color to be assigned to the site sub-regions</param> public void AssignColor(Color color) { using (Transaction assignMaterial = new Transaction(_doc)) { assignMaterial.Start(); ElementId matId = Material.Create(_doc, "Subregion"); Material mat = _doc.GetElement(matId) as Material; //Create a new property set that can be used by this material StructuralAsset strucAsset = new StructuralAsset("My Property Set", StructuralAssetClass.Concrete); strucAsset.Behavior = StructuralBehavior.Isotropic; strucAsset.Density = 232.0; //Assign the property set to the material. PropertySetElement pse = PropertySetElement.Create(_doc, strucAsset); mat.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pse.Id); mat.Color = color; for (int i = 0; i < this.SiteSubRegions.Count; i++) { foreach (Parameter prm in this.SiteSubRegions[i].TopographySurface.ParametersMap) { if (prm.StorageType == StorageType.ElementId && prm.Definition.ParameterType == ParameterType.Material) { prm.Set(matId); } } } assignMaterial.Commit(); } }
/// <summary> /// Create a new brick material /// </summary> /// <returns>The specific material</returns> private Material CreateSampleBrickMaterial() { SubTransaction createMaterial = new SubTransaction(this.m_document.Document); createMaterial.Start(); Material materialNew = null; //Try to copy an existing material. If it is not available, create a new one. Material masonry_Brick = GetMaterial("Brick, Common"); if (masonry_Brick != null) { materialNew = masonry_Brick.Duplicate(masonry_Brick.Name + "_new"); System.Diagnostics.Debug.WriteLine(masonry_Brick.MaterialClass); materialNew.MaterialClass = "Brick"; } else { ElementId idNew = Material.Create(m_document.Document, "New Brick Sample"); materialNew = m_document.Document.GetElement(idNew) as Material; materialNew.Color = new Autodesk.Revit.DB.Color(255, 0, 0); } createMaterial.Commit(); SubTransaction createPropertySets = new SubTransaction(this.m_document.Document); createPropertySets.Start(); //Create a new structural asset and set properties on it. StructuralAsset structuralAsssetBrick = new StructuralAsset("BrickStructuralAsset", Autodesk.Revit.DB.StructuralAssetClass.Generic); structuralAsssetBrick.DampingRatio = .5; PropertySetElement pseStructural = PropertySetElement.Create(m_document.Document, structuralAsssetBrick); //Create a new thermal asset and set properties on it. ThermalAsset thermalAssetBrick = new ThermalAsset("BrickThermalAsset", Autodesk.Revit.DB.ThermalMaterialType.Solid); thermalAssetBrick.Porosity = 0.1; thermalAssetBrick.Permeability = 0.2; thermalAssetBrick.Compressibility = .5; thermalAssetBrick.ThermalConductivity = .5; //Create PropertySets from assets and assign them to the material. PropertySetElement pseThermal = PropertySetElement.Create(m_document.Document, thermalAssetBrick); createPropertySets.Commit(); SubTransaction setPropertySets = new SubTransaction(this.m_document.Document); setPropertySets.Start(); materialNew.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pseStructural.Id); materialNew.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, pseThermal.Id); //also try //materialNew.ThermalAssetId = pseThermal.Id; setPropertySets.Commit(); return(materialNew); }
/***************************************************/ public static void CopyCharacteristics(this IMaterialFragment toMaterial, Material fromMaterial) { if (fromMaterial == null) { toMaterial.NullRevitElementWarning(); return; } ElementId elementID = fromMaterial.StructuralAssetId; if (elementID == null || elementID == ElementId.InvalidElementId) { toMaterial.NullStructuralAssetWarning(); return; } PropertySetElement propertySetElement = fromMaterial.Document.GetElement(elementID) as PropertySetElement; StructuralAsset structuralAsset = propertySetElement?.GetStructuralAsset(); if (structuralAsset == null) { Compute.NullStructuralAssetWarning(toMaterial); return; } toMaterial.CopyCharacteristics(structuralAsset); }
/***************************************************/ public static void CopyCharacteristics(this IMaterialFragment toMaterial, StructuralAsset fromAsset) { double density = fromAsset.Density.ToSI(UnitType.UT_MassDensity); #if (REVIT2020 || REVIT2021) #else double dampingRatio = fromAsset.DampingRatio; #endif oM.Geometry.Vector youngsModulus = BH.Engine.Geometry.Create.Vector(fromAsset.YoungModulus.X.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Z.ToSI(UnitType.UT_Stress)); oM.Geometry.Vector thermalExpansionCoeff = BH.Engine.Geometry.Create.Vector(fromAsset.ThermalExpansionCoefficient.X.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Y.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Z.ToSI(UnitType.UT_ThermalExpansion)); oM.Geometry.Vector poissonsRatio = BH.Engine.Geometry.Create.Vector(fromAsset.PoissonRatio.X, fromAsset.PoissonRatio.Y, fromAsset.PoissonRatio.Z); oM.Geometry.Vector shearModulus = BH.Engine.Geometry.Create.Vector(fromAsset.ShearModulus.X.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Z.ToSI(UnitType.UT_Stress)); toMaterial.Density = density; #if (REVIT2020 || REVIT2021) #else toMaterial.DampingRatio = dampingRatio; #endif if (toMaterial is Aluminium) { Aluminium material = toMaterial as Aluminium; material.YoungsModulus = youngsModulus.X; material.ThermalExpansionCoeff = thermalExpansionCoeff.X; material.PoissonsRatio = poissonsRatio.X; } else if (toMaterial is Concrete) { Concrete material = toMaterial as Concrete; material.YoungsModulus = youngsModulus.X; material.ThermalExpansionCoeff = thermalExpansionCoeff.X; material.PoissonsRatio = poissonsRatio.X; } else if (toMaterial is Steel) { Steel material = toMaterial as Steel; material.YoungsModulus = youngsModulus.X; material.ThermalExpansionCoeff = thermalExpansionCoeff.X; material.PoissonsRatio = poissonsRatio.X; } else if (toMaterial is Timber) { Timber material = toMaterial as Timber; material.YoungsModulus = youngsModulus; material.ThermalExpansionCoeff = thermalExpansionCoeff; material.PoissonsRatio = poissonsRatio; } else if (toMaterial is GenericIsotropicMaterial) { GenericIsotropicMaterial material = toMaterial as GenericIsotropicMaterial; material.YoungsModulus = youngsModulus.X; material.ThermalExpansionCoeff = thermalExpansionCoeff.X; material.PoissonsRatio = poissonsRatio.X; } }
/// <summary> /// Getting the specific material by name. /// </summary> /// <param name="name">The name of specific material.</param> /// <returns>The specific material</returns> /* public static Material GetMaterialfromlibray(string name, Autodesk.Revit.ApplicationServices.Application revitApp) * { * FilteredElementCollector collector = new FilteredElementCollector(revitApp.Documents.); * collector.WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Materials)); * var MaterialElement = from element in collector * where element.Name == name * select element; * * if (MaterialElement.Count() == 0) * return null; * return MaterialElement.First<Element>() as Material; * }*/ /// <summary> /// Create a new brick material /// </summary> /// <returns>The specific material</returns> public static Material CreateSampleConcreteMaterial(UIDocument m_document) { Material materialNew = null; //Try to copy an existing material. If it is not available, create a new one. Material masonry_Concrete = GetMaterial("Concrete, Lightweight", m_document); if (masonry_Concrete != null) { TaskDialog.Show("Tip", "找到这种材料了!"); materialNew = masonry_Concrete.Duplicate(masonry_Concrete.Name + "_new"); materialNew.MaterialClass = "Concrete"; } else { ElementId idNew = Material.Create(m_document.Document, "New Concrete Sample"); materialNew = m_document.Document.GetElement(idNew) as Material; materialNew.Color = new Autodesk.Revit.DB.Color(130, 150, 120); } //创建外观属性 //Create a new structural asset and set properties on it. StructuralAsset structuralAsssetConcrete = new StructuralAsset("ConcreteStructuralAsset", Autodesk.Revit.DB.StructuralAssetClass.Concrete); structuralAsssetConcrete.ConcreteBendingReinforcement = .5; structuralAsssetConcrete.DampingRatio = .5; //Create a new thermal asset and set properties on it. ThermalAsset thermalAssetConcrete = new ThermalAsset("ConcreteThermalAsset", Autodesk.Revit.DB.ThermalMaterialType.Solid); thermalAssetConcrete.Porosity = 0.2; thermalAssetConcrete.Permeability = 0.3; thermalAssetConcrete.Compressibility = .5; thermalAssetConcrete.ThermalConductivity = .5; //Create PropertySets from assets and assign them to the material. PropertySetElement pseThermal = PropertySetElement.Create(m_document.Document, thermalAssetConcrete); PropertySetElement pseStructural = PropertySetElement.Create(m_document.Document, structuralAsssetConcrete); materialNew.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pseStructural.Id); materialNew.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, pseThermal.Id); return(materialNew); }
void GetElementMaterialInfo(Document doc) { FilteredElementCollector collector = new FilteredElementCollector(doc) .WhereElementIsNotElementType() .OfClass(typeof(Material)); try { foreach (Material material in collector) { if (material.Name.Equals("Air")) { AppearanceAssetElement appearanceElement = doc.GetElement(material.AppearanceAssetId) as AppearanceAssetElement; Asset appearanceAsset = appearanceElement .GetRenderingAsset(); List <AssetProperty> assetProperties = new List <AssetProperty>(); PropertySetElement physicalPropSet = doc.GetElement(material.StructuralAssetId) as PropertySetElement; PropertySetElement thermalPropSet = doc.GetElement(material.ThermalAssetId) as PropertySetElement; ThermalAsset thermalAsset = thermalPropSet .GetThermalAsset(); StructuralAsset physicalAsset = physicalPropSet .GetStructuralAsset(); ICollection <Parameter> physicalParameters = physicalPropSet.GetOrderedParameters(); ICollection <Parameter> thermalParameters = thermalPropSet.GetOrderedParameters(); // Appearance Asset for (int i = 0; i < appearanceAsset.Size; i++) { AssetProperty property = appearanceAsset[i]; assetProperties.Add(property); } foreach (AssetProperty assetProp in assetProperties) { Type type = assetProp.GetType(); object assetPropValue = null; var prop = type.GetProperty("Value"); if (prop != null && prop.GetIndexParameters().Length == 0) { assetPropValue = prop.GetValue(assetProp); } } // Physical (Structural) Asset foreach (Parameter p in physicalParameters) { // Work with parameters here // The only parameter not in the orderedParameters // that is needed is the Asset name, which you // can get by 'physicalAsset.Name'. } // Thermal Asset foreach (Parameter p in thermalParameters) { //Work with parameters here //The only parameter not in the orderedParameters // that is needed is the Asset name, shich you // can get by 'thermalAsset.Name'. } } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public static List <SpeckleObject> ToSpeckle(this AnalyticalModelSurface mySurface) { var returnObjects = new List <SpeckleObject>(); if (!mySurface.IsEnabled()) { return(new List <SpeckleObject>()); } // Get the family var myRevitElement = Doc.GetElement(mySurface.GetElementId()); var type = Structural2DElementType.Generic; if (myRevitElement is Floor) { type = Structural2DElementType.Slab; } else if (myRevitElement is Wall) { type = Structural2DElementType.Wall; } // Voids first var voidLoops = mySurface.GetLoops(AnalyticalLoopType.Void); foreach (var loop in voidLoops) { var coor = new List <double>(); foreach (var curve in loop) { var points = curve.Tessellate(); foreach (var p in points.Skip(1)) { coor.Add(p.X / Scale); coor.Add(p.Y / Scale); coor.Add(p.Z / Scale); } } returnObjects.Add(new Structural2DVoid(coor.ToArray(), null)); } var polylines = new List <double[]>(); var loops = mySurface.GetLoops(AnalyticalLoopType.External); foreach (var loop in loops) { var coor = new List <double>(); foreach (var curve in loop) { var points = curve.Tessellate(); foreach (var p in points.Skip(1)) { coor.Add(p.X / Scale); coor.Add(p.Y / Scale); coor.Add(p.Z / Scale); } } polylines.Add(coor.ToArray()); } var coordinateSystem = mySurface.GetLocalCoordinateSystem(); var axis = coordinateSystem == null ? null : new StructuralAxis( new StructuralVectorThree(new double[] { coordinateSystem.BasisX.X, coordinateSystem.BasisX.Y, coordinateSystem.BasisX.Z }), new StructuralVectorThree(new double[] { coordinateSystem.BasisY.X, coordinateSystem.BasisY.Y, coordinateSystem.BasisY.Z }), new StructuralVectorThree(new double[] { coordinateSystem.BasisZ.X, coordinateSystem.BasisZ.Y, coordinateSystem.BasisZ.Z }) ); // Property string sectionID = null; try { var mySection = new Structural2DProperty(); mySection.Name = Doc.GetElement(myRevitElement.GetTypeId()).Name; mySection.ApplicationId = Doc.GetElement(myRevitElement.GetTypeId()).UniqueId; if (myRevitElement is Floor) { var myFloor = myRevitElement as Floor; mySection.Thickness = myFloor.get_Parameter(BuiltInParameter.FLOOR_ATTR_THICKNESS_PARAM).AsDouble() / Scale; } else if (myRevitElement is Wall) { var myWall = myRevitElement as Wall; mySection.Thickness = myWall.WallType.Width / Scale; } try { // Material Material myMat = null; StructuralAsset matAsset = null; if (myRevitElement is Floor) { var myFloor = myRevitElement as Floor; myMat = Doc.GetElement(myFloor.FloorType.StructuralMaterialId) as Material; } else if (myRevitElement is Wall) { var myWall = myRevitElement as Wall; myMat = Doc.GetElement(myWall.WallType.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()) as Material; } SpeckleObject myMaterial = null; matAsset = ((PropertySetElement)Doc.GetElement(myMat.StructuralAssetId)).GetStructuralAsset(); var matType = myMat.MaterialClass; switch (matType) { case "Concrete": var concMat = new StructuralMaterialConcrete(); concMat.ApplicationId = myMat.UniqueId; concMat.Name = Doc.GetElement(myMat.StructuralAssetId).Name; concMat.YoungsModulus = matAsset.YoungModulus.X; concMat.ShearModulus = matAsset.ShearModulus.X; concMat.PoissonsRatio = matAsset.PoissonRatio.X; concMat.Density = matAsset.Density; concMat.CoeffThermalExpansion = matAsset.ThermalExpansionCoefficient.X; concMat.CompressiveStrength = matAsset.ConcreteCompression; concMat.MaxStrain = 0; concMat.AggragateSize = 0; myMaterial = concMat; break; case "Steel": var steelMat = new StructuralMaterialSteel(); steelMat.ApplicationId = myMat.UniqueId; steelMat.Name = Doc.GetElement(myMat.StructuralAssetId).Name; steelMat.YoungsModulus = matAsset.YoungModulus.X; steelMat.ShearModulus = matAsset.ShearModulus.X; steelMat.PoissonsRatio = matAsset.PoissonRatio.X; steelMat.Density = matAsset.Density; steelMat.CoeffThermalExpansion = matAsset.ThermalExpansionCoefficient.X; steelMat.YieldStrength = matAsset.MinimumYieldStress; steelMat.UltimateStrength = matAsset.MinimumTensileStrength; steelMat.MaxStrain = 0; myMaterial = steelMat; break; default: var defMat = new StructuralMaterialSteel(); defMat.ApplicationId = myMat.UniqueId; defMat.Name = Doc.GetElement(myMat.StructuralAssetId).Name; myMaterial = defMat; break; } myMaterial.GenerateHash(); mySection.MaterialRef = (myMaterial as SpeckleObject).ApplicationId; returnObjects.Add(myMaterial); } catch { } mySection.GenerateHash(); sectionID = mySection.ApplicationId; returnObjects.Add(mySection); } catch { } var counter = 0; foreach (var coor in polylines) { var dummyMesh = new Structural2DElementMesh(coor, null, type, null, null, null); var numFaces = 0; for (var i = 0; i < dummyMesh.Faces.Count(); i++) { numFaces++; i += dummyMesh.Faces[i] + 3; } var mesh = new Structural2DElementMesh(); mesh.Vertices = dummyMesh.Vertices; mesh.Faces = dummyMesh.Faces; mesh.Colors = dummyMesh.Colors; mesh.ElementType = type; if (sectionID != null) { mesh.PropertyRef = sectionID; } if (axis != null) { mesh.Axis = Enumerable.Repeat(axis, numFaces).ToList(); } mesh.Offset = Enumerable.Repeat(0.0, numFaces).Cast <double>().ToList(); //TODO mesh.GenerateHash(); mesh.ApplicationId = mySurface.UniqueId + "_" + (counter++).ToString(); returnObjects.Add(mesh); } return(returnObjects); }
CollectEvent(object sender, CollectorEventArgs e) { // cast the sender object to the SnoopCollector we are expecting Collector snoopCollector = sender as Collector; if (snoopCollector == null) { Debug.Assert(false); // why did someone else send us the message? return; } // see if it is a type we are responsible for AnalyticalModel aModel = e.ObjToSnoop as AnalyticalModel; if (aModel != null) { Stream(snoopCollector.Data(), aModel); return; } CompoundStructure compStruct = e.ObjToSnoop as CompoundStructure; if (compStruct != null) { Stream(snoopCollector.Data(), compStruct); return; } CompoundStructureLayer compStructLayer = e.ObjToSnoop as CompoundStructureLayer; if (compStructLayer != null) { Stream(snoopCollector.Data(), compStructLayer); return; } AnalyticalModelSupport supportData = e.ObjToSnoop as AnalyticalModelSupport; if (supportData != null) { Stream(snoopCollector.Data(), supportData); return; } RebarInSystem barDesc = e.ObjToSnoop as RebarInSystem; if (barDesc != null) { Stream(snoopCollector.Data(), barDesc); return; } StructuralAsset structuralAsset = e.ObjToSnoop as StructuralAsset; if (structuralAsset != null) { Stream(snoopCollector.Data(), structuralAsset); return; } /* TF * AnalyticalModelSweptProfile profile = e.ObjToSnoop as AnalyticalModelSweptProfile; * if (profile != null) * { * Stream(snoopCollector.Data(), profile); * return; * } */ }
/// <summary> /// Gets the document body for label. /// </summary> /// <param name="label">label.</param> /// <param name="document">document.</param> /// <returns> /// The body of the document. /// </returns> public override DocumentBody BuildLabelDocumentBody(Entity label, Autodesk.Revit.DB.Document document) { switch (label.Schema.SchemaName) { default: return(base.BuildLabelDocumentBody(label, document)); case "LabelColumn": { DocumentBody body = new DocumentBody(); LabelColumn labelColumn = new LabelColumn(); labelColumn.SetProperties(label, document); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4)); if (labelColumn.EnabledInternalForces.Count > 0) { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true)); if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFX_Note"), true)); } if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFY_Note"), true)); } if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFZ_Note"), true)); } if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMX_Note"), true)); } if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMY_Note"), true)); } if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMZ_Note"), true)); } } body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelColumn, this, document)); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("Buckling"), 4)); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionY"), 5)); if (labelColumn.BucklingDirectionY) { body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientY", labelColumn, this, document)); body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeY", labelColumn, this, document)); } else { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true)); } body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionZ"), 5)); if (labelColumn.BucklingDirectionZ) { body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientZ", labelColumn, this, document)); body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeZ", labelColumn, this, document)); } else { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true)); } // longitudinal body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4)); if (labelColumn.LongitudinalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.LongitudinalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (labelColumn.LongitudinalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.LongitudinalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.LongitudinalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); // transverse body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4)); if (labelColumn.TransversalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.TransversalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (labelColumn.TransversalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.TransversalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.TransversalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); return(body); } case "LabelBeam": { DocumentBody body = new DocumentBody(); LabelBeam labelBeam = new LabelBeam(); labelBeam.SetProperties(label, document); body.Elements.Add(new DocumentLineBreak(1)); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4)); if (labelBeam.EnabledInternalForces.Count > 0) { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true)); if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFX_Note"), true)); } if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFY_Note"), true)); } if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFZ_Note"), true)); } if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMX_Note"), true)); } if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMY_Note"), true)); } if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMZ_Note"), true)); } } body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelBeam, this, document)); string interaction = Resources.ResourceManager.GetString("No"); if (labelBeam.SlabBeamInteraction == ConcreteTypes.BeamSectionType.WithSlabBeamInteraction) { interaction = Resources.ResourceManager.GetString("Yes"); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("SlabBeamInteraction"), interaction)); // longitudinal body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4)); if (labelBeam.LongitudinalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.LongitudinalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (labelBeam.LongitudinalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.LongitudinalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.LongitudinalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); // transverse body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4)); if (labelBeam.TransversalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.TransversalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (labelBeam.TransversalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.TransversalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.TransversalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); return(body); } /// <structural_toolkit_2015> case "LabelFloor": { DocumentBody body = new DocumentBody(); LabelFloor LabelFloor = new LabelFloor(); LabelFloor.SetProperties(label, document); body.Elements.Add(new DocumentLineBreak(1)); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4)); if (LabelFloor.EnabledInternalForces.Count > 0) { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true)); if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorF_Note"), true)); } if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorQ_Note"), true)); } if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorM_Note"), true)); } } body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelFloor, this, document)); // Primary body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("PrimaryReinforcement"), 4)); if (LabelFloor.PrimaryReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.PrimaryReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.PrimaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (LabelFloor.PrimaryReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.PrimaryReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.PrimaryReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.PrimaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); // Secondary body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("SecondaryReinforcement"), 4)); if (LabelFloor.SecondaryReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.SecondaryReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.SecondaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (LabelFloor.SecondaryReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.SecondaryReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.SecondaryReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.SecondaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); return(body); } case "LabelWall": { DocumentBody body = new DocumentBody(); LabelWall LabelWall = new LabelWall(); LabelWall.SetProperties(label, document); body.Elements.Add(new DocumentLineBreak(1)); body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4)); if (LabelWall.EnabledInternalForces.Count > 0) { body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true)); if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallF_Note"), true)); } if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallQ_Note"), true)); } if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX)) { body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallM_Note"), true)); } } body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelWall, this, document)); // Vertical body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("VerticalReinforcement"), 4)); if (LabelWall.VerticalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.VerticalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.VerticalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (LabelWall.VerticalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.VerticalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.VerticalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.VerticalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); // Horizontal body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("HorizontalReinforcement"), 4)); if (LabelWall.HorizontalReinforcement.Material != null) { StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.HorizontalReinforcement.Material); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.HorizontalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits())); if (LabelWall.HorizontalReinforcement.RebarBarType != null) { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.HorizontalReinforcement.RebarBarType.Name)); } else { body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), "")); } body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.HorizontalReinforcement.DeformationType.ToString())); body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.HorizontalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits())); return(body); } /// </structural_toolkit_2015> } }