当前位置:网站首页>Revit二次开发——多管道线性标注(第十八期)
Revit二次开发——多管道线性标注(第十八期)
2022-04-21 12:48:00 【一席青衣卧龙城】
2020年还真的是见证历史的一年,疫情爆发,美元熔断,原油暴跌,所以是玛雅预言的2012推迟了?
说回正题,来说说线性标注。
线性标注主要是提供了2种API:
但其实也算是一种,第二个可以选择标注样式。
主要的三个参数:
- view 标注的视图
- line 标注线
- references 稳定的引用
这里要注意标注视图只能在平面视图或者立面视图进行,本节示例方法只可用在线性元素上。
示例代码如下:
管线标注比较简单不用访问几何图元,因此以此作为参考示例,方法基本是一致的。
Selection selection = uiDoc.Selection;
//选择需要标注尺寸的图元
IList<Reference> referenceList = selection.PickObjects(ObjectType.Element, "请选择要标注的图元");
if (referenceList.Count < 1)
{
TaskDialog.Show("警告", "选择数量出错,请重新选择");
}
Autodesk.Revit.DB.View view = doc.ActiveView;
ViewType vt = view.ViewType;
if (vt == ViewType.FloorPlan || vt == ViewType.Elevation)
{
//取得其中一个图元 获取其位置
Element element = doc.GetElement(referenceList.ElementAt(0));
Line line = (element.Location as LocationCurve).Curve as Line;
Element element2 = doc.GetElement(referenceList.ElementAt(1));
Line line2 = (element2.Location as LocationCurve).Curve as Line;
XYZ linemiddle = line.Evaluate(0.5, true);
//在这条线上投射指定的点的交点
XYZ projectPoint = line2.Project(linemiddle).XYZPoint;
Line newLine = Line.CreateBound(linemiddle, projectPoint);
ReferenceArray references = new ReferenceArray();
foreach (Reference reference in referenceList)
{
references.Append(reference);
}
//调用创建尺寸的方法创建
Dimension autoDimension = doc.Create.NewDimension(view, newLine, references);
}
else
{
TaskDialog.Show("警告", "标注视图不是平面视图或立面视图");
}
来看一下效果:
标注前
选中要标注的管道
标注完成的效果
版权声明
本文为[一席青衣卧龙城]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1985231
边栏推荐
- AES自动生成base64密钥加密解密
- SM state secret learning
- Machine learning-sklearn-13 (regression family - lower - nonlinear problem: polynomial regression (a new characteristic matrix is formed after polynomial transformation))
- Calculate the day of the year and implement it in C language
- 2020BATJZ大厂Android高级工程师面试题-选择题合集(附答案解析)
- 2020 meituan (multithreading + redis)
- Binary tree traversal series 02 Morris traversal
- 【贪玩巴斯】带你拿雅思Task1 小作文 7+ —— Dynamic+Static图表 & Mixed多图(Table/pie chart/line graph/bar chart)2022-4-18
- AcWing 1854. 晋升计数 题解 解方程推式子
- Modify the name of the string through the list
猜你喜欢
![[200 opencv routines by youcans] 159 Fixed threshold method for image processing](/img/ae/78fe6543589d0d0f5450c5ca0ae067.png)
[200 opencv routines by youcans] 159 Fixed threshold method for image processing

The soul of the frame - Reflection

研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台

2020 meituan (multithreading + redis)

How nodejs converts buffer data to string
![[C language implementation of address book] takes you through the key and difficult points of C language](/img/6d/62fd7f84532f072f30752c9878c69a.png)
[C language implementation of address book] takes you through the key and difficult points of C language

pycharm 跳转到指定行

2022年G3锅炉水处理上岗证题目及答案

Game industry case 2: player level

新技术又来了,拥抱AGP7.0,准备好告别Transform了吗?
随机推荐
基于同态加密的PSI开源库-1
[SQL] sql19 finds the last of all employees_ Name and first_ Name and corresponding Dept_ name
2022年一级注册建筑师考试建筑物理与设备复习题及答案
Validation data validation annotation
Long Zhi was assessed as CMMI [3]
[MySQL] extract and query JSON type field data
2022年监理工程师考试质量、投资、进度控制练习题及答案
初始响应工具包
[fun bath] take you to IELTS task 1 essay 7 + -- Dynamic + static chart & Mixed chart (Table / pie chart / line graph / bar chart) 2022-4-18
2020BATJZ大厂Android高级工程师面试题-选择题合集(附答案解析)
Software engineering final exam questions and answers
一文了解全面静态代码分析
[200 opencv routines by youcans] 159 Fixed threshold method for image processing
Go language reflection
DeFi借贷VS传统金融“无风险”利率产品
数据显示ETH燃烧的有多猛
通过列表修改字符串的坑
Controlling the release and introduction of rip routing based on Routing
有效三角形的个数 (双指针(逆向扫描)+二分)
基于C#实现文本读取的7种方式