|
得到类似风管或者墙的系统族的名称,是通过类型的参数得到。
- <div align="left" style="color: rgb(105, 105, 105); font-family: 'Microsoft Yahei', Simsun; ">[Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class cmdGetSysFamilyName : IExternalCommand
- {
- public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
- {
- UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
- Document doc = uiDoc.Document;
- Selection sel = uiDoc.Selection;
- Transaction ts = new Transaction(uiDoc.Document, "风管类型");
- ts.Start();
- //得到风管的系统族名称
- Reference refDuct = sel.PickObject(ObjectType.Element, "风管");
- Duct duct = doc.GetElement(refDuct) as Duct;
- TaskDialog.Show("duct", duct.DuctType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString());
- //得到墙的系统族名称
- Wall wall = null;
- wall.WallType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString();
- ts.Commit();
- return Result.Succeeded;
- }
- }</div>
复制代码 |
|