资源简介
revit导出json数据源代码,请需要这下载使用

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Autodesk.Revit.DB;
namespace CustomExporterAdnMeshJson
{
///
/// The data format specifying one solid for the
/// WebGL viewer defining its centre colour id
/// triangular facets their vertex coordinates
/// indices and normals.
///
class AdnMeshData
{
int FacetCount { get; set; } // optional
int VertexCount { get; set; } // optional
int[] VertexCoords { get; set; }
int[] VertexIndices { get; set; } // triangles
double[] Normals { get; set; }
int[] NormalIndices { get; set; } // not optional one normal per vertex
int[] Center { get; set; }
int Color { get; set; }
string Id { get; set; }
///
/// Apply this factor to all point data when
/// saving to JSON to accomodate the expected
/// scaling.
///
const double _export_factor = 0.002;
public AdnMeshData(
VertexLookupInt vertices
List vertexIndices
NormalLookupXyz normals
List normalIndices
PointInt center
Color color
double transparency
string id )
{
int n = vertexIndices.Count;
Debug.Assert( 0 == (n % 3)
“expected triples of 3D point vertex indices“ );
Debug.Assert( normalIndices.Count == n
“expected a normal for each vertex“ );
FacetCount = n / 3;
n = vertices.Count;
VertexCount = n;
VertexCoords = new int[n * 3];
int i = 0;
foreach( PointInt p in vertices.Keys )
{
VertexCoords[i++] = p.X;
VertexCoords[i++] = p.Y;
VertexCoords[i++] = p.Z;
}
VertexIndices = vertexIndices.ToArray();
n = normals.Count;
Normals = new double[n * 3];
i = 0;
foreach( XYZ v in normals.Keys )
{
Normals[i++] = v.X;
Normals[i++] = v.Y;
Normals[i++] = v.Z;
}
NormalIndices = normalIndices.ToArray();
Center = new int[3];
i = 0;
Center[i++] = center.X;
Center[i++] = center.Y;
Center[i] = center.Z;
byte alpha = (byte) (
( 100 - transparency ) * 2.55555555 );
Color = ConvertClr(
color.Red color.Green color.Blue alpha );
Id = id;
}
///
/// Convert colour and transparency to
/// the required integer format.
///
static int ConvertClr( byte r byte g byte b byte a )
{
return ( r << 24 ) + ( g << 16 ) + ( b << 8 ) + a;
}
public string ToJson()
{
// I did think of using a JSON serialiser
// either one of these two provided by the
// .NET framework or one of the other libraries:
// System.Runtime.Serialization.Json.DataContractJsonSerializer
// System.Web.script.Serialization.J
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\
文件 4195 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\.gitignore
文件 965 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson.sln
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\
文件 4271 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\AdnMeshData.cs
文件 1333 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CentroidVolume.cs
文件 2548 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Command.cs
文件 540 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CustomExporterAdnMeshJson.addin
文件 3551 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CustomExporterAdnMeshJson.csproj
文件 7893 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\ExportContextAdnMesh.cs
文件 1190 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\NormalLookupXyz.cs
文件 1140 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\PointInt.cs
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Properties\
文件 1600 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Properties\AssemblyInfo.cs
文件 1473 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Util.cs
文件 1224 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\VertexLookupInt.cs
文件 5822 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\x.cs
文件 1080 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\LICENSE
文件 873 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\README.md
- 上一篇:rhel7.6
- 下一篇:C51单片机抢答器程序
相关资源
- Notepad++ 32位 jsonview插件
- notepad++ json格式化插件
- Jsonviewer2 for Notepad++ 64 bit
-
Notepad++xm
l格式化插件和json格式化插 -
Volley获取json和xm
l数据解析显示 - eCharts全国及各省、市、县地图层jso
- 编译好的json_lib.lib 包含64位,32位,头
- json格式化工具.zip
- 易语言JSON解析模块2.0源码
- Revit2018帮助文档、lookup及外部加载工
- echart地图 34省js及json文件 344地级js
- 全国各省市地json图
- 宁夏省市地图js和json文件
- Revit二次开发源码大全之二
- echarts生成json地图最新版
- 中国国界和省界的GeoJson格式数据
- bim 门窗族汇总更新
- Revit桥梁族
- 中国地图_GeoJson文件
- 全国市级地图json文件
- 2018revit二次开发论文参考
- revit法院模型
- echart 全国/各省份以及各地级市JSON文
- Echarts省市级地图js,json数据
- 全国各省、市、区json的Echarts地图
- 2018行政区划数据_省市区街居_五级_
- Json.net
- Notepad++的Json格式化插件win32和x64两版
- json获取datatable后生成table分页显示c
- 实现yarnlock与packagelockjson相互转换
评论
共有 条评论