Revit2014 支持编程创建管道并且立即赋予系统类型名称
2013-11-25 15:21
323 查看
在Revit2013里面,当我们用NewPipe创建完成一个管道后,若这个管断是独立的没有与其它已经具有系统类型的管道或终端设备连接,这个管段的系统类型属性是没有定义的。通过编程也无法赋予系统类型。 这个问题已经办法我已经写过一个博文:http://blog.csdn.net/JoeXiongjin/article/details/8133749
在Revit 2014里面,Pipe类提供了Create()方法来创建管子, 其参数如下所示:
我们可以看到在参数中可以指定系统类型的Id,这样生成的管段就自动具有系统类型信息了,Revit自动为这个管子创建了一个管道系统PipingSystem对象。
下面是实例代码:
转载请复制以下信息:原文链接: http://blog.csdn.net/joexiongjin/article/details/16944941作者: 叶雄进2013.11.25
在Revit 2014里面,Pipe类提供了Create()方法来创建管子, 其参数如下所示:
public static Pipe Create( Document document, ElementId systemTypeId, ElementId pipeTypeId, ElementId levelId, XYZ firstPoint, XYZ secondPoint )
我们可以看到在参数中可以指定系统类型的Id,这样生成的管段就自动具有系统类型信息了,Revit自动为这个管子创建了一个管道系统PipingSystem对象。
下面是实例代码:
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using Autodesk.Revit .DB; using Autodesk.Revit.UI; using Autodesk.Revit.DB.Plumbing; using Autodesk.Revit .ApplicationServices; using Autodesk.Revit.Attributes ; using Autodesk.Revit.UI.Selection; [TransactionAttribute(TransactionMode.Manual)] public class CreatePipe2014 : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements) { UIApplication app = commandData.Application; Document doc = app.ActiveUIDocument.Document; Transaction trans = new Transaction(doc); trans.Start("createPipe"); FilteredElementCollector collector = new FilteredElementCollector(doc); collector.OfClass(typeof(PipeType)); PipeType pt = collector.FirstElement() as PipeType; //ElementId id = new ElementId((int)PipeSystemType.DomesticColdWater); FilteredElementCollector col = new FilteredElementCollector(doc); col.OfClass(typeof(PipingSystemType)); ElementId id = col.FirstElementId(); Pipe p = Pipe.Create(doc, id,pt.Id, doc.ActiveView.GenLevel.Id, new XYZ(0, 0, 0), new XYZ(10, 0, 0)); trans.Commit(); return Result.Succeeded ; } }
转载请复制以下信息:原文链接: http://blog.csdn.net/joexiongjin/article/details/16944941作者: 叶雄进2013.11.25
相关文章推荐
- 在Revit中,如何编程创建新类型(如窗户或墙)
- 练习 2017-08-22 通过控制台,获取类名,字段名称,字段类型,根据一个模板文件,自动创建这个类文件,并且为字段提供setter和getter方法
- Revit API过滤管道系统类型
- 创建新的管道类型,并且修改管道的弯头类型和T形连接弯头类型
- 地磅称量系统之(24~26)创建一个名称为WinApp的Windows应用程序作为启动项目并且设置主界面上控件的属性
- Revit2014机电系统类型BUG
- 虚拟机上如何创建自定义分区或格式化自定义文件系统类型
- 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL
- MAC OS X系统创建git服务器,支持mac/windows代码
- 批量创建10个系统用户,并且设置随机数密码
- Shell编程面试题2_批量创建随机名称的文件
- 编写一个程序,可以通过次程序完成一个表的创建操作,输入表的名称,各个列的名称及类型,输入完成后直接通过JDBC创建指定的表。
- linux系统编程之管道(二):管道读写规则和Pipe Capacity、PIPE_BUF
- 在Revit 2013里 如何编程创建(东西南北四个方向)的立面图
- Linux系统编程——进程间通信(管道)
- Revit 二次开发之“在机械设备之间创建机械系统”
- Lu基于系统内置对象创建扩展数据类型,小矩阵乘效率测试
- 微软 Windows CE 系统编程支持的 C 运行时函数
- 设计一个学生类,其中包含学号、姓名、成绩等数据成员,创建学生对象并且倒入到文件file.txt,然后由文件读取到另一个学生对象并输出,试编程实现。