Revit二次开发---关于CAD翻模第一步

本文介绍了一种Revit二次开发方法,通过改进的算法直接读取CAD图纸信息,避免了预处理步骤,能直接在Revit中生成三维模型。使用Teigha.DLL库,实现选择CAD文件后,程序自动解析线条数据并创建模型线。
摘要由CSDN通过智能技术生成

2019年6月6日,南京,暴雨。

  笔者改善以前关于翻模的一些想法,以减少对翻模图纸的初步处理。

以前使用使用直接链接CAD的方法生成各种三维模型。链接进来的CAD图纸需要处理,且文字读取较为困难,故使用价值不大。经过改进,现在直接读取CAD图纸信息,经过算法直接处理后可直接于revit中生成模型。

前期准备,需要找到Teigha.DLL库,笔者用的事Teigha_Net_3_09_10(x64),可在网络获取,也可加入群--revit二次开发学习群(群号480950299),查找《Teigha 2.0 3.0(64) 4.0 版本 使用汇总》。

引用部分为:

由于Addin会记录上次使用的dll函数,所以每一次使用生成的dll都需要重新打开Revit。制作成按钮模式可避免这种事情的发生,但由于按钮模式无法进行单步调试,所以还是每测试一次。从新启动一次Revit2018.

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
using Teigha.Runtime;
using Teigha.DatabaseServices;
using System.Windows.Forms;
using Teigha.Geometry;

namespace TestWriteAndRead
{
    [Transaction(TransactionMode.Manual)]
    public class Test : IExternalCommand
    {
        /// <summary>
        /// 存放线条点的数组
        /// </summary>
        public List<LineInfo> lineInfos { set; get; }//不要忘记初始化

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var RevitUIDocument = commandData.Application.ActiveUIDocument;
            var RevitDocument = commandData.Application.ActiveUIDocument.Document;
            var RevitSelection =

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值