仅提供中文版本
在Revit2018以后,修改了Grid的Reference获取办法,需要使用下面的代码进行获取
1 | foreach (Grid grid in grids) |
而在之前是需要获取Grid的Curve.Reference才能进行标注创建
1 | gridReferences.Append(grid.Curve.Reference); |
改动应该是为了更加安全便捷的获取Grid的Refence而做出的修改。关于这个事情的官方回答详情可以看下面这篇文章
Invalid Number of References

Author: Broccoli
Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Related Articles

2023-05-09
Creating Parts in Revit Secondary Development
Some projects need to use parts to divide floor tiles, like this:Using parts can basically calculate quantities and set data such as paving joints, so below is a method to create parts. 12345678910111213PartUtils.CreateParts(doc,new List<ElementId>(){detailFloor.Id}); doc.Regenerate(); var elementIds = PartUtils.GetAssociatedParts(doc, detailFloor.Id, true, true); var maker = PartUtils.Divi...

2022-09-04
Creating Void Solids for Cutting in Revit Secondary Development
For specific API, please refer to the official documentation. Here is the keyword for cutting Void. OverviewApplication ScenariosIn actual projects, if you want to make a family to cut a component, you need to create a void extrusion, and then execute the cut command to cut off the model component we want to cut.It is widely used in quantity calculation to execute join/cut commands, or connection order in actual engineering.Or in projects with high precision requirements or where the own...

2023-05-16
Breaking an Arc into Multiple Segments
The company plugin’s beam-to-slab function has been updated. The designer requested a feature to split arc beams and align them to the top of the slab. This article only discusses splitting arc beams; ellipses will be updated later. First, let’s look at the arc creation APIThe API provides three methods:The first one is specifying the start point and end point, and finally selecting a point on the arc.The second one is specifying the plane, radius, start angle, and end angle.The third one is...

2023-06-16
RevitNet 调用 Revit API 中射线法求模型同一个构件出现两个不同值的问题记录
射线法求交是很多三维模型求碰撞和测量间距最常用的节点,但是再使用射线法将target设置为element的时候会发现会出现两个相同的值。下面用楼板距离,下图中会出现两个不同的值,在我修改板厚之后发现正好是板厚的距离,可以猜测射线法会对两个face进行判定相交,但是与我们需要的每个element输出一个值不符,这里需要重新做一次判定或者直接取最小值获得净高。 123456789101112131415161718var intersector = new ReferenceIntersector(classFilter, FindReferenceTarget.Element, modelView); intersector.FindReferencesInRevitLinks = true; var result = intersector.Find(origin, -XYZ.BasisZ); foreach (var context in result) ...

2024-11-20
在Revit中实现多类别标记
实现Revit中多类别标记的方法 标记方法的关键词:IndependentTag 在创建标记中有两个方法,输入的参数基本一致,但是还是有所区别,下面描述和图片可以更好的区分第一个函数:通过实际的项目坐标点不需要制定标记类型创建多类别标记Create Method (Document, ElementId, ElementId, Reference, Boolean, TagOrientation, XYZ)第二个函数:通过UVPoint也就是在构件上面的点控制显示位置并且需要制定标记类别Create( Document document, ElementId ownerDBViewId, Reference referenceToTag, bool addLeader, TagMode tagMode, TagOrientation tagOrientation, XYZ pnt ) 代码实例通过document读取视图中的元素,放置多类别注释,如果需要多视图同时操作,则需要找到所有的view并将view传入获得所有的构件 1234567891011121...

2022-10-24
Revit二次开发使用MaterialDesignThemes.Wpf
在开发Revit插件的时候很多会使用WPF创建窗口,我这里引用了MaterialDesignThemes这个组件,在这个文章里面记录一下相应的步骤和问题 使用安装 直接从nuget中搜索MaterialDesignThemes安装 添加reosurces 123456789101112<Window.Resources> <ResourceDictionary> <viewmodel:ObjectConvert x:Key="ObjectConverter" ></viewmodel:ObjectConvert> <ResourceDictionary.MergedDictionaries> <materialDesign:BundledTheme BaseTheme="Light" PrimaryColor=&...
Announcement
欢迎访问!右上角可切换中英文。感谢您的阅读!



