FilteredElementCollector collector =newFilteredElementCollector(_rvtDoc); collector.WherePasses(newElementClassFilter(targetType)); //parse the collection for the given name //using LINQ query here. // vartargetElems =fromelementincollectorwhereelement.Name.Equals(targetName)selectelement; List<Element> ...
2、LINQ支持 var levelElements = from element in collectorwhere element.Name == "标高 1"select element;List<Element> levels = levelElements.ToList<Element>();ElementId level1Id = levels[0].Id; 需要注意的是:要准确找到某个元素时,应核实其Name,本人将“标高 1”写成了“标高1”,结果就找不到...
From the Modify tab, on the Inquiry panel, select Element ID. The Element ID drop down menu appears. 从选择集IDs中获得一个图元ID。Select IDs of Selection to get the ID number for one element. Figure 23: ElementId 在Revit平台API中,可以直接创建一个ElementId,然后关联一个唯一的整数值到此新...
Revit API还支持选择单个或多个构件的整体或局部(例如:构件上一个点,边或者面等)。例如如下代码只选择墙的几何面。注意自定义Filter的AllowReference需要返回true。 publicclassWallFilter:ISelectionFilter{publicboolAllowElement(Elementelement){if(elementisWall){returntrue;}returnfalse;}publicboolAllowReference(Refe...
// the mode to select element(s)/// <summary>/// get all categories name with its visibility/// </summary>publicHashtableAllCategories{get{returnm_allCategories;}}/// <summary>/// get and set the mode to select element(s)/// </summary>publicIsolateModeIsolateMode{get{returnm_isolate...
}else{stringinfo ="当前文档的用户选集的元素Id为: ";foreach(ElementId idinselectSet) { info +="\n\t"+ id.IntegerValue; } TaskDialog.Show("选集", info); }returnAutodesk.Revit.UI.Result.Succeeded; }catch(Exception ex) { message = ex.Message;returnAutodesk.Revit.UI.Result.Failed; ...
(filter);// Use Linq query to find family instances whose name is 60" x 30" Studentvarquery=fromelementincollectorwhereelement.Name=="60\" x 30\" Student"selectelement;// Cast found elements to family instances,// this cast to FamilyInstance is safe because ElementClassFilter for ...
其他类型的建筑构件应该也是可以按此方法旋转。 其他相关参考 https://forums.autodesk.com/t5/revit-api-forum/rotate-column-by-angle-list/m-p/5887909 https://spiderinnet.typepad.com/blog/2012/03/revit-api-2012-select-and-rotate-element-using-elementtransformutilsrotateelement.html...
Revit二次开发中可以采用 FilteredElementCollector 类来获取想要的元素,它的构造器有三个 分别是通过Document、document+viewId(视图ID),document+elementIds(已有的元素ID集合)创建,这个类只有一个属性,应该是判断创建的过滤器是否有效。 下面是这个类的方法 ...
Revit API 获取某墙上洞口的尺寸和位置 [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class cmd20120604 : IExternalCommand { public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)...