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 =