当前位置: 首页 > news >正文

Revit SDK 介绍:CreateAirHandler 创建户式风管机

前言

这个例子介绍如何通过 API 创建一个户式风管机族的内容,包含几何和接头。

内容

在这里插入图片描述

效果

在这里插入图片描述

核心逻辑

  1. 必须打开机械设备的族模板
  2. 创建几何实体来表示风管机
  3. 创建风机的接头

创建几何实体来表示风管机

例子中创建了多个拉伸,下面仅截取一段代码:

// 创建一个 curve 数组
curves = app.NewCurveArray();
curves.Append(Line.CreateBound(profileData[i, 0], profileData[i, 1]));
curves.Append(Line.CreateBound(profileData[i, 1], profileData[i, 2]));
curves.Append(Line.CreateBound(profileData[i, 2], profileData[i, 3]));
curves.Append(Line.CreateBound(profileData[i, 3], profileData[i, 0]));// 创建一个轮廓,curve数组的数组
profile = app.NewCurveArrArray();
profile.Append(curves);// 创建参考平面
plane = Plane.CreateByNormalAndOrigin(sketchPlaneData[i, 0], sketchPlaneData[i, 1]);
sketchPlane = SketchPlane.Create(m_document, plane);// 创建一个拉伸
extrusions[i] = f.NewExtrusion(isSolid[i], profile, sketchPlane,extrusionOffsets[i, 1]);
extrusions[i].StartOffset = extrusionOffsets[i, 0];// 把拉伸加入数组,方便后续的几何合并
m_combineElements.Append(extrusions[i]);

创建风机的接头

例子中有四个接头,两个风管,两个水管。

// 风管接头的例子,创建及设置参数
ConnectorElement connReturnAir = ConnectorElement.CreateDuctConnector(m_document, DuctSystemType.ReturnAir, ConnectorProfileType.Rectangular, m_planarFaces[0].Reference);
param = connReturnAir.get_Parameter(BuiltInParameter.CONNECTOR_HEIGHT);
param.Set(connectorDimensions[1, 0]);
param = connReturnAir.get_Parameter(BuiltInParameter.CONNECTOR_WIDTH);
param.Set(connectorDimensions[1, 1]);
param = connReturnAir.get_Parameter(BuiltInParameter.RBS_DUCT_FLOW_DIRECTION_PARAM);
param.Set(1);
param = connReturnAir.get_Parameter(BuiltInParameter.RBS_DUCT_FLOW_CONFIGURATION_PARAM);
param.Set(1);
param = connReturnAir.get_Parameter(BuiltInParameter.RBS_DUCT_FLOW_PARAM);
param.Set(flow);
// 水管接头的例子,创建及设置参数
ConnectorElement connSupplyHydronic = ConnectorElement.CreatePipeConnector(m_document, PipeSystemType.SupplyHydronic, m_planarFaces[0].Reference);
param = connSupplyHydronic.get_Parameter(BuiltInParameter.CONNECTOR_RADIUS);
param.Set(arcRadius);
param = connSupplyHydronic.get_Parameter(BuiltInParameter.RBS_PIPE_FLOW_DIRECTION_PARAM);
param.Set(2);

创建机电接头的接口

namespace Autodesk.Revit.DB
{public class ConnectorElement : Element, IConnector{public virtual Transform CoordinateSystem { get; }public bool IsPrimary { get; }public MEPSystemClassification SystemClassification { get; set; }public XYZ Direction { get; }public virtual double Width { get; }public virtual ConnectorProfileType Shape { get; }public virtual XYZ Origin { get; }public virtual double Radius { get; }public virtual double Height { get; }public virtual Domain Domain { get; }public static ConnectorElement CreateCableTrayConnector(Document document, Reference planarFace, Edge edge);public static ConnectorElement CreateCableTrayConnector(Document document, Reference planarFace);public static ConnectorElement CreateConduitConnector(Document document, Reference planarFace, Edge edge);public static ConnectorElement CreateConduitConnector(Document document, Reference planarFace);public static ConnectorElement CreateDuctConnector(Document document, DuctSystemType ductSystemType, ConnectorProfileType profileShape, Reference planarFace);public static ConnectorElement CreateDuctConnector(Document document, DuctSystemType ductSystemType, ConnectorProfileType profileShape, Reference planarFace, Edge edge);public static ConnectorElement CreateElectricalConnector(Document document, ElectricalSystemType electricalSystemType, Reference planarFace);public static ConnectorElement CreateElectricalConnector(Document document, ElectricalSystemType electricalSystemType, Reference planarFace, Edge edge);public static ConnectorElement CreatePipeConnector(Document document, PipeSystemType pipeSystemType, Reference planarFace);public static ConnectorElement CreatePipeConnector(Document document, PipeSystemType pipeSystemType, Reference planarFace, Edge edge);public void AssignAsPrimary();public void FlipDirection();public ConnectorElement GetLinkedConnectorElement();public bool IsSystemClassificationValid(MEPSystemClassification systemClassification);public void SetLinkedConnectorElement(ConnectorElement otherConnector);}
}

其它

创建几何实体来表示风管机和创建风机的接头之后都需要调用m_document.Regenerate来更新文档。

http://www.lryc.cn/news/149704.html

相关文章:

  • 微信小程序云开发-云函数发起https请求简易封装函数
  • 深入探索PHP编程:连接数据库的完整指南
  • 【Centos8配置节点免密登陆】
  • 不可变集合、Lambda表达式、Stream流
  • Three.js GLTF模型加载
  • 外包干了2个月,技术退步明显...
  • java八股文面试[多线程]——主内存和工作内存的关系
  • 技术分享 | LSM,Linux 内核的安全防护盾
  • http服务(Apache 2.4.57)源码编译及使用
  • 【1day】H5S视频平台未授权漏洞学习
  • 企业架构LNMP学习笔记3
  • 使用Spring Boot和Kafka实现消息发送和订阅
  • 探讨uniapp的组件使用的问题
  • 【跟小嘉学 Rust 编程】十七、面向对象语言特性
  • mall :rabbit项目源码解析
  • JDBC连接数据库
  • Linux学习之Ubuntu 20中OpenResty的nginx目录里内容和配置文件
  • 使用axi_quad_spi操作spi_flash
  • Linux:tomcat (源码包安装)(官网下载-安装-启动-配置-等等等-----从入门到入土)
  • 中科驭数以DPU先进计算技术,夯实下一代金融IT基础设施底座
  • Android 手游聚合SDK小知识(二) 聚合分包
  • 【RISC-V】RISC-V寄存器
  • Python爬虫异常处理实践:处理被封禁和网站升级问题
  • 重大工程建造云服务平台源码 SpringCloud+Vue
  • MyBatisPlus简单入门
  • 神经网络入门
  • 【面试经典150题】多数元素
  • c#垃圾回收(Garbage Collection)
  • vue 基于element-plus el-button封装按钮组件
  • smbus只能再python2.7下运行?不能再python3.8下运行吗?