如何将revit文件进行数据导出和数据转换,是非常重要的问题,是解决我们如何将revit的数据解析为我们自己的数据,在revit的二次开发中,给我们提供IExportContext接口。当前接口可用户模型轻量化导出、自定义格式导出等。
namespace Autodesk.Revit.DB
{
public interface IExportContext
{
void Finish();
bool IsCanceled();
RenderNodeAction OnElementBegin(ElementId elementId);
void OnElementEnd(ElementId elementId);
RenderNodeAction OnFaceBegin(FaceNode node);
RenderNodeAction OnInstanceBegin(InstanceNode node);
void OnInstanceEnd(InstanceNode node);
void OnLight(LightNode node);
RenderNodeAction OnLinkBegin(LinkNode node);
void OnLinkEnd(LinkNode node);
void OnMaterial(MaterialNode node);
void OnPolymesh(PolymeshTopology node);
void OnRPC(RPCNode node);
RenderNodeAction OnViewBegin(ViewNode node);
void OnViewEnd(ElementId elementId);
bool Start();
}
}
当前接口在数据导出中,执行如下的顺序:

通过以上的导出,可以将revit的信息全部导出为需要的数据格式。