次のセクションでは荷重の設定を特定し、荷重制限のガイドラインを説明します。
[設定]ダイアログ ボックスの[荷重ケース]タブと[荷重組み合わせ]タブのすべての機能に API からアクセスできます。
次のプロパティは、対応する LoadCase BuiltInParameter から利用できます。
表 60 荷重ケース プロパティとパラメータ
|
プロパティ |
BuiltInParameter |
|
ケース番号 |
LOAD_CASE _NUMBER |
|
種類 |
LOAD_CASE_NATURE |
|
カテゴリ |
LOAD_CASE_CATEGORY |
LOAD_CASE_CATEGORY パラメータは ElementId を返します。次の表は、カテゴリと ElementId 値間のマッピングを示します。
表 61: 荷重ケース カテゴリ
|
荷重ケース カテゴリ |
BuiltInCategory |
|
死荷重 |
OST_LoadCasesDead |
|
活荷重 |
OST_LoadCasesLive |
|
風荷重 |
OST_LoadCasesWind |
|
積雪荷重 |
OST_LoadCasesSnow |
|
屋根活荷重 |
OST_LoadCasesRoofLive |
|
偶発荷重 |
OST_LoadCasesAccidental |
|
温度負荷 |
OST_LoadCasesTemperature |
|
地震荷重 |
OST_LoadCasesSeismic |
次のクラスには 1 つまたは複数の静的 Create()メソッドがあり、対応するクラスを作成できます。
これらはすべて Element サブクラスであるため、Document.Delete() を使用して削除できます。
荷重の組み合わせは、2 つのオーバーロードを持つ静的メソッド LoadCombination.Create()を使用して作成します。最初のオーバーロードは、荷重の組み合わせを作成するドキュメントと新しい組み合わせの名前の文字列への参照のみを使用します。2 番目のオーバーロードは、これらの引数の他に LoadCombinationType と LoadCombinationState を使用します。LoadCombinationType は Combination (直線的な荷重の組み合わせの場合)か Envelope (いくつかの荷重ケースや組み合わせの効果で構成されるエンベロープの場合)のいずれかに設定できます。
LoadCombinationState は Serviceability または Ultimate に設定できます。荷重の組み合わせが構造上のサービス荷重レベルを表す場合は、Serviceability を使用します。通常、これは設計段階や、部材のたわみや許容応力度設計法(ASD)などのその他の有用性基準の確認段階で使用されます。荷重の組み合わせが、最終的な荷重の状態であったり、LRFD 単位(負荷および抵抗係数設計)法で一般的に使用される構造で算出された荷重の状態である場合は、Ultimate を使用します。
次の例は、荷重の組み合わせのコンポーネントを設定するための、荷重の組み合わせの作成方法および荷重ケースと荷重の種類を検索または作成する方法を示します。
|
コード領域: 新しい LoadCombination を作成 |
LoadCombination CreateLoadCombinationLoadCaseLoadUsageLoadNatureAndLoadComponent(Document document)
{
// Create a new load combination
LoadCombination loadCombination = LoadCombination.Create(document, "DL1 + RAIN1", LoadCombinationType.Combination, LoadCombinationState.Ultimate);
if (loadCombination == null)
throw new Exception("Create new load combination failed.");
// Get all existing LoadCase
FilteredElementCollector collector = new FilteredElementCollector(document);
ICollection<Element> collection = collector.OfClass(typeof(LoadCase)).ToElements();
// Find LoadCase "DL1"
LoadCase case1 = null;
foreach (Element e in collection)
{
LoadCase loadCase = e as LoadCase;
if (loadCase.Name == "DL1")
{
case1 = loadCase;
break;
}
}
// Get all existing LoadNature
collector = new FilteredElementCollector(document);
collection = collector.OfClass(typeof(LoadNature)).ToElements();
// Find LoadNature "Dead"
LoadNature nature1 = null;
foreach (Element e in collection)
{
LoadNature loadNature = e as LoadNature;
if (loadNature.Name == "Dead")
{
nature1 = loadNature;
break;
}
}
// Create LoadNature "Dead" if not exist
if (nature1 == null)
nature1 = LoadNature.Create(document, "Dead");
// Create LoadCase "DL1" if not exist
if (case1 == null)
case1 = LoadCase.Create(document, "DL1", nature1.Id, LoadNatureCategory.Dead);
// Create LoadNature "Rain"
LoadNature nature2 = LoadNature.Create(document, "Rain");
if (nature2 == null)
throw new Exception("Create new load nature failed.");
// Create LoadCase "RAIN1"
LoadCase case2 = LoadCase.Create(document, "RAIN1", nature2.Id, LoadNatureCategory.Snow);
if (case1 == null || case2 == null)
throw new Exception("Create new load case failed.");
// Create LoadComponents - they consist of LoadCases or nested LoadCombination and Factors
List<LoadComponent> components = new List<LoadComponent>();
components.Add(new LoadComponent(case1.Id, 2.0));
components.Add(new LoadComponent(case2.Id, 1.5));
// Add components to combination
loadCombination.SetComponents(components);
// Create LoadUsages
LoadUsage usage1 = LoadUsage.Create(document, "Frequent");
LoadUsage usage2 = LoadUsage.Create(document, "Rare");
if (usage1 == null || usage2 == null)
throw new Exception("Create new load usage failed.");
// Add load usages to combination
loadCombination.SetUsageIds(new List<ElementId>() {usage1.Id, usage2.Id});
// Give the user some information
TaskDialog.Show("Revit", string.Format("Load Combination ID='{0}' created successfully.", loadCombination.Id.IntegerValue));
return loadCombination;
}
|
さらに、LoadCombination.GetComponents()を使用して変更を行い、LoadCombination.SetComponents()をもう一度呼び出せば、ケース、コンポーネント、特性などを変更できます。LoadCombination の LoadUsages を変更するには、LoadCombination.GetUsageIds()を呼び出して LoadUsage の ID を取得し、リストを変更し、もう一度 SetUsageIds()を呼び出します。次のコード サンプルは、既存の LoadCombination を変更する方法を示します。
|
コード領域: 荷重の組み合わせを変更 |
void ModifyLoadCombinationLoadCaseLoadUsageLoadNatureAndLoadComponent(Document document, LoadCombination loadCombination)
{
// Change name of LoadCombination
loadCombination.Name = "DL2 + RAIN1";
// Get any LoadCase from combination
// Combination can have assigned LoadCase or other (nested) LoadCombination so we need to filter out any LoadCombination
LoadCase case1 = null;
IList<ElementId> caseAndCombinationIds = loadCombination.GetCaseAndCombinationIds();
foreach (ElementId id in caseAndCombinationIds)
{
Element element = document.GetElement(id);
if (element is LoadCase)
{
case1 = (LoadCase)element;
break;
}
else if (element is LoadCombination)
{
continue;
}
}
if (case1 == null)
throw new Exception("Can't get LoadCase.");
// Change case name and nature category
case1.Name = "DL2";
// Create load nature
LoadNature liveNature = LoadNature.Create(document, "Dead nature");
if (liveNature == null)
throw new Exception("Create new load nature failed.");
// Change nature category and ID for case
case1.NatureCategory = LoadNatureCategory.Dead;
case1.NatureId = liveNature.Id;
//Change factor for case1
IList<LoadComponent> components = loadCombination.GetComponents();
foreach (LoadComponent loadComponent in components)
{
if (loadComponent.LoadCaseOrCombinationId == case1.Id)
{
loadComponent.Factor = 3.0;
}
}
loadCombination.SetComponents(components);
// Remove one usage from combination
IList<ElementId> usages = loadCombination.GetUsageIds();
usages.RemoveAt(0);
loadCombination.SetUsageIds(usages);
// Give the user some information
TaskDialog.Show("Revit", string.Format("Load Combination ID='{0}' modified successfully.", loadCombination.Id.IntegerValue));
}
|
LoadCase と LoadNature クラスには、Duplicate()メソッドはありません。この機能を実装するには、最初に新しい LoadCase (または LoadNature)オブジェクトを作成し、次に対応するプロパティとパラメータを既存の LoadCase (または LoadNature)からコピーする必要があります。
次は、VB.NET の点荷重の作成を表す最小のサンプル コードになります。
|
コード領域: 新しい PointLoad |
'Define the location at which the PointLoad is applied. Dim point As New XYZ(0, 0, 4) 'Define the 3d force. Dim force As New XYZ(0, 0, -1) 'Define the 3d moment. Dim moment As New XYZ(0, 0, 0) Dim pointLoad As PointLoad = pointLoad.Create(document, point, force, moment, Nothing, Nothing) |