BIM建筑网
更专业的BIM技术学习网站!


Revit二次开发——场地地形

免费的Ai上线啦!
BIM建筑网自主研发,你想要Ai功能都在这里!
Ai·提升效率 技术答疑

Revit的场地地形其实没有什么特别的,其实它就是一个面而已,创建这个面用下面这个方法:

Form NewFormByCap(bool isSolid, ReferenceArray profile); 

如果是做成五花肉那种的,就用另一个方法:

Form NewLoftForm(bool isSolid, ReferenceArrayArray profiles); 

Revit二次开发——场地地形

首先用以下代码来创建一个地形面:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;

namespace 地形
{
 [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
 [Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
 [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
 public class Class1 : IExternalCommand
 {
 public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
 {
 Document revitDoc = commandData.Application.ActiveUIDocument.Document; //取得文档
 Application revitApp = commandData.Application.Application; //取得应用程序

 using (Transaction transaction = new Transaction(revitDoc))
 {
 transaction.Start("主题");
 //在下面添加主要代码内容
 //因为CurveByPoints不能是封闭曲线,所以这里建两条线
 ReferencePointArray refPointArray = new ReferencePointArray();
 ReferencePointArray refPointArray2= new ReferencePointArray();
 ReferencePoint referencePoint1 = revitDoc.FamilyCreate.NewReferencePoint(new XYZ(0,0,0));
 ReferencePoint referencePoint2 = revitDoc.FamilyCreate.NewReferencePoint(new XYZ(100, 0, 0));
 ReferencePoint referencePoint3 = revitDoc.FamilyCreate.NewReferencePoint(new XYZ(100, 100, 0));
 ReferencePoint referencePoint4 = revitDoc.FamilyCreate.NewReferencePoint(new XYZ(0, 100, 0));
 refPointArray.Append(referencePoint1);
 refPointArray.Append(referencePoint2);
 refPointArray.Append(referencePoint3);
 refPointArray.Append(referencePoint4);

 CurveByPoints curve1 = revitDoc.FamilyCreate.NewCurveByPoints(refPointArray);

 refPointArray2.Append(referencePoint1);
 refPointArray2.Append(referencePoint4);
 CurveByPoints curve2 = revitDoc.FamilyCreate.NewCurveByPoints(refPointArray2);

 ReferenceArray profile = new ReferenceArray();
 profile.Append(curve1.GeometryCurve.Reference);
 profile.Append(curve2.GeometryCurve.Reference);

 Form form = revitDoc.FamilyCreate.NewFormByCap(true, profile);



 transaction.Commit();

 }
 return Result.Succeeded;
 }
 }
}

结果如图:Revit二次开发——场地地形
创建有等高线的地形表面(核心还是用下面的这个api):

Form NewFormByCap(bool isSolid, ReferenceArray profile); 

效果如图:

Revit二次开发——场地地形

如果需要变成实体则用Form NewLoftForm(bool isSolid, ReferenceArrayArray
profiles); 

微信公众号:xuebim
关注建筑行业BIM发展、研究建筑新技术,汇集建筑前沿信息!
← 微信扫一扫,关注我们+
赞(0) 打赏
BIM建筑网 » Revit二次开发——场地地形

评论 抢沙发

评论前必须登录!

 

BIM建筑网,更专业的BIM技术学习网站!

关注建筑新动态,分享建筑新技术

联系我们关于BIM建筑网

觉得文章有用就打赏一下小编吧

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

扫码登录

微信「关注」,快捷登录
扫码关注后会自动登录
注册登录代表您已同意《用户许可协议》
账号登录 | 其他登录

|登录

找回密码

|账号登录注册