Revit二次開發 EG01 構件工程量提取

2021-09-24 17:19:33 字數 3035 閱讀 5968

【話不多說,上**】

try

//初始化資料

listwalllist = new list();

double wallvolume = 0.000;

string wallinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listcolumnlist = new list();

double columnvolume = 0.000;

string columninfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listbeamlist = new list();

double beamvolume = 0.000;

string beaminfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listfloorlist = new list();

double floorvolume = 0.000;

string floorinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

liststairlist = new list();

double stairvolume = 0.000;

string stairinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listfoundationlist = new list();

double foundationvolume = 0.000;

string foundationinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listrooflist = new list();

double roofvolume = 0.000;

string roofinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listgenericlist = new list();

double genericvolume = 0.000;

string genericinfo = "【構件名稱】" + "----" + "【構件id】" + "----" + "【構件體積】" + "\t\n";

listelselist = new list();

string elseinfo = "【構件名稱】" + "----" + "【構件id】" + "\t\n";

//判斷構件型別,統計構件體積

foreach (element elem in elementlist)}}

//計算結構柱體積

if (name == "結構柱")}}

//計算結構框架體積

if (name == "結構框架")}}

//計算樓板體積

if (name == "樓板")}}

//計算樓梯體積

if (name == "樓梯")

}stairinfo += elem.id.tostring() + "----";

stairvolume += (elem.getmaterialvolume(stairid) * 0.3048 * 0.3048 * 0.3048);

stairinfo += ((elem.getmaterialvolume(stairid) * 0.3048 * 0.3048 * 0.3048).tostring("0.000") + "\t\n");}}

//計算結構基礎體積

if (name == "結構基礎")}}

//計算屋頂體積

if (name == "屋頂")}}

//計算常規模型體積

if (name == "常規模型")

}stairinfo += (elem.id.tostring() + "----");

foreach (parameter para in elem.parameters)}}

//其他構件的顯示

if (name != "牆" && name != "結構柱" && name != "結構框架" && name != "樓板"

&& name != "樓梯" && name != "結構基礎" && name != "屋頂" && name != "常規模型")

}elseinfo += elem.id.tostring() + "\t\n";}}

//彈出對話方塊顯示彙總結果

getsolidvolume_wpf getsolidvolumewpf = new getsolidvolume_wpf(

walllist.count(), wallvolume, wallinfo,

columnlist.count(), columnvolume, columninfo,

beamlist.count(), beamvolume, beaminfo,

floorlist.count(), floorvolume, floorinfo,

stairlist.count(), stairvolume, stairinfo,

foundationlist.count(), foundationvolume, foundationinfo,

rooflist.count(), roofvolume, roofinfo,

genericlist.count(), genericvolume, genericinfo,

elselist.count(), elseinfo

);getsolidvolumewpf.showdialog();

return result.succeeded;

}catch (exception ex)

這部分內容正在研究,稍後上線

Revit二次開發 初學

前言 由於工作需要,近期開始學習revit二次開發知識。學習的同時將學習過程與小夥伴們一起分享,希望後來的小夥伴在看到我的學習筆記的時候有所幫助。說明由於revit的版本在不斷更新中,所以我在學習revit的時候選擇了從revit自帶的幫助檔案開始學習,不同版本的revit,就看相應的help檔案。...

Revit二次開發之 構件的連線和剪下

reference refer 1 uidoc.selection.pickobject objecttype.element element elem 1 doc.getelement refer 1 reference refer 2 uidoc.selection.pickobject obj...

Revit二次開發 Revit擴充套件儲存資料

revit二次開發過程中,需要將相關資訊儲存到rvt檔案中,再次開啟rvt的時候,可以通過讀取這些資訊,知道當前構件的基本狀態,或者將乙個特殊的資訊儲存到rvt檔案中,從revit2012開始引入了擴充套件儲存這個新技術,就是可以把一些資料儲存在revit中的某乙個物件上。且這個儲存操作,只能通過程...